Browse Source

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`.
dev/timer
René Kijewski 9 years ago
parent
commit
467b41ad49
  1. 6
      Makefile.base
  2. 8
      boards/arduino-due/Makefile
  3. 3
      boards/avsextrem/Makefile
  4. 3
      boards/chronos/Makefile
  5. 3
      boards/msb-430-common/Makefile
  6. 3
      boards/msb-430/Makefile
  7. 3
      boards/msb-430h/Makefile
  8. 3
      boards/msba2-common/Makefile
  9. 3
      boards/msba2/Makefile
  10. 3
      boards/native/Makefile
  11. 3
      boards/native/drivers/Makefile
  12. 3
      boards/pttu/Makefile
  13. 6
      boards/qemu-i386/Makefile
  14. 3
      boards/redbee-econotag/Makefile
  15. 9
      boards/udoo/Makefile
  16. 3
      boards/wsn430-common/Makefile
  17. 3
      boards/wsn430-v1_3b/Makefile
  18. 3
      boards/wsn430-v1_4/Makefile
  19. 3
      cpu/cc430/Makefile
  20. 2
      cpu/lpc1768/Makefile
  21. 3
      cpu/lpc2387/Makefile
  22. 3
      cpu/mc1322x/Makefile
  23. 3
      cpu/msp430x16x/Makefile
  24. 4
      cpu/native/Makefile
  25. 16
      cpu/sam3x8e/Makefile
  26. 4
      drivers/Makefile
  27. 4
      drivers/cc110x_ng/Makefile
  28. 4
      sys/Makefile

6
Makefile.base

@ -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)

8
boards/arduino-due/Makefile

@ -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 ;

3
boards/avsextrem/Makefile

@ -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

3
boards/chronos/Makefile

@ -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

3
boards/msb-430-common/Makefile

@ -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

3
boards/msb-430/Makefile

@ -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

3
boards/msb-430h/Makefile

@ -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

3
boards/msba2-common/Makefile

@ -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

3
boards/msba2/Makefile

@ -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

3
boards/native/Makefile

@ -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

3
boards/native/drivers/Makefile

@ -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

3
boards/pttu/Makefile

@ -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

6
boards/qemu-i386/Makefile

@ -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 ;

3
boards/redbee-econotag/Makefile

@ -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

9
boards/udoo/Makefile

@ -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 ;

3
boards/wsn430-common/Makefile

@ -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

3
boards/wsn430-v1_3b/Makefile

@ -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

3
boards/wsn430-v1_4/Makefile

@ -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

3
cpu/cc430/Makefile

@ -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

2
cpu/lpc1768/Makefile

@ -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

3
cpu/lpc2387/Makefile

@ -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

3
cpu/mc1322x/Makefile

@ -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

3
cpu/msp430x16x/Makefile

@ -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

4
cpu/native/Makefile

@ -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

16
cpu/sam3x8e/Makefile

@ -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

4
drivers/Makefile

@ -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

4
drivers/cc110x_ng/Makefile

@ -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

4
sys/Makefile

@ -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

Loading…
Cancel
Save