Currently you need to add every new sys and driver module into the
respective Makefile. This requires rebasing if another module was merged
in the meantime.
This PR allows you to omit the entry to {sys,drivers}/Makefile, if the
subfolder has the same name as the module name, which should be sensible
in most cases.
This fixes an error which was introduced by commit
346313bf07
The timestamp of directories is updated when a file inside a directory
is changed.
Therefore, make decides a target needs to be rebuilt, whenever that
target depends on its parent directory, because the directory is
always newer than the file inside.
http://www.gnu.org/savannah-checkouts/gnu/make/manual/html_node/Prerequisite-Types.html
Occasionally, however, you have a situation where you want to
impose a specific ordering on the rules to be invoked without
forcing the target to be updated if one of those rules is
executed. In that case, you want to define order-only
prerequisites. Order-only prerequisites can be specified by
placing a pipe symbol (|) in the prerequisites list: any
prerequisites to the left of the pipe symbol are normal; any
prerequisites to the right are order-only:
targets : normal-prerequisites | order-only-prerequisites
Almost everything was build sequentially in RIOT, because we employed
explicit for-loops to build directories (DIRS). This PR makes our make
system use normal dependencies to build directories.
All our compiling rules were duplicated, once for the application, once
for modules. This PR makes the application a normal module, removing
this duplication.
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`.
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
manually.
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
Makefile.
Closes#993.
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
`boards/$(BOARD)/Makefile.include`, e.g.
```Makefile
export UNDEF += $(BINDIR)msp430_common/startup.o
```