From patchwork Sat Feb 21 15:47:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jouni Malinen X-Patchwork-Id: 442199 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id B83AA140190 for ; Sun, 22 Feb 2015 02:47:19 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 8EC2E9D44F; Sat, 21 Feb 2015 10:47:17 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 50nZiYUewwGu; Sat, 21 Feb 2015 10:47:17 -0500 (EST) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id DC4969D450; Sat, 21 Feb 2015 10:47:12 -0500 (EST) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 8336F9D451 for ; Sat, 21 Feb 2015 10:47:11 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bcTOwpzy0nXA for ; Sat, 21 Feb 2015 10:47:06 -0500 (EST) Received: from li674-96.members.linode.com (mail.w1.fi [212.71.239.96]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id D86BF9D44F for ; Sat, 21 Feb 2015 10:47:06 -0500 (EST) Received: from jm (178-55-39-111.bb.dnainternet.fi [178.55.39.111]) by li674-96.members.linode.com (Postfix) with ESMTPSA id AE8F5111AD for ; Sat, 21 Feb 2015 15:47:04 +0000 (UTC) Received: by jm (sSMTP sendmail emulation); Sat, 21 Feb 2015 17:47:04 +0200 Date: Sat, 21 Feb 2015 17:47:04 +0200 From: Jouni Malinen To: hostap@lists.shmoo.com Subject: Re: Adjusting wpa_ctrl.c for use in/by external programs Message-ID: <20150221154704.GI5076@w1.fi> Mail-Followup-To: hostap@lists.shmoo.com References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.11 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com On Wed, Jan 28, 2015 at 11:45:20AM +0100, Rafał Miłecki wrote: > Documentation just says optimistic "External programs (...) should > link in wpa_ctrl.c": > http://w1.fi/hostapd/devel/ctrl_iface_page.html > Easier said than done. It was likely a bit easier at the time this comment was added, but yes, this does involve getting some more files included in the current design. > 2) Make wpa_ctrl a separated library. A bit harder to achieve (one > would need to known hostapd Makefile-s magic), but cleaner in the > final result. Maybe a bit of overhead for such a small library, I > don't know. It is not really that complex to do that. I'll add a wpa_supplicant/Makefile target to allow this to be generated: [PATCH] Add wpa_supplicant Makefile target libwpa_ctrl.a "make -C wpa_supplicant libwpa_ctrl.a" can now be used to build a static library that can be linked with external programs using wpa_ctrl.h. This makes it easier to create a separate library package that does not depend in any other hostap.git file other than src/common/wpa_ctrl.h and the libwpa_ctrl.a built with this new make target. Signed-off-by: Jouni Malinen --- wpa_supplicant/Makefile | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile index 95fbe78..f2e82f8 100644 --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile @@ -105,6 +105,7 @@ OBJS += ../src/utils/trace.o OBJS_p += ../src/utils/trace.o OBJS_c += ../src/utils/trace.o OBJS_priv += ../src/utils/trace.o +LIBCTRL += ../src/utils/trace.o LDFLAGS += -rdynamic CFLAGS += -funwind-tables ifdef CONFIG_WPA_TRACE_BFD @@ -1636,6 +1637,15 @@ wpa_cli: $(OBJS_c) $(Q)$(LDO) $(LDFLAGS) -o wpa_cli $(OBJS_c) $(LIBS_c) @$(E) " LD " $@ +LIBCTRL += ../src/common/wpa_ctrl.o +LIBCTRL += ../src/utils/os_$(CONFIG_OS).o +LIBCTRL += ../src/utils/wpa_debug.o + +libwpa_ctrl.a: $(LIBCTRL) + $(Q)rm -f $@ + $(Q)$(AR) cr $@ $? + @$(E) " AR " $@ + link_test: $(OBJS) $(OBJS_h) tests/link_test.o $(Q)$(LDO) $(LDFLAGS) -o link_test $(OBJS) $(OBJS_h) tests/link_test.o $(LIBS) @$(E) " LD " $@ @@ -1755,5 +1765,6 @@ clean: rm -f nfc_pw_token rm -f lcov.info rm -rf lcov-html + rm -f libwpa_ctrl.a -include $(OBJS:%.o=%.d)