From patchwork Thu Aug 13 01:45:38 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip Prindeville X-Patchwork-Id: 40962 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n7D1jowW003214 for ; Thu, 13 Aug 2009 01:45:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751993AbZHMBpq (ORCPT ); Wed, 12 Aug 2009 21:45:46 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751869AbZHMBpp (ORCPT ); Wed, 12 Aug 2009 21:45:45 -0400 Received: from mail.redfish-solutions.com ([66.232.79.143]:34859 "EHLO mail.redfish-solutions.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750806AbZHMBpp (ORCPT ); Wed, 12 Aug 2009 21:45:45 -0400 Received: from [192.168.10.7] (builder.redfish-solutions.com [192.168.10.7]) (authenticated bits=0) by mail.redfish-solutions.com (8.14.2/8.14.2) with ESMTP id n7D1jcWo011198 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 12 Aug 2009 19:45:46 -0600 Message-ID: <4A837042.4000507@redfish-solutions.com> Date: Wed, 12 Aug 2009 18:45:38 -0700 From: "Philip A. Prindeville" User-Agent: Thunderbird 2.0.0.21 (X11/20090320) MIME-Version: 1.0 To: wireless Subject: Minimal cross-compilation fix for CRDA X-Scanned-By: MIMEDefang 2.67 on 192.168.1.3 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Reposting. I think I've addresses all of the comments, and this fix is as short as possible. I considered passing in all of the variables from outside, but (a) this doesn't scale well, and (b) things like $(NLLIBNAME) are "scratch" variables used by the make process when doing discovery about the host it's running on... they shouldn't be externally visible, much less overridden by some encompassing make. Putting the auto-discovery into its own path with a gating variable seems like the cleanest, most robust, most maintainable approach. Changes: 1. Move invariant definitions to before any cross-compilation conditional sections for clarity (and to avoid having to duplicate them). 2. Bracket any host (native) compilation sections with conditional based on $(CROSS_COMPILE) being empty. 4. Add 'else' section for cross-compilation using openssl and libnl-1 (or libnl-2 if explicitly selected). --- crda-1.1.0/Makefile 2009-08-10 13:37:36.000000000 -0700 +++ crda-1.1.0/Makefile.new 2009-08-10 17:29:22.000000000 -0700 @@ -22,12 +22,17 @@ # with make PUBKEY_DIR=/usr/lib/crda/pubkeys PUBKEY_DIR?=pubkeys +MKDIR ?= mkdir -p +INSTALL ?= install + CFLAGS += -Wall -g all: all_noverify verify all_noverify: crda intersect regdbdump +ifeq ($(CROSS_COMPILE),) + ifeq ($(USE_OPENSSL),1) CFLAGS += -DUSE_OPENSSL `pkg-config --cflags openssl` LDLIBS += `pkg-config --libs openssl` @@ -41,8 +46,6 @@ reglib.o: keys-gcrypt.c endif -MKDIR ?= mkdir -p -INSTALL ?= install NL1FOUND := $(shell pkg-config --atleast-version=1 libnl-1 && echo Y) NL2FOUND := $(shell pkg-config --atleast-version=2 libnl-2.0 && echo Y) @@ -64,6 +67,31 @@ NLLIBS += `pkg-config --libs $(NLLIBNAME)` CFLAGS += `pkg-config --cflags $(NLLIBNAME)` +else + +ifeq ($(USE_OPENSSL),1) +CFLAGS += -DUSE_OPENSSL +LDLIBS += -lssl + +reglib.o: keys-ssl.c + +else +CFLAGS += -DUSE_GCRYPT +LDLIBS += -lgcrypt + +reglib.o: keys-gcrypt.c + +endif + +ifeq ($(USE_LIBNL20),1) +CFLAGS += -DCONFIG_LIBNL20 +NLLIBS = -lnl-genl -lnl-2.0 +else +NLLIBS = -lnl +endif + +endif + ifeq ($(V),1) Q= NQ=@true