1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

make: easifier usage of module subdirectories

Many modules have subdirectories. Often these subdirectories should only
be included under certain circumstances. Modules that use submodules
currently need to use this pattern:

```make
DIRS = …

all: $(BINDIR)$(MODULE).a
   @for i in $(DIRS) ; do $(MAKE) -C $$i ; done ;

include $(RIOTBASE)/Makefile.base

clean::
   @for i in $(DIRS) ; do $(MAKE) -C $$i clean ; done ;
```

This PR moves the `all:` and `clean::` boilerplate into `Makefile.base`.
This commit is contained in:
René Kijewski 2014-06-17 04:01:10 +02:00
parent 840c0f0a57
commit 467b41ad49
28 changed files with 7 additions and 110 deletions

View File

@ -4,6 +4,12 @@ endif
MODULE ?= $(shell basename $(CURDIR))
all: $(BINDIR)$(MODULE).a
@for i in $(DIRS); do $(MAKE) -C $$i || exit 1; done;
clean::
@for i in $(DIRS); do $(MAKE) -C $$i clean; done;
ASMSRC = $(wildcard *.s)
ASSMSRC = $(wildcard *.S)
ASMOBJ = $(ASMSRC:%.s=$(BINDIR)$(MODULE)/%.o)

View File

@ -5,12 +5,4 @@ MODULE = $(BOARD)_base
# add a list of board specific subdirectories that should also be build
DIRS =
.PHONY: all clean
all: $(BINDIR)$(MODULE).a
@for i in $(DIRS) ; do $(MAKE) -C $$i ; done ;
include $(RIOTBASE)/Makefile.base
clean::
@for i in $(DIRS) ; do $(MAKE) -C $$i clean ; done ;

View File

@ -2,7 +2,4 @@ MODULE =$(BOARD)_base
DIRS = drivers $(RIOTBOARD)/msba2-common
all: $(BINDIR)$(MODULE).a
@for i in $(DIRS) ; do "$(MAKE)" -C $$i || exit 1; done ;
include $(RIOTBASE)/Makefile.base

View File

@ -3,7 +3,4 @@ MODULE =$(BOARD)_base
INCLUDES += -I$(RIOTBOARD)/$(BOARD)/drivers/include
DIRS = drivers
all: $(BINDIR)$(MODULE).a
@for i in $(DIRS) ; do "$(MAKE)" -C $$i || exit 1; done ;
include $(RIOTBASE)/Makefile.base

View File

@ -2,7 +2,4 @@ MODULE =$(BOARD)_base
DIRS = drivers
all: $(BINDIR)$(MODULE).a
@for i in $(DIRS) ; do "$(MAKE)" -C $$i || exit 1; done ;
include $(RIOTBASE)/Makefile.base

View File

@ -2,7 +2,4 @@ MODULE =$(BOARD)_base
DIRS = $(RIOTBOARD)/msb-430-common
all: $(BINDIR)$(MODULE).a
@for i in $(DIRS) ; do "$(MAKE)" -C $$i || exit 1; done ;
include $(RIOTBASE)/Makefile.base

View File

@ -2,7 +2,4 @@ MODULE =$(BOARD)_base
DIRS = $(RIOTBOARD)/msb-430-common
all: $(BINDIR)$(MODULE).a
@for i in $(DIRS) ; do "$(MAKE)" -C $$i || exit 1; done ;
include $(RIOTBASE)/Makefile.base

View File

@ -2,7 +2,4 @@ MODULE =$(BOARD)_base
DIRS = drivers
all: $(BINDIR)$(MODULE).a
@for i in $(DIRS) ; do "$(MAKE)" -C $$i || exit 1; done ;
include $(RIOTBASE)/Makefile.base

View File

@ -3,7 +3,4 @@ INCLUDES += -I$(RIOTBASE)/drivers/cc110x
DIRS = $(RIOTBOARD)/msba2-common
all: $(BINDIR)$(MODULE).a
@for i in $(DIRS) ; do "$(MAKE)" -C $$i || exit 1; done ;
include $(RIOTBASE)/Makefile.base

View File

@ -2,9 +2,6 @@ MODULE =$(BOARD)_base
DIRS = drivers
all: $(BINDIR)$(MODULE).a
@for i in $(DIRS) ; do "$(MAKE)" -C $$i || exit 1; done ;
include $(RIOTBASE)/Makefile.base
$(BINDIR)$(MODULE)/%.o: %.c

View File

@ -1,8 +1,5 @@
MODULE =$(BOARD)_base
all: $(BINDIR)$(MODULE).a
@for i in $(DIRS) ; do "$(MAKE)" -C $$i || exit 1; done ;
include $(RIOTBASE)/Makefile.base
$(BINDIR)$(MODULE)/%.o: %.c

View File

@ -3,7 +3,4 @@ INCLUDES += -I$(RIOTBASE)/drivers/cc110x
DIRS = $(RIOTBOARD)/msba2-common
all: $(BINDIR)$(MODULE).a
@for i in $(DIRS) ; do "$(MAKE)" -C $$i || exit 1; done ;
include $(RIOTBASE)/Makefile.base

View File

@ -2,10 +2,4 @@ MODULE = qemu-i386_base
DIRS = $(RIOTBOARD)/x86-multiboot-common
all: $(BINDIR)$(MODULE).a
@for i in $(DIRS) ; do "$(MAKE)" -C $$i ; done ;
include $(RIOTBASE)/Makefile.base
clean::
@for i in $(DIRS) ; do "$(MAKE)" -C $$i clean ; done ;

View File

@ -2,7 +2,4 @@ MODULE =$(BOARD)_base
DIRS = drivers
all: $(BINDIR)$(MODULE).a
@for i in $(DIRS) ; do "$(MAKE)" -C $$i || exit 1; done ;
include $(RIOTBASE)/Makefile.base

View File

@ -1,16 +1,7 @@
# tell the Makefile.base which module to build
MODULE = $(BOARD)_base
# add a list of board specific subdirectories that should also be build
DIRS =
.PHONY: all clean
all: $(BINDIR)$(MODULE).a
@for i in $(DIRS) ; do $(MAKE) -C $$i ; done ;
include $(RIOTBASE)/Makefile.base
clean::
@for i in $(DIRS) ; do $(MAKE) -C $$i clean ; done ;

View File

@ -2,7 +2,4 @@ MODULE =$(BOARD)_base
DIRS = drivers
all: $(BINDIR)$(MODULE).a
@for i in $(DIRS) ; do "$(MAKE)" -C $$i || exit 1; done ;
include $(RIOTBASE)/Makefile.base

View File

@ -2,7 +2,4 @@ MODULE =$(BOARD)_base
DIRS = $(RIOTBOARD)/wsn430-common
all: $(BINDIR)$(MODULE).a
@for i in $(DIRS) ; do "$(MAKE)" -C $$i || exit 1; done ;
include $(RIOTBASE)/Makefile.base

View File

@ -5,7 +5,4 @@ DIRS = $(RIOTBOARD)/wsn430-common
INCLUDES += -I$(RIOTBASE)/drivers/cc2420/include \
-I$(RIOTBASE)/sys/net/include
all: $(BINDIR)$(MODULE).a
@for i in $(DIRS) ; do "$(MAKE)" -C $$i || exit 1; done ;
include $(RIOTBASE)/Makefile.base

View File

@ -2,7 +2,4 @@ MODULE = cpu
DIRS = $(RIOTCPU)/msp430-common
all: $(BINDIR)$(MODULE).a
@for i in $(DIRS) ; do "$(MAKE)" -C $$i || exit 1; done ;
include $(RIOTBASE)/Makefile.base

View File

@ -7,8 +7,6 @@ CC_SYMBOLS = -DTARGET_LPC1769 -DTOOLCHAIN_GCC_ARM -DNDEBUG -D__CORTEX_M3
LD_FLAGS = -mcpu=cortex-m3 -mthumb -Wl,--gc-sections,-Map=$(APPLICATION).map,--cref --specs=nano.specs
LD_SYS_LIBS = -lc -lgcc -lnosys
all: $(BINDIR)$(MODULE).a
include $(RIOTBASE)/Makefile.base
# This is needed for NXP Cortex M devices

View File

@ -16,7 +16,4 @@ ifneq (,$(filter i2c,$(USEMODULE)))
DIRS += i2c
endif
all: $(BINDIR)$(MODULE).a
@for i in $(DIRS) ; do "$(MAKE)" -C $$i || exit 1; done ;
include $(RIOTBASE)/Makefile.base

View File

@ -11,7 +11,4 @@ ifneq (,$(filter mc1322x,$(USEMODULE)))
DIRS += maca
endif
all: $(BINDIR)$(MODULE).a
@for i in $(DIRS) ; do "$(MAKE)" -C $$i || exit 1; done ;
include $(RIOTBASE)/Makefile.base

View File

@ -4,7 +4,4 @@ include $(RIOTCPU)/$(CPU)/Makefile.include
DIRS = $(RIOTCPU)/msp430-common/
all: $(BINDIR)$(MODULE).a
@for i in $(DIRS) ; do "$(MAKE)" -C $$i || exit 1; done ;
include $(RIOTBASE)/Makefile.base

View File

@ -1,6 +1,5 @@
MODULE = cpu
DIRS =
ifneq (,$(filter rtc,$(USEMODULE)))
DIRS += rtc
endif
@ -8,9 +7,6 @@ ifneq (,$(filter nativenet,$(USEMODULE)))
DIRS += net
endif
all: $(BINDIR)$(MODULE).a
@for i in $(DIRS) ; do "$(MAKE)" -C $$i || exit 1; done ;
include $(RIOTBASE)/Makefile.base
$(BINDIR)$(MODULE)/%.o: %.c

View File

@ -1,21 +1,7 @@
# define the module that is build
MODULE = cpu
# add a list of subdirectories, that should also be build
DIRS = periph
.PHONY: all $(CORTEX_COMMON)
# when building the CPU module make sure, the STM std peripheral lib will also be build
all: $(CORTEX_COMMON) $(BINDIR)$(MODULE).a
@for i in $(DIRS) ; do $(MAKE) -C $$i ; done ;
$(CORTEX_COMMON):
@$(MAKE) -C $(CORTEX_COMMON)
DIRS = periph $(CORTEX_COMMON)
include $(RIOTBASE)/Makefile.base
clean::
@for i in $(DIRS) ; do $(MAKE) -C $$i clean ; done ;
@$(MAKE) -C $(CORTEX_COMMON) clean

View File

@ -1,4 +1,3 @@
DIRS=
ifneq (,$(filter powermon,$(USEMODULE)))
DIRS += powermon
endif
@ -33,7 +32,4 @@ ifneq (,$(filter lm75a,$(USEMODULE)))
DIRS += lm75a
endif
all:
@for i in $(DIRS) ; do "$(MAKE)" -C $$i || exit 1; done ;
include $(RIOTBASE)/Makefile.base

View File

@ -1,4 +1,3 @@
DIRS =
ifneq (,$(filter msb-430h,$(BOARD)))
DIRS += spi
endif
@ -9,7 +8,4 @@ ifneq (,$(filter wsn430-v1_3b,$(BOARD)))
DIRS += spi
endif
all: $(BINDIR)$(MODULE).a
@for i in $(DIRS) ; do "$(MAKE)" -C $$i || exit 1; done ;
include $(RIOTBASE)/Makefile.base

View File

@ -1,4 +1,3 @@
MODULE = sys
ifneq (,$(filter auto_init,$(USEMODULE)))
DIRS += auto_init
endif
@ -93,7 +92,4 @@ ifneq (,$(filter oneway_malloc,$(USEMODULE)))
DIRS += oneway-malloc
endif
all: $(BINDIR)$(MODULE).a
@for i in $(DIRS) ; do "$(MAKE)" -C $$i || exit 1; done ;
include $(RIOTBASE)/Makefile.base