Location for module specific compile configurations


what is the right location for additional settings of CFLAGS, INCLUDES or LINK_FLAGS that are required by a pseudomodule which is enabled in Makefile.include of CPU? Should these additional settings be done in Makefile.include or in Makefile.dep of this CPU?

Regards Gunar

Hi Gunar,

I would say that all CFLAGS/INCLUDES/LINK_FLAGS must be set in Makefile.include (or similar) files not the Makefile.dep ones.

But, currently, as board/cpu Makefile.include are parsed before Makefile.dep, you cannot really do it with the way we define them now.

It is a problem I slowly try to address followed by this issue:


The next step is to somehow move the `CPU/CPU_MODEL` before `board/Makefile.include` and would currently be in `Makefile.features`. I just got stuck providing upcoming PRs. My wip/poc branch is https://github.com/cladmi/RIOT/commits/pr/make/cpu/features I should move my ass if there is interest.

One solution, which does not match the current way of doing in RIOT. Is to use Make declarative syntax and define your configurations using deferred evaluation

CFLAGS += $(if $(filter something,$(USEMODULE)), -DIF_NUM=3)

This would make CFLAGS have the correct value when `USEMODULE` is resolved. There may be cases where it does not work directly though.

Do you have any specific issue/pull request in mind ?

Regards, Gaƫtan