From d19fc447edcaf372d5bc236f39a5df3e218e0ae9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Kijewski?= Date: Wed, 18 Jun 2014 11:21:05 +0200 Subject: [PATCH] make: make DIRS usable for applications --- Makefile.base | 2 ++ Makefile.include | 2 +- Makefile.modules | 2 +- tests/unittests/Makefile | 17 ++++------------- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/Makefile.base b/Makefile.base index c2d547327f..143c3f1e6b 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 +unexport DIRS + MODULE ?= $(shell basename $(CURDIR)) .PHONY: all ${DIRS:%=ALL--%} ${DIRS:%=CLEAN--%} diff --git a/Makefile.include b/Makefile.include index 284d8bf525..4a60d6f502 100644 --- a/Makefile.include +++ b/Makefile.include @@ -87,7 +87,7 @@ export HEXFILE ?= $(ELFFILE:.elf=.hex) ## make script for your application. Build RIOT-base here! all: ..build-message $(USEPKG:%=${BINDIR}%.a) $(APPDEPS) - "$(MAKE)" -C $(CURDIR) -f $(RIOTBASE)/Makefile.application + $(AD)DIRS="$(DIRS)" "$(MAKE)" -C $(CURDIR) -f $(RIOTBASE)/Makefile.application ifeq (,$(RIOTNOLINK)) ifeq ($(BUILDOSXNATIVE),1) $(AD)$(LINK) $(UNDEF) -o $(ELFFILE) $(BASELIBS) $(LINKFLAGS) -Wl,-no_pie diff --git a/Makefile.modules b/Makefile.modules index 27e1b0a5f2..4a3ed5e3dc 100644 --- a/Makefile.modules +++ b/Makefile.modules @@ -8,7 +8,7 @@ ED = $(USEMODULE:%=-DMODULE_%) ED += $(USEPKG:%=-DMODULE_%) EXTDEFINES = $(shell echo $(sort $(ED))|tr 'a-z' 'A-Z') REALMODULES = $(filter-out $(PSEUDOMODULES), $(sort $(USEMODULE))) -export BASELIBS = $(REALMODULES:%=$(BINDIR)%.a) +export BASELIBS += $(REALMODULES:%=$(BINDIR)%.a) CFLAGS += $(EXTDEFINES) diff --git a/tests/unittests/Makefile b/tests/unittests/Makefile index 552748bac2..709d0d4422 100644 --- a/tests/unittests/Makefile +++ b/tests/unittests/Makefile @@ -25,27 +25,18 @@ endif # Pull in `Makefile.include`s from the test suites: -include $(UNIT_TESTS:%=$(RIOTBASE)/tests/unittests/%/Makefile.include) +DIRS += $(UNIT_TESTS) +BASELIBS += $(UNIT_TESTS:%=$(BINDIR)%.a) + include $(RIOTBASE)/Makefile.include -UNITTEST_LIBS := $(UNIT_TESTS:%=$(BINDIR)%.a) - -all: $(UNITTEST_LIBS) $(UNIT_TESTS): all -.FORCE: - -$(UNITTEST_LIBS): $(BINDIR)%.a: .FORCE - "$(MAKE)" -C $(CURDIR)/$* - -charEMPTY := -charSPACE := $(charEMPTY) $(charEMPTY) charCOMMA := , ifeq (, $(UNIT_TESTS)) CFLAGS += -DNO_TEST_SUITES $(warning There was no test suite specified!) else - CFLAGS += -DTEST_SUITES='$(subst $(charSPACE),$(charCOMMA),$(UNIT_TESTS:tests-%=%))' + CFLAGS += -DTEST_SUITES='$(subst $() $(),$(charCOMMA),$(UNIT_TESTS:tests-%=%))' endif - -BASELIBS += $(UNITTEST_LIBS)