Makefile.include: add BUILD_FILES variable that holds all files to be built#12302
Makefile.include: add BUILD_FILES variable that holds all files to be built#12302aabadie merged 2 commits intoRIOT-OS:masterfrom
Conversation
|
@cladmi would you mind taking a look at this one, are there other usages for this? Is there a better way of defining this? |
|
This actually still has some issue when compiling |
This would need something like... This isn't in the scope of the original issue @cladmi? right? |
Only few targets are mapped to be build in docker in RIOT, somehow only 'all' or similar. To add support they must be added to Lines 6 to 12 in 0170d1c So this is indeed out of the scope of my original issue. Doing |
|
I tested and this indeed fixes the compilation with Testing can still not be done even when having local toolchain but it is outside of this PR. |
Makefile.include
Outdated
| PKGDIRBASE ?= $(BINDIRBASE)/pkg/$(BOARD) | ||
| DLCACHE ?= $(RIOTTOOLS)/dlcache/dlcache.sh | ||
| DLCACHE_DIR ?= $(RIOTBASE)/.dlcache | ||
| BUILD_FILES ?= $(ELFFILE) $(FLASHFILE) |
There was a problem hiding this comment.
I am not sure about defining it as ?= for that case.
If an application Makefile defines it it would overwrite this value and is somehow changing the behavior. As the value must be defined before defining link, it cannot be modified after including Makefile.include so an application would need to re-add everything. (ELFFILE would be generated by print-size anyway, but it would be because of black magic)
If you really want to have the ?= functionality, I would split in two variables, BUILD_FILES_DEFAULT ?= $(ELFFILE) $(FLASHFILE) and BUILD_FILES += $(BUILD_FILES_DEFAULT). Not sure if it is currently required though.
For its definition location, the variables at the top are more "directories" related ones. It think it could go at the same place as the definition of FLASHFILE (currently 440).
| # being present without having to trigger re-compilation. | ||
| ifneq (1, $(RIOTNOLINK)) | ||
| link: $(SLOT_RIOT_ELFS) | ||
| BUILD_FILES += $(SLOT_RIOT_ELFS) |
There was a problem hiding this comment.
The RIOTNOLINK is not required anymore, as the files are only used when there is a compilation.
cladmi
left a comment
There was a problem hiding this comment.
I like the name BUILD_FILES, as it does not give any information on the types of files, it is generic. Somehow the PR description should not say "files to be linked" though. The fact that it is created by the link target is just historical naming. (RIOTNOLINK does still calls the target link…)
The variables could also be documented in makefiles/vars.inc.mk.
changed the PR title
addressed |
Makefile.include
Outdated
| $(error FLASHFILE is not defined for this board: $(FLASHFILE)) | ||
| endif | ||
|
|
||
| # By default allways build ELFFILE and FLASHFILE |
|
The base change with
|
aabadie
left a comment
There was a problem hiding this comment.
Trusting @cladmi's review in #12302 (comment)
Let's merge this. ACK
|
Please squash! |
- Add BULD_FILES that holds all files that need to be built and linked.
abdc023 to
c7e0ea4
Compare
- Fixes compiling in docker by using BUILD_FILES to define extra files to be built
c7e0ea4 to
5790e06
Compare
Should we do this? |
It could go in after a cleanup of the current handling. There are I think no reason to currently define the list of possible docker goals there. |
Something that would work as well is |
This is a bad fix, would only work if the code is not updated. So yeah a general cleanup is needed |
Contribution Description
This PR adds a
BUILD_FILESvariable to hold all files that need to be linked. This is an attempt to fix #12003.By default
BUILD_FILESwill hold$(ELFFILE),$(FLASHFILE)but more dependencies can be added as for exampleSLOT_RIOT_ELFS. This ensures the added targets are also built in docker when required.There are other possible solutions, e.g:
The first approach is better IMO as it doesn't mix in docker logic into
riotboot.mkand the built files are correctly defined.PS: I'm unsure about the name of the variable.
Testing procedure
Building in docker now succeeds and doesn't use the local toolchain.
BUILD_IN_DOCKER=1 DOCKER="sudo docker" BOARD=frdm-k64f make --no-print-directory -C bootloaders/riotboot/
Also tested on machine without local toolchain that uses docker by default.
make -C bootloaders/riotboot/
There should be no consequences as the base behavior is kept.
Issues/PRs references
Fixes partially #12003