1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/makefiles/buildtests.inc.mk
Gaëtan Harter a048001e96
makefiles/buildtest: add a buildtest-indocker
Add a 'buildtest-indocker' that forces executing 'buildtest' for loop
completely inside the container.
It prevents starting one container per compilation wich is slower but
it could hide errors where the host toolchain would be used

It is currently equivalent to `buildtest` but will change when the
`buidtest` handling will be move outside of `BUILD_IN_DOCKER`.

Display an error when executed without BUILD_IN_DOCKER=1.
2019-08-14 17:02:35 +02:00

42 lines
1.2 KiB
Makefile

.PHONY: buildtest buildtest-indocker
BUILDTEST_MAKE_REDIRECT ?= >/dev/null 2>&1
ifeq ($(BUILD_IN_DOCKER),1)
buildtest: ..in-docker-container
else
buildtest:
@ \
RESULT=true ; \
for board in $(BOARDS); do \
if BOARD=$${board} $(MAKE) check-toolchain-supported > /dev/null 2>&1; then \
$(COLOR_ECHO) -n "Building for $$board ... " ; \
BOARD=$${board} RIOT_CI_BUILD=1 RIOT_VERSION_OVERRIDE=buildtest \
$(MAKE) clean all -j $(NPROC) $(BUILDTEST_MAKE_REDIRECT); \
RES=$$? ; \
if [ $$RES -eq 0 ]; then \
$(COLOR_ECHO) "$(COLOR_GREEN)success.$(COLOR_RESET)" ; \
else \
$(COLOR_ECHO) "$(COLOR_RED)failed!$(COLOR_RESET)" ; \
RESULT=false ; \
fi ; \
BOARD=$${board} $(MAKE) clean-intermediates >/dev/null 2>&1 || true; \
fi; \
done ; \
$${RESULT}
endif # BUILD_IN_DOCKER
# Define 'buildtest-indocker' completely executed inside the container.
# It prevents starting one container per compilation wich is slower but it
# could hide errors where the host toolchain would be used
ifeq ($(BUILD_IN_DOCKER),1)
buildtest-indocker: ..in-docker-container
else
ifeq ($(INSIDE_DOCKER),1)
buildtest-indocker: buildtest
else
buildtest-indocker:
$(error $@ must be run with `BUILD_IN_DOCKER=1`)
endif # INSIDE_DOCKER
endif # BUILD_IN_DOCKER