[riot-notifications] [RIOT-OS/RIOT] Makefile.include: add BUILD_FILES variable that holds all files to be linked (#12302)

Francisco notifications at github.com
Wed Sep 25 11:04:47 CEST 2019


### Contribution Description

This PR adds a `BUILD_FILES` variable to hold all files that need to be linked. This is an attempt to fix #12003. 

By default `BUILD_FILES` will hold `$(ELFFILE)`, `$(FLASHFILE)` but more dependencies can be added as for example `SLOT_RIOT_ELFS`. This ensures the added targets are also built in docker when required.

There are other possible solutions, e.g:

```
ifneq (1, $(RIOTNOLINK))
  ifneq (1, $(BUILD_IN_DOCKER))
  link: $(SLOT_RIOT_ELFS)
  endif
endif
```

The first approach is better IMO as it doesn't mix in docker logic into `riotboot.mk` and 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.

<details><summary>BUILD_IN_DOCKER=1 DOCKER="sudo docker" BOARD=frdm-k64f make --no-print-directory -C bootloaders/riotboot/</summary>

```
Unknown device, --name=, --path=, or absolute path in /dev/ or /sys expected.
Launching build container using image "riot/riotbuild:latest".
sudo docker run --rm -t -u "$(id -u)" \
    -v '/usr/share/zoneinfo/Europe/Paris:/etc/localtime:ro' -v '/home/francisco/workspace/RIOT:/data/riotbuild/riotbase' -e 'RIOTBASE=/data/riotbuild/riotbase' -e 'CCACHE_BASEDIR=/data/riotbuild/riotbase' -e 'BUILD_DIR=/data/riotbuild/riotbase/build' -e 'RIOTPROJECT=/data/riotbuild/riotbase' -e 'RIOTCPU=/data/riotbuild/riotbase/cpu' -e 'RIOTBOARD=/data/riotbuild/riotbase/boards' -e 'RIOTMAKE=/data/riotbuild/riotbase/makefiles'     \
    -e 'BOARD=frdm-k64f' \
    -w '/data/riotbuild/riotbase/bootloaders/riotboot/' \
    'riot/riotbuild:latest' make   
[sudo] password for francisco: 
Building application "riotboot" for "frdm-k64f" with MCU "kinetis".

"make" -C /data/riotbuild/riotbase/boards/frdm-k64f
"make" -C /data/riotbuild/riotbase/core
"make" -C /data/riotbuild/riotbase/cpu/kinetis
"make" -C /data/riotbuild/riotbase/cpu/cortexm_common
"make" -C /data/riotbuild/riotbase/cpu/cortexm_common/periph
"make" -C /data/riotbuild/riotbase/cpu/kinetis/periph
"make" -C /data/riotbuild/riotbase/drivers
"make" -C /data/riotbuild/riotbase/drivers/periph_common
"make" -C /data/riotbuild/riotbase/sys
"make" -C /data/riotbuild/riotbase/sys/checksum
"make" -C /data/riotbuild/riotbase/sys/newlib_syscalls_default
"make" -C /data/riotbuild/riotbase/sys/riotboot
"make" -C /data/riotbuild/riotbase/sys/stdio_uart
compiling /data/riotbuild/riotbase/dist/tools/riotboot_gen_hdr/bin/genhdr...
make: Nothing to be done for 'all'.
creating /data/riotbuild/riotbase/bootloaders/riotboot/bin/frdm-k64f/riotboot-slot0.1569401349.riot.bin...
   text	   data	    bss	    dec	    hex	filename
   3444	      0	    604	   4048	    fd0	/data/riotbuild/riotbase/bootloaders/riotboot/bin/frdm-k64f/riotboot.elf
```
</details>

Also tested on machine without local toolchain that uses docker by default.

<details><summary>make -C bootloaders/riotboot/</summary>

```
Launching build container using image "riot/riotbuild:latest".
docker run --rm -t -u "$(id -u)" \
    -v '/usr/share/zoneinfo/Europe/Paris:/etc/localtime:ro' -v '/builds/tmp/RIOT:/data/riotbuild/riotbase' -e 'RIOTBASE=/data/riotbuild/riotbase' -e 'CCACHE_BASEDIR=/data/riotbuild/riotbase' -e 'BUILD_DIR=/data/riotbuild/riotbase/build' -e 'RIOTPROJECT=/data/riotbuild/riotbase' -e 'RIOTCPU=/data/riotbuild/riotbase/cpu' -e 'RIOTBOARD=/data/riotbuild/riotbase/boards' -e 'RIOTMAKE=/data/riotbuild/riotbase/makefiles' -v '/home/ci/.gitcache:/data/riotbuild/gitcache' -e 'GIT_CACHE_DIR=/data/riotbuild/gitcache'   \
     \
    -w '/data/riotbuild/riotbase/bootloaders/riotboot/' \
    'riot/riotbuild:latest' make    
Building application "riotboot" for "samr21-xpro" with MCU "samd21".

"make" -C /data/riotbuild/riotbase/boards/samr21-xpro
"make" -C /data/riotbuild/riotbase/core
"make" -C /data/riotbuild/riotbase/cpu/samd21
"make" -C /data/riotbuild/riotbase/cpu/cortexm_common
"make" -C /data/riotbuild/riotbase/cpu/cortexm_common/periph
"make" -C /data/riotbuild/riotbase/cpu/sam0_common
"make" -C /data/riotbuild/riotbase/cpu/sam0_common/periph
"make" -C /data/riotbuild/riotbase/cpu/samd21/periph
"make" -C /data/riotbuild/riotbase/drivers
"make" -C /data/riotbuild/riotbase/drivers/periph_common
"make" -C /data/riotbuild/riotbase/sys
"make" -C /data/riotbuild/riotbase/sys/checksum
"make" -C /data/riotbuild/riotbase/sys/newlib_syscalls_default
"make" -C /data/riotbuild/riotbase/sys/pm_layered
"make" -C /data/riotbuild/riotbase/sys/riotboot
"make" -C /data/riotbuild/riotbase/sys/stdio_uart
compiling /data/riotbuild/riotbase/dist/tools/riotboot_gen_hdr/bin/genhdr...
make: Nothing to be done for 'all'.
creating /data/riotbuild/riotbase/bootloaders/riotboot/bin/samr21-xpro/riotboot-slot0.1569401425.riot.bin...
   text	   data	    bss	    dec	    hex	filename
   2564	      0	    608	   3172	    c64	/data/riotbuild/riotbase/bootloaders/riotboot/bin/samr21-xpro/riotboot.elf

```
</details>

There should be no consequences as the base behavior is kept.

### Issues/PRs references

Fixes partially #12003 
You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/12302

-- Commit Summary --

  * Makefile.include: add BUILD_FILES
  * makefiles/boot/riotboot.mk: use BUILD_FILES

-- File Changes --

    M Makefile.include (3)
    M makefiles/boot/riotboot.mk (2)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/12302.patch
https://github.com/RIOT-OS/RIOT/pull/12302.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/12302
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190925/c777b6bb/attachment-0001.htm>


More information about the notifications mailing list