From 1924d5c1eabd68152d99c3c42910aee35f42d19e Mon Sep 17 00:00:00 2001 From: "Luis R. Rodriguez" Date: Thu, 8 Mar 2012 18:02:04 -0800 Subject: [PATCH] compat-wireless: remove recurssive call on building modules The recursion call to build modules is not required. It was added due to the fact that we now included a new file, CONFIG_COMPAT and we needed it at build time. We do not need the recursive call given that the kernel will already call the same Makefile later when building modules. We take advantage of this fact and simply ensure we build CONFIG_COMPAT when processing our rules. We do not define a direct target for CONFIG_COMPAT given that we want to force a regeneration of the file and compat autoconf, whenever the build environment changes. We still add a dummy CONFIG_COMPAT target rule to avoid Make looking rules for it. In order for this build to work we now just need to export CFLAGS so that the variables defined on the first pass are available later at module build time. Signed-off-by: Luis R. Rodriguez --- Makefile | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index fe9d3628c4cf..70a7985db0a0 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,9 @@ DESTDIR?= ifneq ($(KERNELRELEASE),) +include $(COMPAT_CONFIG_CW) +include $(COMPAT_CONFIG) + NOSTDINC_FLAGS := -I$(M)/include/ \ -include $(M)/include/linux/compat-2.6.h \ $(CFLAGS) @@ -51,7 +54,7 @@ $(error "The path to this compat-wireless directory has spaces in it." \ "Please put it somewhere where there is no space") endif -CFLAGS += \ +export CFLAGS += \ -DCOMPAT_BASE_TREE="\"$(shell cat $(PWD)/compat_base_tree)\"" \ -DCOMPAT_BASE_TREE_VERSION="\"$(shell cat $(PWD)/compat_base_tree_version)\"" \ -DCOMPAT_PROJECT="\"Compat-wireless\"" \ @@ -67,18 +70,11 @@ export CREL=$(shell cat $(PWD)/compat_version) export CREL_PRE:=.compat_autoconf_ export CREL_CHECK:=$(PWD)/$(CREL_PRE)$(CREL) -include $(COMPAT_CONFIG_CW) - -# Recursion lets us ensure we get this file included. -# Trick is to run make -C $(PWD) modules later. --include $(COMPAT_CONFIG) +all: modules -all: $(CREL_CHECK) - -$COMPAT_CONFIG: ; +$(COMPAT_CONFIG): ; modules: $(CREL_CHECK) - @./scripts/check_config.sh $(MAKE) -C $(KLIB_BUILD) M=$(PWD) modules @touch $@ @@ -87,17 +83,21 @@ bt: $(CREL_CHECK) $(MAKE) -C $(KLIB_BUILD) M=$(PWD) BT=TRUE modules @touch $@ -# With the above and this we make sure we generate a new compat autoconf per -# new relase of compat-wireless-2.6 OR when the user updates the -# $(COMPAT_CONFIG) file +# We use a CREL_CHECK variable which will depend on the environment used to +# build. If the environment requirements change it forces a reconfiguration +# check. This means we force a new reconfiguration check if a the user gets a +# new updates of compat-wireless or when the user updates the $(COMPAT_CONFIG) +# file. +# XXX: add kernel target to the CREL_CHECK mix, this would ensure we also +# reconfigure and build again fresh if we detect a new target kernel is +# being used. $(CREL_CHECK): @# Force to regenerate compat autoconf @./compat/scripts/gen-compat-config.sh > $(COMPAT_CONFIG) @rm -f $(CONFIG_CHECK) @./scripts/check_config.sh - @touch $@ @md5sum $(COMPAT_CONFIG_CW) > $(CONFIG_CHECK) - make -C $(PWD) modules + @touch $@ btinstall: btuninstall bt-install-modules -- 2.30.2