From 840c0f0a5744ff1934646f5ad6f3a70ae7ae60de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Kijewski?= Date: Tue, 17 Jun 2014 03:34:17 +0200 Subject: [PATCH] make: detect their module name automatically MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For many modules the `Makefile` contains a line like ``` MODULE:=$(shell basename $(CURDIR)) ``` This conclusively shows that we do not have to set the module name manually. This PR removes the need to set the module name manually, if it is the same as the basename. E.g. for `…/sys/vtimer/Makefile` the variable make `MODULE` will still be `vtimer`, because it is the basename of the Makefile. --- Makefile.base | 2 ++ core/Makefile | 2 -- cpu/arm_common/Makefile | 2 -- cpu/cortex-m3_common/Makefile | 4 ---- cpu/lpc2387/gpioint/Makefile | 2 -- cpu/lpc2387/i2c/Makefile | 2 -- cpu/lpc2387/mci/Makefile | 2 -- cpu/lpc2387/rtc/Makefile | 2 -- cpu/lpc_common/Makefile | 2 -- cpu/native/rtc/Makefile | 2 -- cpu/sam3x8e/periph/Makefile | 3 --- drivers/Makefile | 2 -- drivers/at86rf231/Makefile | 2 -- drivers/cc110x/Makefile | 2 -- drivers/cc110x_ng/Makefile | 2 -- drivers/cc2420/Makefile | 2 -- drivers/lm75a/Makefile | 1 - drivers/ltc4150/Makefile | 1 - drivers/sht11/Makefile | 1 - drivers/srf02/Makefile | 1 - drivers/srf08/Makefile | 1 - sys/auto_init/Makefile | 2 -- sys/bloom/Makefile | 2 -- sys/config/Makefile | 2 -- sys/crypto/Makefile | 2 -- sys/hashes/Makefile | 2 -- sys/lib/Makefile | 2 -- sys/net/ccn_lite/Makefile | 2 -- sys/net/crosslayer/net_help/Makefile | 2 -- sys/net/link_layer/ieee802154/Makefile | 2 -- sys/net/link_layer/net_if/Makefile | 1 - sys/net/network_layer/sixlowpan/Makefile | 1 - sys/net/routing/Makefile | 2 -- sys/net/routing/rpl/Makefile | 2 -- sys/net/transport_layer/destiny/Makefile | 2 -- sys/ping/Makefile | 2 -- sys/posix/Makefile | 2 -- sys/posix/pnet/Makefile | 2 -- sys/posix/pthread/Makefile | 2 -- sys/ps/Makefile | 2 -- sys/quad_math/Makefile | 2 -- sys/random/Makefile | 2 -- sys/shell/Makefile | 2 -- sys/timex/Makefile | 2 -- sys/transceiver/Makefile | 2 -- sys/uart0/Makefile | 2 -- sys/vtimer/Makefile | 2 -- tests/unittests/tests-core/Makefile | 2 -- 48 files changed, 2 insertions(+), 90 deletions(-) diff --git a/Makefile.base b/Makefile.base index e91150aedc..b28b42e032 100644 --- a/Makefile.base +++ b/Makefile.base @@ -2,6 +2,8 @@ ifeq (, $(__RIOTBUILD_FLAG)) $(error You cannot build a module on its own. Use "make" in your application's directory instead.) endif +MODULE ?= $(shell basename $(CURDIR)) + ASMSRC = $(wildcard *.s) ASSMSRC = $(wildcard *.S) ASMOBJ = $(ASMSRC:%.s=$(BINDIR)$(MODULE)/%.o) diff --git a/core/Makefile b/core/Makefile index d420149bd2..48422e909a 100644 --- a/core/Makefile +++ b/core/Makefile @@ -1,3 +1 @@ -MODULE =core - include $(RIOTBASE)/Makefile.base diff --git a/cpu/arm_common/Makefile b/cpu/arm_common/Makefile index 91fd438c80..9644e22934 100644 --- a/cpu/arm_common/Makefile +++ b/cpu/arm_common/Makefile @@ -1,4 +1,2 @@ -MODULE =arm_common - CFLAGS += $(CFLAGS_BASIC) include $(RIOTBASE)/Makefile.base diff --git a/cpu/cortex-m3_common/Makefile b/cpu/cortex-m3_common/Makefile index 5295dccc6a..48422e909a 100644 --- a/cpu/cortex-m3_common/Makefile +++ b/cpu/cortex-m3_common/Makefile @@ -1,5 +1 @@ - -# define the module that is build -MODULE = cortex-m3_common - include $(RIOTBASE)/Makefile.base diff --git a/cpu/lpc2387/gpioint/Makefile b/cpu/lpc2387/gpioint/Makefile index 960dd49c72..48422e909a 100644 --- a/cpu/lpc2387/gpioint/Makefile +++ b/cpu/lpc2387/gpioint/Makefile @@ -1,3 +1 @@ -MODULE =gpioint - include $(RIOTBASE)/Makefile.base diff --git a/cpu/lpc2387/i2c/Makefile b/cpu/lpc2387/i2c/Makefile index 5a2dc6bbd5..48422e909a 100644 --- a/cpu/lpc2387/i2c/Makefile +++ b/cpu/lpc2387/i2c/Makefile @@ -1,3 +1 @@ -MODULE =i2c - include $(RIOTBASE)/Makefile.base diff --git a/cpu/lpc2387/mci/Makefile b/cpu/lpc2387/mci/Makefile index 43164be733..48422e909a 100644 --- a/cpu/lpc2387/mci/Makefile +++ b/cpu/lpc2387/mci/Makefile @@ -1,3 +1 @@ -MODULE =mci - include $(RIOTBASE)/Makefile.base diff --git a/cpu/lpc2387/rtc/Makefile b/cpu/lpc2387/rtc/Makefile index 042b611808..48422e909a 100644 --- a/cpu/lpc2387/rtc/Makefile +++ b/cpu/lpc2387/rtc/Makefile @@ -1,3 +1 @@ -MODULE =rtc - include $(RIOTBASE)/Makefile.base diff --git a/cpu/lpc_common/Makefile b/cpu/lpc_common/Makefile index 7c6b421300..48422e909a 100644 --- a/cpu/lpc_common/Makefile +++ b/cpu/lpc_common/Makefile @@ -1,3 +1 @@ -MODULE =lpc_common - include $(RIOTBASE)/Makefile.base diff --git a/cpu/native/rtc/Makefile b/cpu/native/rtc/Makefile index e22d4d999a..4847e7a5f1 100644 --- a/cpu/native/rtc/Makefile +++ b/cpu/native/rtc/Makefile @@ -1,5 +1,3 @@ -MODULE =rtc - include $(RIOTBASE)/Makefile.base $(BINDIR)$(MODULE)/%.o: %.c diff --git a/cpu/sam3x8e/periph/Makefile b/cpu/sam3x8e/periph/Makefile index 7acf6de7da..48422e909a 100644 --- a/cpu/sam3x8e/periph/Makefile +++ b/cpu/sam3x8e/periph/Makefile @@ -1,4 +1 @@ - -MODULE = periph - include $(RIOTBASE)/Makefile.base diff --git a/drivers/Makefile b/drivers/Makefile index 6789873156..de5ade431f 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -1,5 +1,3 @@ -MODULE = drivers - DIRS= ifneq (,$(filter powermon,$(USEMODULE))) DIRS += powermon diff --git a/drivers/at86rf231/Makefile b/drivers/at86rf231/Makefile index f0ae7afb32..48422e909a 100644 --- a/drivers/at86rf231/Makefile +++ b/drivers/at86rf231/Makefile @@ -1,3 +1 @@ -MODULE =at86rf231 - include $(RIOTBASE)/Makefile.base diff --git a/drivers/cc110x/Makefile b/drivers/cc110x/Makefile index da43c6b942..48422e909a 100644 --- a/drivers/cc110x/Makefile +++ b/drivers/cc110x/Makefile @@ -1,3 +1 @@ -MODULE =cc110x - include $(RIOTBASE)/Makefile.base diff --git a/drivers/cc110x_ng/Makefile b/drivers/cc110x_ng/Makefile index 2dc3f914a1..4d7564aacc 100644 --- a/drivers/cc110x_ng/Makefile +++ b/drivers/cc110x_ng/Makefile @@ -1,5 +1,3 @@ -MODULE =cc110x_ng - DIRS = ifneq (,$(filter msb-430h,$(BOARD))) DIRS += spi diff --git a/drivers/cc2420/Makefile b/drivers/cc2420/Makefile index 39a17b2101..48422e909a 100644 --- a/drivers/cc2420/Makefile +++ b/drivers/cc2420/Makefile @@ -1,3 +1 @@ -MODULE =cc2420 - include $(RIOTBASE)/Makefile.base diff --git a/drivers/lm75a/Makefile b/drivers/lm75a/Makefile index b1095f7fc0..48422e909a 100644 --- a/drivers/lm75a/Makefile +++ b/drivers/lm75a/Makefile @@ -1,2 +1 @@ -MODULE =lm75a include $(RIOTBASE)/Makefile.base diff --git a/drivers/ltc4150/Makefile b/drivers/ltc4150/Makefile index 42881d6195..48422e909a 100644 --- a/drivers/ltc4150/Makefile +++ b/drivers/ltc4150/Makefile @@ -1,2 +1 @@ -MODULE =ltc4150 include $(RIOTBASE)/Makefile.base diff --git a/drivers/sht11/Makefile b/drivers/sht11/Makefile index 0ccc6b38b2..48422e909a 100644 --- a/drivers/sht11/Makefile +++ b/drivers/sht11/Makefile @@ -1,2 +1 @@ -MODULE =sht11 include $(RIOTBASE)/Makefile.base diff --git a/drivers/srf02/Makefile b/drivers/srf02/Makefile index 6e23e8fe1a..48422e909a 100644 --- a/drivers/srf02/Makefile +++ b/drivers/srf02/Makefile @@ -1,2 +1 @@ -MODULE =srf02 include $(RIOTBASE)/Makefile.base diff --git a/drivers/srf08/Makefile b/drivers/srf08/Makefile index ec63204246..48422e909a 100644 --- a/drivers/srf08/Makefile +++ b/drivers/srf08/Makefile @@ -1,2 +1 @@ -MODULE =srf08 include $(RIOTBASE)/Makefile.base diff --git a/sys/auto_init/Makefile b/sys/auto_init/Makefile index f5b62c8ad7..d0a6370718 100644 --- a/sys/auto_init/Makefile +++ b/sys/auto_init/Makefile @@ -1,5 +1,3 @@ -MODULE = auto_init - ifneq (,$(filter net_if,$(USEMODULE))) INCLUDES += -I$(RIOTBASE)/sys/net/include/ endif diff --git a/sys/bloom/Makefile b/sys/bloom/Makefile index 67d8988925..48422e909a 100644 --- a/sys/bloom/Makefile +++ b/sys/bloom/Makefile @@ -1,3 +1 @@ -MODULE = bloom - include $(RIOTBASE)/Makefile.base diff --git a/sys/config/Makefile b/sys/config/Makefile index 6e6ccce0dd..48422e909a 100644 --- a/sys/config/Makefile +++ b/sys/config/Makefile @@ -1,3 +1 @@ -MODULE =config - include $(RIOTBASE)/Makefile.base diff --git a/sys/crypto/Makefile b/sys/crypto/Makefile index de999331f7..48422e909a 100644 --- a/sys/crypto/Makefile +++ b/sys/crypto/Makefile @@ -1,3 +1 @@ -MODULE = crypto - include $(RIOTBASE)/Makefile.base diff --git a/sys/hashes/Makefile b/sys/hashes/Makefile index d105e96ecb..48422e909a 100644 --- a/sys/hashes/Makefile +++ b/sys/hashes/Makefile @@ -1,3 +1 @@ -MODULE = hashes - include $(RIOTBASE)/Makefile.base diff --git a/sys/lib/Makefile b/sys/lib/Makefile index e4a10a72c7..48422e909a 100644 --- a/sys/lib/Makefile +++ b/sys/lib/Makefile @@ -1,3 +1 @@ -MODULE =lib - include $(RIOTBASE)/Makefile.base diff --git a/sys/net/ccn_lite/Makefile b/sys/net/ccn_lite/Makefile index ca7dd4371a..48422e909a 100644 --- a/sys/net/ccn_lite/Makefile +++ b/sys/net/ccn_lite/Makefile @@ -1,3 +1 @@ -MODULE := ccn_lite - include $(RIOTBASE)/Makefile.base diff --git a/sys/net/crosslayer/net_help/Makefile b/sys/net/crosslayer/net_help/Makefile index c6e31807e8..48422e909a 100644 --- a/sys/net/crosslayer/net_help/Makefile +++ b/sys/net/crosslayer/net_help/Makefile @@ -1,3 +1 @@ -MODULE:=$(shell basename $(CURDIR)) - include $(RIOTBASE)/Makefile.base diff --git a/sys/net/link_layer/ieee802154/Makefile b/sys/net/link_layer/ieee802154/Makefile index c6e31807e8..48422e909a 100644 --- a/sys/net/link_layer/ieee802154/Makefile +++ b/sys/net/link_layer/ieee802154/Makefile @@ -1,3 +1 @@ -MODULE:=$(shell basename $(CURDIR)) - include $(RIOTBASE)/Makefile.base diff --git a/sys/net/link_layer/net_if/Makefile b/sys/net/link_layer/net_if/Makefile index 81bfe88143..ce724073cb 100644 --- a/sys/net/link_layer/net_if/Makefile +++ b/sys/net/link_layer/net_if/Makefile @@ -1,4 +1,3 @@ -MODULE:=$(shell basename $(CURDIR)) INCLUDES += -I$(RIOTBASE)/drivers/include \ -I$(RIOTBASE)/drivers/cc110x_ng/include \ -I$(RIOTBASE)/sys/net/include diff --git a/sys/net/network_layer/sixlowpan/Makefile b/sys/net/network_layer/sixlowpan/Makefile index e5ae64d4c3..48422e909a 100644 --- a/sys/net/network_layer/sixlowpan/Makefile +++ b/sys/net/network_layer/sixlowpan/Makefile @@ -1,2 +1 @@ -MODULE:=$(shell basename $(CURDIR)) include $(RIOTBASE)/Makefile.base diff --git a/sys/net/routing/Makefile b/sys/net/routing/Makefile index c6e31807e8..48422e909a 100644 --- a/sys/net/routing/Makefile +++ b/sys/net/routing/Makefile @@ -1,3 +1 @@ -MODULE:=$(shell basename $(CURDIR)) - include $(RIOTBASE)/Makefile.base diff --git a/sys/net/routing/rpl/Makefile b/sys/net/routing/rpl/Makefile index c6e31807e8..48422e909a 100644 --- a/sys/net/routing/rpl/Makefile +++ b/sys/net/routing/rpl/Makefile @@ -1,3 +1 @@ -MODULE:=$(shell basename $(CURDIR)) - include $(RIOTBASE)/Makefile.base diff --git a/sys/net/transport_layer/destiny/Makefile b/sys/net/transport_layer/destiny/Makefile index c6e31807e8..48422e909a 100644 --- a/sys/net/transport_layer/destiny/Makefile +++ b/sys/net/transport_layer/destiny/Makefile @@ -1,3 +1 @@ -MODULE:=$(shell basename $(CURDIR)) - include $(RIOTBASE)/Makefile.base diff --git a/sys/ping/Makefile b/sys/ping/Makefile index 35193836e3..48422e909a 100644 --- a/sys/ping/Makefile +++ b/sys/ping/Makefile @@ -1,3 +1 @@ -MODULE =ping - include $(RIOTBASE)/Makefile.base diff --git a/sys/posix/Makefile b/sys/posix/Makefile index 844718cae3..48422e909a 100644 --- a/sys/posix/Makefile +++ b/sys/posix/Makefile @@ -1,3 +1 @@ -MODULE = posix - include $(RIOTBASE)/Makefile.base diff --git a/sys/posix/pnet/Makefile b/sys/posix/pnet/Makefile index 44ad39401f..48422e909a 100644 --- a/sys/posix/pnet/Makefile +++ b/sys/posix/pnet/Makefile @@ -1,3 +1 @@ -MODULE =pnet - include $(RIOTBASE)/Makefile.base diff --git a/sys/posix/pthread/Makefile b/sys/posix/pthread/Makefile index f849d335bc..48422e909a 100644 --- a/sys/posix/pthread/Makefile +++ b/sys/posix/pthread/Makefile @@ -1,3 +1 @@ -MODULE = pthread - include $(RIOTBASE)/Makefile.base diff --git a/sys/ps/Makefile b/sys/ps/Makefile index ea15576f57..48422e909a 100644 --- a/sys/ps/Makefile +++ b/sys/ps/Makefile @@ -1,3 +1 @@ -MODULE =ps - include $(RIOTBASE)/Makefile.base diff --git a/sys/quad_math/Makefile b/sys/quad_math/Makefile index 0482a1e313..48422e909a 100644 --- a/sys/quad_math/Makefile +++ b/sys/quad_math/Makefile @@ -1,3 +1 @@ -MODULE = quad_math - include $(RIOTBASE)/Makefile.base diff --git a/sys/random/Makefile b/sys/random/Makefile index 8fb676cf6b..48422e909a 100644 --- a/sys/random/Makefile +++ b/sys/random/Makefile @@ -1,3 +1 @@ -MODULE = random - include $(RIOTBASE)/Makefile.base diff --git a/sys/shell/Makefile b/sys/shell/Makefile index 4e5b44fe4a..48422e909a 100644 --- a/sys/shell/Makefile +++ b/sys/shell/Makefile @@ -1,3 +1 @@ -MODULE = shell - include $(RIOTBASE)/Makefile.base diff --git a/sys/timex/Makefile b/sys/timex/Makefile index fa37c25bf9..48422e909a 100644 --- a/sys/timex/Makefile +++ b/sys/timex/Makefile @@ -1,3 +1 @@ -MODULE = timex - include $(RIOTBASE)/Makefile.base diff --git a/sys/transceiver/Makefile b/sys/transceiver/Makefile index 6b3ed1b85f..e2a870105c 100644 --- a/sys/transceiver/Makefile +++ b/sys/transceiver/Makefile @@ -1,5 +1,3 @@ -MODULE =transceiver - ifneq (,$(filter cc2420,$(USEMODULE))) INCLUDES += -I$(RIOTBASE)/sys/net/include endif diff --git a/sys/uart0/Makefile b/sys/uart0/Makefile index 64c07fc24f..48422e909a 100644 --- a/sys/uart0/Makefile +++ b/sys/uart0/Makefile @@ -1,3 +1 @@ -MODULE = uart0 - include $(RIOTBASE)/Makefile.base diff --git a/sys/vtimer/Makefile b/sys/vtimer/Makefile index cae67acc0d..48422e909a 100644 --- a/sys/vtimer/Makefile +++ b/sys/vtimer/Makefile @@ -1,3 +1 @@ -MODULE =vtimer - include $(RIOTBASE)/Makefile.base diff --git a/tests/unittests/tests-core/Makefile b/tests/unittests/tests-core/Makefile index 2bb651c200..48422e909a 100644 --- a/tests/unittests/tests-core/Makefile +++ b/tests/unittests/tests-core/Makefile @@ -1,3 +1 @@ -MODULE = tests-core - include $(RIOTBASE)/Makefile.base