From e740fbc800c59e6d06321389c1c9be1ba58ca830 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Kijewski?= Date: Fri, 28 Mar 2014 22:55:56 +0100 Subject: [PATCH 1/4] make: Add DEFAULT_MODULE and DISABLE_MODULE Closes #926 --- Makefile.defaultmodules | 3 +++ Makefile.include | 5 +++++ Makefile.modules | 4 +++- examples/ccn-lite-client/Makefile | 1 - examples/ccn-lite-relay/Makefile | 3 --- examples/default/Makefile | 1 - examples/rpl_udp/Makefile | 1 - tests/test_irq/Makefile | 1 - tests/test_nativenet/Makefile | 1 - tests/test_net_if/Makefile | 1 - tests/test_pnet/Makefile | 1 - tests/test_vtimer_msg/Makefile | 1 - 12 files changed, 11 insertions(+), 12 deletions(-) create mode 100644 Makefile.defaultmodules diff --git a/Makefile.defaultmodules b/Makefile.defaultmodules new file mode 100644 index 0000000000..fa37f3e551 --- /dev/null +++ b/Makefile.defaultmodules @@ -0,0 +1,3 @@ +DEFAULT_MODULE += cpu core sys + +DEFAULT_MODULE += auto_init diff --git a/Makefile.include b/Makefile.include index 330768004e..8977118f46 100644 --- a/Makefile.include +++ b/Makefile.include @@ -48,6 +48,11 @@ include $(RIOTBOARD)/$(BOARD)/Makefile.include include $(RIOTCPU)/$(CPU)/Makefile.include include $(RIOTBASE)/Makefile.dep +# Test if there where dependencies against a module in DISABLE_MODULE. +ifneq (, $(filter $(DISABLE_MODULE), $(USEMODULE))) +$(error "Required modules were disabled using DISABLE_MODULE: $(sort $(filter $(DISABLE_MODULE), $(USEMODULE)))") +endif + # Test if the input language was specified externally. # Otherwise test if the compiler unterstands the "-std=gnu99" flag, and use it if so. # Otherwise test if the compiler unterstands the "-std=c99" flag, and use it if so. diff --git a/Makefile.modules b/Makefile.modules index 0c378806e7..6013c3b359 100644 --- a/Makefile.modules +++ b/Makefile.modules @@ -1,8 +1,10 @@ UNDEF += $(BINDIR)startup.o include $(RIOTBASE)/Makefile.pseudomodules +include $(RIOTBASE)/Makefile.defaultmodules + +USEMODULE += $(filter-out $(DISABLE_MODULE), $(DEFAULT_MODULE)) -USEMODULE += cpu core sys INCLUDES += -I$(RIOTBASE)/core/include -I$(RIOTBASE)/drivers/include -I$(RIOTBASE)/sys/include ED = $(USEMODULE:%=-DMODULE_%) ED += $(USEPKG:%=-DMODULE_%) diff --git a/examples/ccn-lite-client/Makefile b/examples/ccn-lite-client/Makefile index 57420b8359..9118a91a20 100644 --- a/examples/ccn-lite-client/Makefile +++ b/examples/ccn-lite-client/Makefile @@ -34,7 +34,6 @@ USEMODULE += shell USEMODULE += shell_commands USEMODULE += posix USEMODULE += ps -USEMODULE += auto_init USEMODULE += random USEMODULE += transceiver ifeq ($(BOARD),msba2) diff --git a/examples/ccn-lite-relay/Makefile b/examples/ccn-lite-relay/Makefile index b5ad2a0207..80aa25d0d6 100644 --- a/examples/ccn-lite-relay/Makefile +++ b/examples/ccn-lite-relay/Makefile @@ -31,9 +31,6 @@ export QUIET ?= 1 USEMODULE += config USEMODULE += posix -USEMODULE += auto_init - -USEMODULE += auto_init USEMODULE += transceiver ifeq ($(BOARD),msba2) diff --git a/examples/default/Makefile b/examples/default/Makefile index 04f948076c..b1b135e65c 100644 --- a/examples/default/Makefile +++ b/examples/default/Makefile @@ -34,7 +34,6 @@ USEMODULE += shell USEMODULE += shell_commands USEMODULE += ps USEMODULE += vtimer -USEMODULE += auto_init USEMODULE += defaulttransceiver ifneq (,$(filter msb-430,$(BOARD))) diff --git a/examples/rpl_udp/Makefile b/examples/rpl_udp/Makefile index 0a0d91c5e0..6ca74b2f90 100644 --- a/examples/rpl_udp/Makefile +++ b/examples/rpl_udp/Makefile @@ -32,7 +32,6 @@ CFLAGS += "-Wno-cpp" # Modules to include: -USEMODULE += auto_init USEMODULE += shell USEMODULE += shell_commands USEMODULE += posix diff --git a/tests/test_irq/Makefile b/tests/test_irq/Makefile index 37536811bd..bb56d21053 100644 --- a/tests/test_irq/Makefile +++ b/tests/test_irq/Makefile @@ -5,7 +5,6 @@ ifeq (,$(filter native,$(BOARD))) include $(RIOTBASE)/Makefile.unsupported else -USEMODULE += auto_init USEMODULE += posix include $(RIOTBASE)/Makefile.include diff --git a/tests/test_nativenet/Makefile b/tests/test_nativenet/Makefile index 7813fdda6c..730a3608f8 100644 --- a/tests/test_nativenet/Makefile +++ b/tests/test_nativenet/Makefile @@ -5,7 +5,6 @@ ifeq (,$(filter native,$(BOARD))) include $(RIOTBASE)/Makefile.unsupported else -USEMODULE += auto_init USEMODULE += nativenet USEMODULE += transceiver diff --git a/tests/test_net_if/Makefile b/tests/test_net_if/Makefile index 073f4b76ab..4e41b8ac75 100644 --- a/tests/test_net_if/Makefile +++ b/tests/test_net_if/Makefile @@ -8,7 +8,6 @@ ifeq ($(BOARD),stm32f4discovery) include Makefile.$(BOARD) endif -USEMODULE += auto_init USEMODULE += net_if USEMODULE += defaulttransceiver diff --git a/tests/test_pnet/Makefile b/tests/test_pnet/Makefile index b1c34b788e..8ca3400f81 100644 --- a/tests/test_pnet/Makefile +++ b/tests/test_pnet/Makefile @@ -1,7 +1,6 @@ export PROJECT = test_pnet include ../Makefile.tests_common -USEMODULE += auto_init USEMODULE += posix USEMODULE += pnet USEMODULE += vtimer diff --git a/tests/test_vtimer_msg/Makefile b/tests/test_vtimer_msg/Makefile index fa9f98a683..ba57fc7b9c 100644 --- a/tests/test_vtimer_msg/Makefile +++ b/tests/test_vtimer_msg/Makefile @@ -1,7 +1,6 @@ export PROJECT = test_vtimer_msg include ../Makefile.tests_common -USEMODULE += auto_init USEMODULE += vtimer include $(RIOTBASE)/Makefile.include From d22a4a3f44f8b86f4718b46a0400fe1dd45b97ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Kijewski?= Date: Tue, 1 Apr 2014 23:49:22 +0200 Subject: [PATCH 2/4] Add DISABLE_MODULE test --- tests/test_disable_module/Makefile | 6 ++++ tests/test_disable_module/main.c | 45 ++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 tests/test_disable_module/Makefile create mode 100644 tests/test_disable_module/main.c diff --git a/tests/test_disable_module/Makefile b/tests/test_disable_module/Makefile new file mode 100644 index 0000000000..8ec07da854 --- /dev/null +++ b/tests/test_disable_module/Makefile @@ -0,0 +1,6 @@ +export PROJECT = test_disable_module +include ../Makefile.tests_common + +DISABLE_MODULE += auto_init + +include $(RIOTBASE)/Makefile.include diff --git a/tests/test_disable_module/main.c b/tests/test_disable_module/main.c new file mode 100644 index 0000000000..aa9de6cc71 --- /dev/null +++ b/tests/test_disable_module/main.c @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2014 René Kijewski + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @ingroup tests + * @{ + * + * @file + * @brief Test whether DISABLE_MODULE works. + * + * @author René Kijewski + * + * @} + */ + +#include + +int main(void) +{ + puts("Start."); + +# ifdef MODULE_AUTO_INIT + puts("-ERROR: MODULE_AUTO_INIT present!"); +# else + puts("+OK: MODULE_AUTO_INIT absent."); +# endif + + puts("Done."); + return 0; +} From 34aec1928abd5d41594d708244644365f57f0a88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Kijewski?= Date: Wed, 2 Apr 2014 14:41:17 +0200 Subject: [PATCH 3/4] Add DISABLE_MODULE += auto_init to tests --- tests/test_bloom/Makefile | 2 ++ tests/test_bloom_bytes/Makefile | 2 ++ tests/test_float/Makefile | 2 ++ tests/test_hwtimer/Makefile | 2 ++ tests/test_hwtimer_spin/Makefile | 2 ++ tests/test_mutex_unlock_and_sleep/Makefile | 2 ++ tests/test_posix_semaphore/Makefile | 1 + tests/test_posix_sleep/Makefile | 2 ++ tests/test_pthread/Makefile | 2 ++ tests/test_pthread_cooperation/Makefile | 2 ++ tests/test_queue_fairness/Makefile | 2 ++ tests/test_sha256/Makefile | 2 ++ tests/test_shell/Makefile | 2 ++ tests/test_thread_basic/Makefile | 2 ++ tests/test_thread_cooperation/Makefile | 2 ++ tests/test_thread_exit/Makefile | 2 ++ tests/test_thread_msg/Makefile | 2 ++ tests/test_thread_msg_block_w_queue/Makefile | 2 ++ tests/test_thread_msg_block_wo_queue/Makefile | 2 ++ tests/test_thread_msg_seq/Makefile | 2 ++ 20 files changed, 39 insertions(+) diff --git a/tests/test_bloom/Makefile b/tests/test_bloom/Makefile index 5130dfb6c5..e78b2fef9a 100644 --- a/tests/test_bloom/Makefile +++ b/tests/test_bloom/Makefile @@ -12,6 +12,8 @@ USEMODULE += bloom export PROJDEPS = sets.h +DISABLE_MODULE += auto_init + include $(RIOTBASE)/Makefile.include sets.h: generate_sets.py words.txt.gz diff --git a/tests/test_bloom_bytes/Makefile b/tests/test_bloom_bytes/Makefile index 4b26fb6a2e..525b6e88cc 100644 --- a/tests/test_bloom_bytes/Makefile +++ b/tests/test_bloom_bytes/Makefile @@ -9,5 +9,7 @@ USEMODULE += hashes USEMODULE += bloom USEMODULE += random +DISABLE_MODULE += auto_init + include $(RIOTBASE)/Makefile.include endif diff --git a/tests/test_float/Makefile b/tests/test_float/Makefile index 69d4ae71f4..8f4b911c20 100644 --- a/tests/test_float/Makefile +++ b/tests/test_float/Makefile @@ -1,4 +1,6 @@ export PROJECT = test_float include ../Makefile.tests_common +DISABLE_MODULE += auto_init + include $(RIOTBASE)/Makefile.include diff --git a/tests/test_hwtimer/Makefile b/tests/test_hwtimer/Makefile index 87bfc5a801..e5646a2ebb 100644 --- a/tests/test_hwtimer/Makefile +++ b/tests/test_hwtimer/Makefile @@ -1,4 +1,6 @@ export PROJECT = test_hwtimer include ../Makefile.tests_common +DISABLE_MODULE += auto_init + include $(RIOTBASE)/Makefile.include diff --git a/tests/test_hwtimer_spin/Makefile b/tests/test_hwtimer_spin/Makefile index 1dc49ec94a..fc10ae4c26 100644 --- a/tests/test_hwtimer_spin/Makefile +++ b/tests/test_hwtimer_spin/Makefile @@ -1,4 +1,6 @@ export PROJECT = test_hwtimer_spin include ../Makefile.tests_common +DISABLE_MODULE += auto_init + include $(RIOTBASE)/Makefile.include diff --git a/tests/test_mutex_unlock_and_sleep/Makefile b/tests/test_mutex_unlock_and_sleep/Makefile index 2a99c8dfc8..d6293d4c42 100644 --- a/tests/test_mutex_unlock_and_sleep/Makefile +++ b/tests/test_mutex_unlock_and_sleep/Makefile @@ -1,4 +1,6 @@ export PROJECT = test_mutex_unlock_and_sleep include ../Makefile.tests_common +DISABLE_MODULE += auto_init + include $(RIOTBASE)/Makefile.include diff --git a/tests/test_posix_semaphore/Makefile b/tests/test_posix_semaphore/Makefile index cd255938f6..69411f56ac 100644 --- a/tests/test_posix_semaphore/Makefile +++ b/tests/test_posix_semaphore/Makefile @@ -4,5 +4,6 @@ include ../Makefile.tests_common USEMODULE += posix export INCLUDES += -I$(RIOTBASE)/sys/posix/include +DISABLE_MODULE += auto_init include $(RIOTBASE)/Makefile.include diff --git a/tests/test_posix_sleep/Makefile b/tests/test_posix_sleep/Makefile index ed0f370944..4bfdb1dec9 100644 --- a/tests/test_posix_sleep/Makefile +++ b/tests/test_posix_sleep/Makefile @@ -3,4 +3,6 @@ include ../Makefile.tests_common USEMODULE += posix +DISABLE_MODULE += auto_init + include $(RIOTBASE)/Makefile.include diff --git a/tests/test_pthread/Makefile b/tests/test_pthread/Makefile index 2deaa76c45..77cb428b6c 100644 --- a/tests/test_pthread/Makefile +++ b/tests/test_pthread/Makefile @@ -4,4 +4,6 @@ include ../Makefile.tests_common USEMODULE += posix USEMODULE += pthread +DISABLE_MODULE += auto_init + include $(RIOTBASE)/Makefile.include diff --git a/tests/test_pthread_cooperation/Makefile b/tests/test_pthread_cooperation/Makefile index 3430409269..a01e5b4ddb 100644 --- a/tests/test_pthread_cooperation/Makefile +++ b/tests/test_pthread_cooperation/Makefile @@ -4,4 +4,6 @@ include ../Makefile.tests_common USEMODULE += posix USEMODULE += pthread +DISABLE_MODULE += auto_init + include $(RIOTBASE)/Makefile.include diff --git a/tests/test_queue_fairness/Makefile b/tests/test_queue_fairness/Makefile index 609832133e..c5cff262ac 100644 --- a/tests/test_queue_fairness/Makefile +++ b/tests/test_queue_fairness/Makefile @@ -3,4 +3,6 @@ include ../Makefile.tests_common USEMODULE += vtimer +DISABLE_MODULE += auto_init + include $(RIOTBASE)/Makefile.include diff --git a/tests/test_sha256/Makefile b/tests/test_sha256/Makefile index d4bf0e2363..2a8d1101fe 100644 --- a/tests/test_sha256/Makefile +++ b/tests/test_sha256/Makefile @@ -3,4 +3,6 @@ include ../Makefile.tests_common USEMODULE += crypto_sha256 +DISABLE_MODULE += auto_init + include $(RIOTBASE)/Makefile.include diff --git a/tests/test_shell/Makefile b/tests/test_shell/Makefile index eb01cdf9d5..dd7de7b434 100644 --- a/tests/test_shell/Makefile +++ b/tests/test_shell/Makefile @@ -6,4 +6,6 @@ USEMODULE += shell_commands USEMODULE += ps USEMODULE += posix +DISABLE_MODULE += auto_init + include $(RIOTBASE)/Makefile.include diff --git a/tests/test_thread_basic/Makefile b/tests/test_thread_basic/Makefile index 108f8b1aa3..8b62fa2109 100644 --- a/tests/test_thread_basic/Makefile +++ b/tests/test_thread_basic/Makefile @@ -1,4 +1,6 @@ export PROJECT = test_thread_basic include ../Makefile.tests_common +DISABLE_MODULE += auto_init + include $(RIOTBASE)/Makefile.include diff --git a/tests/test_thread_cooperation/Makefile b/tests/test_thread_cooperation/Makefile index 5319a06bf1..e23527f4af 100644 --- a/tests/test_thread_cooperation/Makefile +++ b/tests/test_thread_cooperation/Makefile @@ -1,5 +1,7 @@ export PROJECT = test_thread_cooperation include ../Makefile.tests_common +DISABLE_MODULE += auto_init + include $(RIOTBASE)/Makefile.include diff --git a/tests/test_thread_exit/Makefile b/tests/test_thread_exit/Makefile index 504d5a9cc4..5ab6034643 100644 --- a/tests/test_thread_exit/Makefile +++ b/tests/test_thread_exit/Makefile @@ -1,4 +1,6 @@ export PROJECT = test_thread_exit include ../Makefile.tests_common +DISABLE_MODULE += auto_init + include $(RIOTBASE)/Makefile.include diff --git a/tests/test_thread_msg/Makefile b/tests/test_thread_msg/Makefile index 5f60dfbfd8..1ab8f45400 100644 --- a/tests/test_thread_msg/Makefile +++ b/tests/test_thread_msg/Makefile @@ -1,4 +1,6 @@ export PROJECT = test_thread_msg include ../Makefile.tests_common +DISABLE_MODULE += auto_init + include $(RIOTBASE)/Makefile.include diff --git a/tests/test_thread_msg_block_w_queue/Makefile b/tests/test_thread_msg_block_w_queue/Makefile index e74bbc4b64..dfc976dc48 100644 --- a/tests/test_thread_msg_block_w_queue/Makefile +++ b/tests/test_thread_msg_block_w_queue/Makefile @@ -1,4 +1,6 @@ export PROJECT = test_thread_msg_block_w_queue include ../Makefile.tests_common +DISABLE_MODULE += auto_init + include $(RIOTBASE)/Makefile.include diff --git a/tests/test_thread_msg_block_wo_queue/Makefile b/tests/test_thread_msg_block_wo_queue/Makefile index 8f6a7e4423..6cf5cd8bff 100644 --- a/tests/test_thread_msg_block_wo_queue/Makefile +++ b/tests/test_thread_msg_block_wo_queue/Makefile @@ -1,4 +1,6 @@ export PROJECT = test_thread_msg_block_wo_queue include ../Makefile.tests_common +DISABLE_MODULE += auto_init + include $(RIOTBASE)/Makefile.include diff --git a/tests/test_thread_msg_seq/Makefile b/tests/test_thread_msg_seq/Makefile index 4f50f0a8cb..f4f95bcd33 100644 --- a/tests/test_thread_msg_seq/Makefile +++ b/tests/test_thread_msg_seq/Makefile @@ -1,4 +1,6 @@ export PROJECT = test_thread_msg_seq include ../Makefile.tests_common +DISABLE_MODULE += auto_init + include $(RIOTBASE)/Makefile.include From 2e5a2cea0abd0f7505daa70c53698c5d36e95551 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Kijewski?= Date: Wed, 2 Apr 2014 14:42:11 +0200 Subject: [PATCH 4/4] Fixup for #798 --- tests/test_posix_semaphore/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/test_posix_semaphore/Makefile b/tests/test_posix_semaphore/Makefile index 69411f56ac..8bd82b2903 100644 --- a/tests/test_posix_semaphore/Makefile +++ b/tests/test_posix_semaphore/Makefile @@ -1,9 +1,8 @@ export PROJECT = test_posix_semaphore include ../Makefile.tests_common -USEMODULE += posix +USEMODULE += posix -export INCLUDES += -I$(RIOTBASE)/sys/posix/include DISABLE_MODULE += auto_init include $(RIOTBASE)/Makefile.include