Open cladmi opened 6 years ago
Includes is also evaluated directly https://github.com/RIOT-OS/RIOT/blob/1f7ec9b2082eec7419f50a7f35eefc84b26a6e90/makefiles/libc/newlib.mk#L89 even if CFLAGS_FPU
can be changed later by pkg/nordic_softdevice_ble
which would change the INCLUDES
when using llvm
https://github.com/RIOT-OS/RIOT/blob/1f7ec9b2082eec7419f50a7f35eefc84b26a6e90/makefiles/toolchain/llvm.inc.mk#L70
In that case it is not breaking as llvm is said incompatible but it shows an issue with these immediate evaluations.
This one is also related, where a file that should be put in BUILDDEPS
is declared by a makefile included after using BUILDDEPS
: https://github.com/RIOT-OS/RIOT/pull/10492#issuecomment-444108243
It goes with many definitions orders in our Makefiles that should be addressed in a deterministic way at some point.
Description
Some makefiles use variables with their immediate value before they get the final one. It's not problematic for build flags but for variables containing files/path.
The root of the problem is that the makefiles do not follow a pattern of defining all variables first/including sub makefiles, and then only after define the rules using the variables as file target or file dependency.
This issue will be the central one to reference sub pull requests to fix this uses.
Debugging
The problem can be seen by using
$(info debug VARIABLE $(VARIABLE))
before usage.TODO list:
PKG_BUILDDIR
board/cpu Makefile.include
Some boards and cpus Makefile.include have different behaviors depending on the modules.
However, modules dependencies are only resolved after including these files.
Some even include
Makefile.dep
to fix issues (other for no reason)https://github.com/RIOT-OS/RIOT/blob/master/boards/common/nrf52xxxdk/Makefile.include#L21-L27
Dependencies need to be processed before including any other
Makefile.include
.Also referenced in https://github.com/RIOT-OS/RIOT/issues/9811
pkg/
PKG_BUILDDIR
Some packages makefile use
$(PKG_BUILDDIR)
with its immediate value when defining targets before it is defined by includingpkg/pkg.mk
.It is mitigated because then they are treated as non file targets, and because the command repeats the variable and does not use the automatic make variables like
$@
. https://github.com/RIOT-OS/RIOT/pull/8509#discussion_r178037265Done