Many modules have subdirectories. Often these subdirectories should only
be included under certain circumstances. Modules that use submodules
currently need to use this pattern:
DIRS = …
@for i in $(DIRS) ; do $(MAKE) -C $$i ; done ;
@for i in $(DIRS) ; do $(MAKE) -C $$i clean ; done ;
This PR moves the `all:` and `clean::` boilerplate into `Makefile.base`.
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
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
We do not need to descend into the modules to know what to do on
`make clean BOARD=blub`. We can just invoke `rm -rf bin/blub`.
This PR only keeps the descending into the USEPKGs, since they might
want to delete cached/downloaded/extracted data.
Creating all object files in one directory is bound to produce name
clashes. RIOT developers may take care to use unique file names, but
external packages surely don't.
With this change all the objects of a module (e.g. `shell`) will be
created in `bin/$(BOARD)/$(MODULE)`.
I compared the final linker command before and after the change. The
`.o` files (e.g. `startup.o`, `syscall.o` ...) are included in the same
order. Neglecting the changed path name where the `.o` files reside, the
linker command stays exactly the same.
A major problem could be third party boards, because the location of the
`startup.o` needs to the specified now in
export UNDEF += $(BINDIR)msp430_common/startup.o