2014-08-21 19:37:06 +02:00
|
|
|
ifneq (, $(filter buildtest info-concurrency, $(MAKECMDGOALS)))
|
2014-05-14 14:05:22 +02:00
|
|
|
ifeq (, $(strip $(NPROC)))
|
|
|
|
# Linux (utility program)
|
|
|
|
NPROC := $(shell nproc 2>/dev/null)
|
|
|
|
|
|
|
|
ifeq (, $(strip $(NPROC)))
|
|
|
|
# Linux (generic)
|
|
|
|
NPROC := $(shell grep -c ^processor /proc/cpuinfo 2>/dev/null)
|
|
|
|
endif
|
|
|
|
ifeq (, $(strip $(NPROC)))
|
|
|
|
# BSD (at least FreeBSD and Mac OSX)
|
|
|
|
NPROC := $(shell sysctl -n hw.ncpu 2>/dev/null)
|
|
|
|
endif
|
|
|
|
ifeq (, $(strip $(NPROC)))
|
|
|
|
# Fallback
|
|
|
|
NPROC := 1
|
|
|
|
endif
|
|
|
|
|
|
|
|
NPROC := $(shell echo $$(($(NPROC) + 1)))
|
2014-08-21 19:37:06 +02:00
|
|
|
|
|
|
|
ifneq (, $(NPROC_MAX))
|
|
|
|
NPROC := $(shell if [ ${NPROC} -gt $(NPROC_MAX) ]; then echo $(NPROC_MAX); else echo ${NPROC}; fi)
|
|
|
|
endif
|
|
|
|
ifneq (, $(NPROC_MIN))
|
|
|
|
NPROC := $(shell if [ ${NPROC} -lt $(NPROC_MIN) ]; then echo $(NPROC_MIN); else echo ${NPROC}; fi)
|
|
|
|
endif
|
2014-05-14 14:05:22 +02:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2014-08-13 21:24:07 +02:00
|
|
|
.PHONY: buildtest info-objsize info-buildsize info-buildsizes \
|
2014-09-29 18:09:18 +02:00
|
|
|
info-buildsizes-diff info-build info-boards-supported \
|
|
|
|
info-features-missing info-boards-features-missing
|
2014-08-13 21:24:07 +02:00
|
|
|
|
2014-05-14 13:46:27 +02:00
|
|
|
buildtest:
|
2014-10-06 17:21:37 +02:00
|
|
|
@ \
|
2014-08-05 17:42:32 +02:00
|
|
|
BUILDTESTOK=true; \
|
2014-05-14 13:48:22 +02:00
|
|
|
rm -rf "$$BINDIRBASE"; \
|
2014-09-29 18:09:18 +02:00
|
|
|
for BOARD in $$($(MAKE) -s info-boards-supported); do \
|
2014-10-28 14:43:19 +01:00
|
|
|
RIOTNOLINK=$$(echo $(BOARD_INSUFFICIENT_RAM) | grep $${BOARD} 2>&1 >/dev/null && echo 1); \
|
2014-10-06 17:21:37 +02:00
|
|
|
${COLOR_ECHO} -n "Building for $${BOARD} "; \
|
|
|
|
[ -n "$${RIOTNOLINK}" ] && ${COLOR_ECHO} -n "(no linking) "; \
|
2014-08-05 17:42:32 +02:00
|
|
|
for NTH_TRY in 1 2; do \
|
2014-10-06 17:21:37 +02:00
|
|
|
${COLOR_ECHO} -n ".. "; \
|
2014-08-05 17:42:32 +02:00
|
|
|
LOG=$$(env -i \
|
|
|
|
HOME=$${HOME} \
|
|
|
|
PATH=$${PATH} \
|
|
|
|
BOARD=$${BOARD} \
|
|
|
|
RIOTBASE=$${RIOTBASE} \
|
|
|
|
RIOTBOARD=$${RIOTBOARD} \
|
|
|
|
RIOTCPU=$${RIOTCPU} \
|
|
|
|
BINDIRBASE=$${BINDIRBASE} \
|
|
|
|
RIOTNOLINK=$${RIOTNOLINK} \
|
|
|
|
RIOT_VERSION=$${RIOT_VERSION} \
|
|
|
|
$(MAKE) -j$(NPROC) 2>&1 >/dev/null) ; \
|
|
|
|
if [ "$${?}" = "0" ]; then \
|
2014-10-06 17:21:37 +02:00
|
|
|
${COLOR_ECHO} "${COLOR_GREEN}success${COLOR_RESET}"; \
|
2014-08-05 17:42:32 +02:00
|
|
|
elif [ -n "$${RIOT_DO_RETRY}" ] && $${BUILDTESTOK} && [ $${NTH_TRY} = 1 ]; then \
|
2014-10-06 17:21:37 +02:00
|
|
|
${COLOR_ECHO} -n "${COLOR_PURPLE}retrying${COLOR_RESET} "; \
|
2014-08-05 17:42:32 +02:00
|
|
|
continue; \
|
|
|
|
else \
|
2014-10-06 17:21:37 +02:00
|
|
|
${COLOR_ECHO} "${COLOR_RED}failed${COLOR_RESET}"; \
|
2014-08-05 17:42:32 +02:00
|
|
|
echo "$${LOG}" | grep -v -E '^make(\[[[:digit:]]])?:'; \
|
|
|
|
BUILDTESTOK=false; \
|
|
|
|
fi; \
|
|
|
|
break; \
|
|
|
|
done; \
|
2014-05-14 13:46:27 +02:00
|
|
|
done; \
|
2014-08-05 17:42:32 +02:00
|
|
|
$${BUILDTESTOK}
|
2014-05-14 13:46:27 +02:00
|
|
|
|
2014-08-11 11:29:13 +02:00
|
|
|
info-objsize:
|
2014-05-14 13:46:27 +02:00
|
|
|
@case "${SORTROW}" in \
|
|
|
|
text) SORTROW=1 ;; \
|
|
|
|
data) SORTROW=2 ;; \
|
|
|
|
bss) SORTROW=3 ;; \
|
|
|
|
dec) SORTROW=4 ;; \
|
|
|
|
"") SORTROW=4 ;; \
|
2014-08-11 11:33:18 +02:00
|
|
|
*) echo "Usage: $(MAKE) info-objsize SORTROW=[text|data|bss|dec]" ; return ;; \
|
2014-05-14 13:46:27 +02:00
|
|
|
esac; \
|
|
|
|
echo ' text\t data\t bss\t dec\t hex\tfilename'; \
|
|
|
|
$(SIZE) -dB $(BASELIBS) | \
|
|
|
|
tail -n+2 | \
|
|
|
|
sed -e 's#$(BINDIR)##' | \
|
|
|
|
sort -rnk$${SORTROW}
|
|
|
|
|
2014-08-11 11:33:18 +02:00
|
|
|
info-buildsize:
|
2014-05-23 10:33:02 +02:00
|
|
|
@$(SIZE) -dB $(BINDIR)$(APPLICATION).elf
|
2014-05-14 13:46:27 +02:00
|
|
|
|
2014-08-11 11:33:18 +02:00
|
|
|
info-buildsizes: SHELL=bash
|
|
|
|
info-buildsizes:
|
2014-05-14 13:46:27 +02:00
|
|
|
echo -e " text\t data\t bss\t dec\tboard"; \
|
2014-09-29 18:09:18 +02:00
|
|
|
for BOARD in $$($(MAKE) -s info-boards-supported); do \
|
2014-05-14 13:46:27 +02:00
|
|
|
echo "$$(env -i \
|
|
|
|
HOME=$${HOME} \
|
|
|
|
PATH=$${PATH} \
|
|
|
|
BOARD=$${BOARD} \
|
|
|
|
RIOTBASE=$${RIOTBASE} \
|
|
|
|
RIOTBOARD=$${RIOTBOARD} \
|
|
|
|
RIOTCPU=$${RIOTCPU} \
|
|
|
|
BINDIRBASE=$${BINDIRBASE} \
|
2014-08-11 11:33:18 +02:00
|
|
|
$(MAKE) info-buildsize 2>/dev/null | tail -n-1 | cut -f-4)" "$${BOARD}"; \
|
2014-05-14 13:46:27 +02:00
|
|
|
done;
|
|
|
|
|
2014-08-11 11:33:18 +02:00
|
|
|
info-buildsizes-diff: SHELL=bash
|
|
|
|
info-buildsizes-diff:
|
2014-05-14 13:46:27 +02:00
|
|
|
echo -e "text\tdata\tbss\tdec\tBOARD/BINDIRBASE\n"; \
|
2014-09-29 18:09:18 +02:00
|
|
|
for BOARD in $$($(MAKE) -s info-boards-supported); do \
|
2014-05-14 13:46:27 +02:00
|
|
|
for BINDIRBASE in $${OLDBIN} $${NEWBIN}; do \
|
|
|
|
env -i \
|
|
|
|
HOME=$${HOME} \
|
|
|
|
PATH=$${PATH} \
|
|
|
|
BOARD=$${BOARD} \
|
|
|
|
RIOTBASE=$${RIOTBASE} \
|
|
|
|
RIOTBOARD=$${RIOTBOARD} \
|
|
|
|
RIOTCPU=$${RIOTCPU} \
|
|
|
|
BINDIRBASE=$${BINDIRBASE} \
|
2014-08-11 11:33:18 +02:00
|
|
|
$(MAKE) info-buildsize 2>/dev/null | tail -n-1 | cut -f-4; \
|
2014-05-14 13:46:27 +02:00
|
|
|
done | \
|
|
|
|
while read -a OLD && read -a NEW; do \
|
|
|
|
for I in 0 1 2 3; do \
|
|
|
|
if [[ -n "$${NEW[I]}" && -n "$${OLD[I]}" ]]; then \
|
|
|
|
DIFF=$$(($${NEW[I]} - $${OLD[I]})); \
|
2014-10-06 17:21:37 +02:00
|
|
|
if [[ "$${DIFF}" -gt 0 ]]; then $(COLOR_ECHO) -n "${COLOR_RED}"; fi; \
|
|
|
|
if [[ "$${DIFF}" -lt 0 ]]; then $(COLOR_ECHO) -n "${COLOR_GREEN}"; fi; \
|
2014-05-14 13:46:27 +02:00
|
|
|
else \
|
|
|
|
DIFF="$${RED}ERR"; \
|
|
|
|
fi; \
|
|
|
|
echo -ne "$${DIFF}\t$${RESET}"; \
|
|
|
|
done; \
|
|
|
|
echo "$${BOARD}"; \
|
2014-10-06 17:21:37 +02:00
|
|
|
for I in 0 1 2 3; do echo -ne "$${OLD[I]-${COLOR_RED}ERR${COLOR_RESET}}\t"; done; echo -e "$${OLDBIN}"; \
|
|
|
|
for I in 0 1 2 3; do echo -ne "$${NEW[I]-${COLOR_RED}ERR${COLOR_RESET}}\t"; done; echo -e "$${NEWBIN}\n"; \
|
2014-05-14 13:46:27 +02:00
|
|
|
done; \
|
|
|
|
done;
|
2014-05-18 18:54:11 +02:00
|
|
|
|
2014-08-11 11:29:13 +02:00
|
|
|
info-build:
|
2014-06-18 15:24:14 +02:00
|
|
|
@echo 'APPLICATION: $(APPLICATION)'
|
2014-08-13 20:44:16 +02:00
|
|
|
@echo ''
|
|
|
|
@echo 'supported boards:'
|
|
|
|
@$(foreach board,$(BOARDS),echo ' * $(board)';)
|
|
|
|
@echo ''
|
2014-05-18 18:54:11 +02:00
|
|
|
@echo 'BOARD: $(BOARD)'
|
|
|
|
@echo 'CPU: $(CPU)'
|
|
|
|
@echo 'MCU: $(MCU)'
|
|
|
|
@echo ''
|
|
|
|
@echo 'RIOTBASE: $(RIOTBASE)'
|
|
|
|
@echo 'RIOTBOARD: $(RIOTBOARD)'
|
|
|
|
@echo 'RIOTCPU: $(RIOTCPU)'
|
|
|
|
@echo ''
|
|
|
|
@echo 'DEFAULT_MODULE: $(sort $(filter-out $(DISABLE_MODULE), $(DEFAULT_MODULE)))'
|
|
|
|
@echo 'DISABLE_MODULE: $(sort $(DISABLE_MODULE))'
|
|
|
|
@echo 'USEMODULE: $(sort $(filter-out $(DEFAULT_MODULE), $(USEMODULE)))'
|
|
|
|
@echo ''
|
|
|
|
@echo 'ELFFILE: $(ELFFILE)'
|
|
|
|
@echo 'HEXFILE: $(HEXFILE)'
|
|
|
|
@echo ''
|
2014-10-26 23:18:58 +01:00
|
|
|
@echo 'FEATURES_REQUIRED (excl. optional features):'
|
|
|
|
@echo ' $(or $(sort $(filter-out $(FEATURES_OPTIONAL), $(FEATURES_REQUIRED))), -none-)'
|
|
|
|
@echo 'FEATURES_OPTIONAL (strictly "nice to have"):'
|
|
|
|
@echo ' $(or $(sort $(FEATURES_OPTIONAL)), -none-)'
|
2014-10-26 23:36:05 +01:00
|
|
|
@echo 'FEATURES_PROVIDED (by the board or USEMODULE'"'"'d drivers):'
|
2014-10-26 23:18:58 +01:00
|
|
|
@echo ' $(or $(sort $(FEATURES_PROVIDED)), -none-)'
|
|
|
|
@echo 'FEATURES_MISSING (incl. optional features):'
|
|
|
|
@echo ' $(or $(sort $(filter-out $(FEATURES_PROVIDED), $(FEATURES_REQUIRED))), -none-)'
|
|
|
|
@echo 'FEATURES_MISSING (only non-optional features):'
|
|
|
|
@echo ' $(or $(sort $(filter-out $(FEATURES_OPTIONAL) $(FEATURES_PROVIDED), $(FEATURES_REQUIRED))), -none-)'
|
2014-09-29 18:09:18 +02:00
|
|
|
@echo ''
|
2014-05-05 21:53:37 +02:00
|
|
|
@echo 'CC: $(CC)'
|
|
|
|
@echo -e 'CFLAGS:$(patsubst %, \n\t%, $(CFLAGS))'
|
2014-05-18 18:54:11 +02:00
|
|
|
@echo ''
|
2014-05-05 21:53:37 +02:00
|
|
|
@echo 'CXX: $(CXX)'
|
|
|
|
@echo -e 'CXXUWFLAGS:$(patsubst %, \n\t%, $(CXXUWFLAGS))'
|
|
|
|
@echo -e 'CXXEXFLAGS:$(patsubst %, \n\t%, $(CXXEXFLAGS))'
|
|
|
|
@echo ''
|
|
|
|
@echo 'LINK: $(LINK)'
|
2014-05-18 18:54:11 +02:00
|
|
|
@echo -e 'LINKFLAGS:$(patsubst %, \n\t%, $(LINKFLAGS))'
|
|
|
|
@echo ''
|
|
|
|
@echo 'OBJCOPY: $(OBJCOPY)'
|
|
|
|
@echo 'OFLAGS: $(OFLAGS)'
|
|
|
|
@echo ''
|
|
|
|
@echo 'FLASHER: $(FLASHER)'
|
|
|
|
@echo 'FFLAGS: $(FFLAGS)'
|
|
|
|
@echo ''
|
2014-11-25 18:13:45 +01:00
|
|
|
@echo 'TERMPROG: $(TERMPROG)'
|
|
|
|
@echo 'TERMFLAGS: $(TERMFLAGS)'
|
|
|
|
@echo 'PORT: $(PORT)'
|
2014-05-18 18:54:11 +02:00
|
|
|
@echo ''
|
|
|
|
@echo 'DEBUGGER: $(DEBUGGER)'
|
|
|
|
@echo 'DEBUGGER_FLAGS: $(DEBUGGER_FLAGS)'
|
make: centralize wget/curl & unzip/7z feature test
With many open PRs that could benefit from loading SDKs when needed,
instead adding vast amounts of code to RIOTs master, this PR provides
the "functions" `$(DOWNLOAD_TO_STDOUT)`, `$(DOWNLOAD_TO_FILE)`, and
`$(UNZIP_HERE)`.
The first "function" takes one argument, the URL from where to download
the content. It is then piped to stdout. To be used e.g. with `tar xz`.
The second "function" taken two arguments, the destination file name,
and the source URL. If the previous invocation was interrupted, then the
download gets continued, if possible.
The last "function" takes one argument, the source ZIP file. The file
gets extracted into the cwd, so best use this "function" with
`cd $(SOME_WHERE) &&`.
The clumsy name `$(UNZIP_HERE)` is taken because the program "unzip"
takes the environment variable `UNZIP` as the source file, even if
another file name was given on the command line. The rationale for that
is that the hackers of "unzip" hate their users. Also they sacrifice
hamsters to Satan.
2014-07-16 00:29:18 +02:00
|
|
|
@echo
|
|
|
|
@echo 'DOWNLOAD_TO_FILE: $(DOWNLOAD_TO_FILE)'
|
|
|
|
@echo 'DOWNLOAD_TO_STDOUT: $(DOWNLOAD_TO_STDOUT)'
|
|
|
|
@echo 'UNZIP_HERE: $(UNZIP_HERE)'
|
2014-05-18 18:54:11 +02:00
|
|
|
@echo ''
|
2014-08-05 00:49:59 +02:00
|
|
|
@echo 'DEBUGSERVER: $(DEBUGSERVER)'
|
|
|
|
@echo 'DEBUGSERVER_FLAGS: $(DEBUGSERVER_FLAGS)'
|
|
|
|
@echo ''
|
|
|
|
@echo 'RESET: $(RESET)'
|
|
|
|
@echo 'RESET_FLAGS: $(RESET_FLAGS)'
|
|
|
|
@echo ''
|
2014-05-18 18:54:11 +02:00
|
|
|
@echo -e 'MAKEFILE_LIST:$(patsubst %, \n\t%, $(abspath $(MAKEFILE_LIST)))'
|
2014-08-05 00:49:59 +02:00
|
|
|
|
2014-08-11 11:28:17 +02:00
|
|
|
info-boards-supported:
|
2014-09-29 18:09:18 +02:00
|
|
|
@echo $(BOARDS)
|
|
|
|
|
|
|
|
info-features-missing:
|
|
|
|
@echo $(filter-out $(FEATURES_PROVIDED), $(FEATURES_REQUIRED))
|
|
|
|
|
|
|
|
info-boards-features-missing:
|
|
|
|
@for f in $(BOARDS_FEATURES_MISSING); do echo $${f}; done | column -t
|
|
|
|
|
2014-10-26 23:18:58 +01:00
|
|
|
FEATURES_REQUIRED += $(FEATURES_OPTIONAL)
|
|
|
|
|
2014-09-29 18:09:18 +02:00
|
|
|
ifneq (, $(filter info-boards-supported info-boards-features-missing info-build, $(MAKECMDGOALS)))
|
|
|
|
FEATURES_PROVIDED_BAK := $(FEATURES_PROVIDED)
|
|
|
|
|
|
|
|
define board_missing_features
|
2014-10-26 23:36:05 +01:00
|
|
|
FEATURES_PROVIDED := $(FEATURES_PROVIDED_BAK)
|
2014-09-29 18:09:18 +02:00
|
|
|
-include $${RIOTBOARD}/${1}/Makefile.features
|
2015-02-06 03:36:16 +01:00
|
|
|
ifneq ($(BUILDTEST_MCU_GROUP), $$(FEATURES_MCU_GROUP))
|
|
|
|
BOARDS_FEATURES_MISSING += "${1} $${BUILDTEST_MCU_GROUP}"
|
|
|
|
BOARDS_WITH_MISSING_FEATURES += ${1}
|
|
|
|
endif
|
2014-09-29 18:09:18 +02:00
|
|
|
|
|
|
|
FEATURES_MISSING := $$(filter-out $$(FEATURES_PROVIDED), $$(FEATURES_REQUIRED))
|
|
|
|
ifneq (, $${FEATURES_MISSING})
|
|
|
|
BOARDS_FEATURES_MISSING += "${1} $${FEATURES_MISSING}"
|
2014-10-26 23:18:58 +01:00
|
|
|
ifneq (, $$(filter-out $$(FEATURES_OPTIONAL), $$(FEATURES_MISSING)))
|
|
|
|
BOARDS_WITH_MISSING_FEATURES += ${1}
|
|
|
|
endif
|
2014-09-29 18:09:18 +02:00
|
|
|
endif
|
|
|
|
endef
|
|
|
|
|
2014-10-28 14:43:19 +01:00
|
|
|
BOARDS ?= $(shell find $(RIOTBOARD)/* -maxdepth 0 -type d \! -name "*-common" -exec basename {} \;)
|
2014-09-29 18:09:18 +02:00
|
|
|
BOARDS := $(filter $(if $(BOARD_WHITELIST), $(BOARD_WHITELIST), %), $(BOARDS))
|
|
|
|
BOARDS := $(filter-out $(BOARD_BLACKLIST), $(BOARDS))
|
|
|
|
|
|
|
|
BOARDS_WITH_MISSING_FEATURES :=
|
|
|
|
BOARDS_FEATURES_MISSING :=
|
|
|
|
$(foreach BOARD, $(BOARDS), $(eval $(call board_missing_features,$(BOARD))))
|
|
|
|
BOARDS := $(filter-out $(BOARDS_WITH_MISSING_FEATURES), $(BOARDS))
|
|
|
|
|
|
|
|
FEATURES_PROVIDED := $(FEATURES_PROVIDED_BAK)
|
|
|
|
endif
|
2014-08-21 19:37:06 +02:00
|
|
|
|
|
|
|
info-concurrency:
|
|
|
|
@echo "$(NPROC)"
|