1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/Makefile.include

570 lines
18 KiB
Makefile
Raw Normal View History

# include Makefile.local if it exists
-include Makefile.local
2014-10-30 22:40:41 +01:00
all:
# set undefined variables
RIOTBASE ?= $(dir $(lastword $(MAKEFILE_LIST)))
2016-04-05 11:39:57 +02:00
CCACHE_BASEDIR ?= $(RIOTBASE)
RIOTCPU ?= $(RIOTBASE)/cpu
RIOTBOARD ?= $(RIOTBASE)/boards
RIOTMAKE ?= $(RIOTBASE)/makefiles
RIOTPKG ?= $(RIOTBASE)/pkg
RIOTPROJECT ?= $(shell git rev-parse --show-toplevel 2>/dev/null || pwd)
GITCACHE ?= $(RIOTBASE)/dist/tools/git/git-cache
APPDIR ?= $(CURDIR)
BINDIRBASE ?= $(APPDIR)/bin
BINDIR ?= $(BINDIRBASE)/$(BOARD)
2017-02-25 15:41:22 +01:00
PKGDIRBASE ?= $(BINDIRBASE)/pkg/$(BOARD)
2017-02-23 17:34:32 +01:00
DLCACHE ?= $(RIOTBASE)/dist/tools/dlcache/dlcache.sh
DLCACHE_DIR ?= $(RIOTBASE)/.dlcache
__DIRECTORY_VARIABLES := \
RIOTBASE \
RIOTCPU \
RIOTBOARD \
RIOTMAKE \
RIOTPKG \
RIOTPROJECT \
APPDIR \
BINDIRBASE \
BINDIR \
CCACHE_BASEDIR \
GITCACHE \
PKGDIRBASE \
2017-02-23 17:34:32 +01:00
DLCACHE_DIR \
#
# Make all paths absolute.
override RIOTBASE := $(abspath $(RIOTBASE))
override CCACHE_BASEDIR := $(abspath $(CCACHE_BASEDIR))
override RIOTCPU := $(abspath $(RIOTCPU))
override RIOTBOARD := $(abspath $(RIOTBOARD))
override RIOTMAKE := $(abspath $(RIOTMAKE))
override RIOTPKG := $(abspath $(RIOTPKG))
override RIOTPROJECT := $(abspath $(RIOTPROJECT))
override GITCACHE := $(abspath $(GITCACHE))
override APPDIR := $(abspath $(APPDIR))
override BINDIRBASE := $(abspath $(BINDIRBASE))
override BINDIR := $(abspath $(BINDIR))
2017-02-25 15:41:22 +01:00
override PKGDIRBASE := $(abspath $(PKGDIRBASE))
2017-02-23 17:34:32 +01:00
override DLCACHE_DIR := $(abspath $(DLCACHE_DIR))
# Ensure that all directories are set and don't contain spaces.
ifneq (, $(filter-out 1, $(foreach v,${__DIRECTORY_VARIABLES},$(words ${${v}}))))
$(info Aborting compilation for your safety.)
$(info Related variables = ${__DIRECTORY_VARIABLES})
$(error Make sure no path override is empty or contains spaces!)
endif
2016-03-05 00:53:05 +01:00
# Use absolute paths in recusive "make" even if overriden on command line.
MAKEOVERRIDES += $(foreach v,${__DIRECTORY_VARIABLES},${v}=${${v}})
2016-04-05 15:27:34 +02:00
# Path to the current directory relative to RIOTPROJECT
BUILDRELPATH ?= ${PWD:${RIOTPROJECT}/%=%}/
2016-03-20 12:40:20 +01:00
# Include Docker settings near the top because we need to build the environment
# command line before some of the variable origins are overwritten below when
# using abspath, strip etc.
include $(RIOTMAKE)/docker.inc.mk
# Static code analysis tools provided by LLVM
include $(RIOTMAKE)/scan-build.inc.mk
export RIOTBUILD_CONFIG_HEADER_C = $(BINDIR)/riotbuild/riotbuild.h
2014-10-30 22:40:41 +01:00
COLOR_GREEN :=
COLOR_RED :=
COLOR_PURPLE :=
COLOR_RESET :=
COLOR_ECHO := /bin/echo
OS := $(shell uname)
ifeq (0, $(shell tput colors 2>&1 > /dev/null; echo $$?))
COLOR_GREEN := \033[1;32m
COLOR_RED := \033[1;31m
COLOR_YELLOW := \033[1;33m
COLOR_PURPLE := \033[1;35m
COLOR_RESET := \033[0m
ifeq ($(OS),Darwin)
COLOR_ECHO := echo -e
SHELL=bash
else
COLOR_ECHO := /bin/echo -e
2014-10-30 22:40:41 +01:00
endif
endif
ifeq ($(OS),Darwin)
OPEN := open
else
OPEN := xdg-open
endif
2016-09-06 14:59:48 +02:00
QUIET ?= 1
ifeq ($(QUIET),1)
2016-12-17 01:16:07 +01:00
Q=@
MAKEFLAGS += --no-print-directory
else
2016-12-17 01:16:07 +01:00
Q=
endif
QQ=
# Fail on warnings. Can be overridden by `make WERROR=0`.
WERROR ?= 1
export WERROR
ifeq ($(WERROR),1)
CFLAGS += -Werror
endif
2014-10-30 22:40:41 +01:00
ifneq (10,$(if ${RIOT_VERSION},1,0)$(if ${__RIOTBUILD_FLAG},1,0))
# Provide a shallow sanity check. You cannot call `make` in a module directory.
export __RIOTBUILD_FLAG := RIOT
2014-01-08 16:46:16 +01:00
BOARD := $(strip $(BOARD))
APPLICATION := $(strip $(APPLICATION))
2014-01-08 16:46:16 +01:00
# provide common external programs for `Makefile.include`s
ifeq (,$(and $(DOWNLOAD_TO_STDOUT),$(DOWNLOAD_TO_FILE)))
ifeq (,$(WGET))
ifeq (0,$(shell which wget 2>&1 > /dev/null ; echo $$?))
WGET := $(shell which wget)
endif
endif
ifeq (,$(CURL))
ifeq (0,$(shell which curl 2>&1 > /dev/null ; echo $$?))
CURL := $(shell which curl)
endif
endif
ifeq (,$(WGET)$(CURL))
$(error Neither wget nor curl is installed!)
endif
ifeq (,$(DOWNLOAD_TO_STDOUT))
DOWNLOAD_TO_STDOUT := $(if $(CURL),$(CURL) -s,$(WGET) -q -O-)
endif
ifeq (,$(DOWNLOAD_TO_FILE))
DOWNLOAD_TO_FILE := $(if $(WGET),$(WGET) -nv -c -O,$(CURL) -s -o)
endif
endif
ifeq (,$(UNZIP_HERE))
ifeq (0,$(shell which unzip 2>&1 > /dev/null ; echo $$?))
UNZIP_HERE := $(shell which unzip) -q
else
ifeq (0,$(shell which 7z 2>&1 > /dev/null ; echo $$?))
UNZIP_HERE := $(shell which 7z) x -bd
else
$(error Neither unzip nor 7z is installed.)
endif
endif
endif
ifeq (, ${APPLICATION})
$(error An application name must be specified as APPLICATION.)
endif
2015-02-22 21:11:30 +01:00
ifneq (0,$(shell test -d $(RIOTBOARD)/$(BOARD); echo $$?))
$(error The specified board $(BOARD) does not exist.)
endif
# Use TOOLCHAIN environment variable to select the toolchain to use.
# Default for macOS: llvm; for other OS: gnu
ifeq ($(BOARD),native)
ifeq ($(OS),Darwin)
TOOLCHAIN ?= llvm
endif
endif
TOOLCHAIN ?= gnu
# TOOLCHAIN = clang is an alias for TOOLCHAIN = llvm
ifeq (clang,$(TOOLCHAIN))
# use override so that we can redefine a variable set on the command line (as
# opposed to one set in the environment)
override TOOLCHAIN := llvm
endif
# TOOLCHAIN = gcc is an alias for TOOLCHAIN = gnu
ifeq (gcc,$(TOOLCHAIN))
# use override so that we can redefine a variable set on the command line (as
# opposed to one set in the environment)
override TOOLCHAIN := gnu
endif
ifeq (,$(TOOLCHAIN))
override TOOLCHAIN := gnu
endif
export TOOLCHAIN
# default toolchain prefix, defaults to target triple followed by a dash, you
# will most likely not need to touch this.
export PREFIX ?= $(if $(TARGET_ARCH),$(TARGET_ARCH)-)
# Add standard include directories
INCLUDES += -I$(RIOTBASE)/core/include -I$(RIOTBASE)/drivers/include -I$(RIOTBASE)/sys/include
INCLUDES += -I$(RIOTCPU)/$(CPU)/include
INCLUDES += -I$(RIOTBOARD)/$(BOARD)/include
# mandatory includes!
include $(RIOTMAKE)/pseudomodules.inc.mk
include $(RIOTMAKE)/defaultmodules.inc.mk
include $(RIOTBOARD)/$(BOARD)/Makefile.include
include $(RIOTCPU)/$(CPU)/Makefile.include
# Import all toolchain settings
include $(RIOTMAKE)/toolchain/$(TOOLCHAIN).inc.mk
# get number of interfaces straight before resolving dependencies
GNRC_NETIF_NUMOF ?= 1
ifneq ($(GNRC_NETIF_NUMOF),1)
CFLAGS += -DGNRC_NETIF_NUMOF=$(GNRC_NETIF_NUMOF)
endif
include $(RIOTBASE)/Makefile.dep
USEMODULE += $(filter-out $(DISABLE_MODULE), $(DEFAULT_MODULE))
ifeq ($(strip $(MCU)),)
MCU = $(CPU)
endif
2016-12-17 00:17:26 +01:00
# set some settings useful for continuous integration builds
ifeq ($(RIOT_CI_BUILD),1)
RIOT_VERSION_OVERRIDE:=buildtest
ifneq ($(filter $(BOARD_INSUFFICIENT_MEMORY), $(BOARD)),)
$(info CI-build: skipping link step)
RIOTNOLINK:=1
endif
# be more quiet when building for CI
QQ:=@
2016-12-17 00:17:26 +01:00
endif
# if you want to publish the board into the sources as an uppercase #define
BOARDDEF := $(shell echo $(BOARD) | tr 'a-z' 'A-Z' | tr '-' '_')
CPUDEF := $(shell echo $(CPU) | tr 'a-z' 'A-Z' | tr '-' '_')
MCUDEF := $(shell echo $(MCU) | tr 'a-z' 'A-Z' | tr '-' '_')
CFLAGS += -DBOARD_$(BOARDDEF)=\"$(BOARD)\" -DRIOT_BOARD=BOARD_$(BOARDDEF)
CFLAGS += -DCPU_$(CPUDEF)=\"$(CPU)\" -DRIOT_CPU=CPU_$(CPUDEF)
CFLAGS += -DMCU_$(MCUDEF)=\"$(MCU)\" -DRIOT_MCU=MCU_$(MCUDEF)
# OSX fails to create empty archives. Provide a wrapper to catch that error.
ifneq (0, $(shell mkdir -p $(BINDIR); $(AR) rc $(BINDIR)/empty-archive.a 2> /dev/null; \
echo $$?; rm -f $(BINDIR)/empty-archive.a 2>&1 > /dev/null))
AR := $(RIOTBASE)/dist/ar-wrapper $(AR)
endif
# Feature test default CFLAGS and LINKFLAGS for the set compiled.
include $(RIOTMAKE)/cflags.inc.mk
2014-06-21 18:29:16 +02:00
# make the RIOT version available to the program
ifeq ($(origin RIOT_VERSION), undefined)
GIT_STRING := $(shell git --git-dir="$(RIOTBASE)/.git" describe --always --abbrev=4 --dirty=-`hostname` 2> /dev/null)
ifneq (,$(GIT_STRING))
GIT_BRANCH := $(shell git --git-dir="$(RIOTBASE)/.git" rev-parse --abbrev-ref HEAD)
ifeq ($(strip $(GIT_BRANCH)),master)
RIOT_VERSION := $(GIT_STRING)
else
RIOT_VERSION := $(GIT_STRING)-$(GIT_BRANCH)
endif
else
RIOT_VERSION := 'UNKNOWN (builddir: $(RIOTBASE))'
endif
2014-06-21 18:29:16 +02:00
endif
# the binaries to link
BASELIBS += $(BINDIR)/${APPLICATION}.a
BASELIBS += $(APPDEPS)
2015-08-21 16:10:57 +02:00
.PHONY: all clean flash term doc debug debug-server reset objdump help info-modules
.PHONY: ..in-docker-container
2013-08-08 15:44:44 +02:00
ELFFILE ?= $(BINDIR)/$(APPLICATION).elf
HEXFILE ?= $(ELFFILE:.elf=.hex)
# variables used to compile and link c++
CPPMIX ?= $(if $(wildcard *.cpp),1,)
# We assume $(LINK) to be gcc-like. Use `LINKFLAGPREFIX :=` for ld-like linker options.
LINKFLAGPREFIX ?= -Wl,
DIRS += $(EXTERNAL_MODULE_DIRS)
ifeq ($(BUILD_IN_DOCKER),1)
all: ..in-docker-container
else
2014-05-23 10:33:02 +02:00
## make script for your application. Build RIOT-base here!
all: ..compiler-check ..build-message $(RIOTBUILD_CONFIG_HEADER_C) $(USEPKG:%=${BINDIR}/%.a) $(APPDEPS)
$(Q)DIRS="$(DIRS)" "$(MAKE)" -C $(APPDIR) -f $(RIOTMAKE)/application.inc.mk
ifeq (,$(RIOTNOLINK))
ifeq ($(BUILDOSXNATIVE),1)
$(Q)$(if $(CPPMIX),$(CXX),$(LINK)) $(UNDEF) -o $(ELFFILE) $$(find $(BASELIBS) -size +8c) $(LINKFLAGS) $(LINKFLAGPREFIX)-no_pie
else
$(Q)$(if $(CPPMIX),$(CXX),$(LINK)) $(UNDEF) -o $(ELFFILE) $(LINKFLAGPREFIX)--start-group $(BASELIBS) -lm $(LINKFLAGPREFIX)--end-group $(LINKFLAGPREFIX)-Map=$(BINDIR)/$(APPLICATION).map $(LINKFLAGPREFIX)--cref $(LINKFLAGS)
endif
$(Q)$(SIZE) $(ELFFILE)
$(Q)$(OBJCOPY) $(OFLAGS) $(ELFFILE) $(HEXFILE)
endif
endif # BUILD_IN_DOCKER
..compiler-check:
@command -v $(CC) >/dev/null 2>&1 || \
{ $(COLOR_ECHO) \
'${COLOR_RED}Compiler $(CC) is required but not found in PATH. Aborting.${COLOR_RESET}'; \
exit 1; }
..build-message:
2014-10-30 22:40:41 +01:00
@$(COLOR_ECHO) '${COLOR_GREEN}Building application "$(APPLICATION)" for "$(BOARD)" with MCU "$(MCU)".${COLOR_RESET}'
@$(COLOR_ECHO)
# add extra include paths for packages in $(USEMODULE)
export USEMODULE_INCLUDES =
include $(RIOTBASE)/sys/Makefile.include
include $(RIOTBASE)/drivers/Makefile.include
# The `clean` needs to be serialized before everything else.
ifneq (, $(filter clean, $(MAKECMDGOALS)))
all $(BASELIBS) $(USEPKG:%=$(RIOTPKG)/%/Makefile.include) $(RIOTBUILD_CONFIG_HEADER_C): clean
endif
# include Makefile.includes for packages in $(USEPKG)
2016-03-05 00:53:05 +01:00
$(RIOTPKG)/%/Makefile.include::
$(Q)"$(MAKE)" -C $(RIOTPKG)/$* Makefile.include
2016-03-05 00:53:05 +01:00
.PHONY: $(USEPKG:%=$(RIOTPKG)/%/Makefile.include)
-include $(USEPKG:%=$(RIOTPKG)/%/Makefile.include)
2016-03-22 16:02:51 +01:00
USEMODULE_INCLUDES_ = $(shell echo $(USEMODULE_INCLUDES) | tr ' ' '\n' | awk '!a[$$0]++' | tr '\n' ' ')
INCLUDES += $(USEMODULE_INCLUDES_:%=-I%)
.PHONY: $(USEPKG:%=${BINDIR}/%.a)
$(USEPKG:%=${BINDIR}/%.a): $(RIOTBUILD_CONFIG_HEADER_C)
@mkdir -p ${BINDIR}
$(QQ)"$(MAKE)" -C $(RIOTPKG)/$(patsubst ${BINDIR}/%.a,%,$@)
clean:
2016-03-05 00:53:05 +01:00
-@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTPKG)/$$i clean ; done
-@rm -rf $(BINDIR)
-@rm -rf $(SCANBUILD_OUTPUTDIR)
# Remove intermediates, but keep the .elf, .hex and .map etc.
clean-intermediates:
-@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTPKG)/$$i distclean ; done
-@rm -rf $(BINDIR)/*.a $(BINDIR)/*/
clean-pkg:
-@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTPKG)/$$i distclean ; done
distclean:
2016-03-05 00:53:05 +01:00
-@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTPKG)/$$i distclean ; done
-@rm -rf $(BINDIRBASE)
flash: all $(FLASHDEPS)
@command -v $(FLASHER) >/dev/null 2>&1 || \
2015-02-22 19:36:36 +01:00
{ $(COLOR_ECHO) \
'${COLOR_RED}Flash program $(FLASHER) not found. Aborting.${COLOR_RESET}'; \
2015-02-22 19:36:36 +01:00
exit 1; }
$(FLASHER) $(FFLAGS)
preflash: all
$(PREFLASHER) $(PREFFLAGS)
term: $(filter flash, $(MAKECMDGOALS)) $(TERMDEPS)
@command -v $(TERMPROG) >/dev/null 2>&1 || \
2015-02-22 19:36:36 +01:00
{ $(COLOR_ECHO) \
'${COLOR_RED}Terminal program $(TERMPROG) not found. Aborting.${COLOR_RESET}'; \
2015-02-22 19:36:36 +01:00
exit 1; }
$(TERMPROG) $(TERMFLAGS)
list-ttys:
$(Q)$(RIOTBASE)/dist/tools/usb-serial/list-ttys.sh
doc:
make -BC $(RIOTBASE) doc
debug:
@command -v $(DEBUGGER) >/dev/null 2>&1 || \
2015-02-22 19:36:36 +01:00
{ $(COLOR_ECHO) \
'${COLOR_RED}Debug program $(DEBUGGER) not found. Aborting.${COLOR_RESET}'; \
2015-02-22 19:36:36 +01:00
exit 1; }
$(DEBUGGER) $(DEBUGGER_FLAGS)
debug-server:
@command -v $(DEBUGSERVER) >/dev/null 2>&1 || \
2015-02-22 19:36:36 +01:00
{ $(COLOR_ECHO) \
'${COLOR_RED}Debug server program $(DEBUGSERVER) not found. Aborting.${COLOR_RESET}'; \
2015-02-22 19:36:36 +01:00
exit 1; }
$(DEBUGSERVER) $(DEBUGSERVER_FLAGS)
reset:
@command -v $(RESET) >/dev/null 2>&1 || \
2015-02-22 19:36:36 +01:00
{ $(COLOR_ECHO) \
'${COLOR_RED}Reset program $(RESET) not found. Aborting.${COLOR_RESET}'; \
2015-02-22 19:36:36 +01:00
exit 1; }
$(RESET) $(RESET_FLAGS)
# Default OBJDUMPFLAGS for platforms which do not specify it:
OBJDUMPFLAGS ?= -S -D -h
2014-09-27 08:11:29 +02:00
objdump:
@command -v $(OBJDUMP) >/dev/null 2>&1 || \
2015-02-22 19:36:36 +01:00
{ $(COLOR_ECHO) \
'${COLOR_RED}Objdump program $(OBJDUMP) not found. Aborting.${COLOR_RESET}'; \
2015-02-22 19:36:36 +01:00
exit 1; }
$(OBJDUMP) $(OBJDUMPFLAGS) $(ELFFILE) | less
2014-09-27 08:11:29 +02:00
# Generate an XML file containing all macro definitions and include paths for
# use in Eclipse CDT
.PHONY: eclipsesym eclipsesym.xml $(CURDIR)/eclipsesym.xml
eclipsesym: $(CURDIR)/eclipsesym.xml
eclipsesym.xml: $(CURDIR)/eclipsesym.xml
$(CURDIR)/eclipsesym.xml:
$(Q)printf "%s\n" $(CC) $(CFLAGS_WITH_MACROS) $(INCLUDES) | \
$(RIOTBASE)/dist/tools/eclipsesym/cmdline2xml.sh > $@
# Extra make goals for testing and comparing changes.
include $(RIOTMAKE)/buildtests.inc.mk
# process provided features
include $(RIOTMAKE)/features.inc.mk
# Export variables used throughout the whole make system:
include $(RIOTMAKE)/vars.inc.mk
# Include build targets for selected tools after the default RIOT targets have
# been defined (-> so the `all` will be always the first target)
include $(RIOTMAKE)/tools/targets.inc.mk
2016-04-21 10:57:26 +02:00
# Warn if the selected board and drivers don't provide all needed features:
ifneq (, $(filter all, $(if $(MAKECMDGOALS), $(MAKECMDGOALS), all)))
EXPECT_ERRORS :=
EXPECT_CONFLICT :=
# Test if there where dependencies against a module in DISABLE_MODULE.
ifneq (, $(filter $(DISABLE_MODULE), $(USEMODULE)))
$(shell $(COLOR_ECHO) "$(COLOR_RED)Required modules were disabled using DISABLE_MODULE:$(COLOR_RESET)"\
"$(sort $(filter $(DISABLE_MODULE), $(USEMODULE)))" 1>&2)
USEMODULE := $(filter-out $(DISABLE_MODULE), $(USEMODULE))
EXPECT_ERRORS := 1
endif
# Test if all feature requirements were met by the selected board.
ifneq (, $(filter-out $(FEATURES_PROVIDED) $(FEATURES_OPTIONAL), $(FEATURES_REQUIRED)))
$(shell $(COLOR_ECHO) "$(COLOR_RED)There are unsatisfied feature requirements:$(COLOR_RESET)"\
"$(sort $(filter-out $(FEATURES_PROVIDED) $(FEATURES_OPTIONAL), $(FEATURES_REQUIRED)))" 1>&2)
EXPECT_ERRORS := 1
endif
# Test if any required feature conflict with another one.
CONFLICT := $(foreach var,$(FEATURES_CONFLICT),$(if $(filter $(words $(subst :, ,$(var))),$(words $(filter $(FEATURES_REQUIRED),$(subst :, ,$(var))))),$(subst :, ,$(var))))
ifneq (, $(strip $(CONFLICT)))
$(shell $(COLOR_ECHO) "$(COLOR_YELLOW)The following features may conflict:$(COLOR_RESET)"\
"$(COLOR_GREEN)$(sort $(filter $(FEATURES_REQUIRED), $(CONFLICT)))$(COLOR_RESET)" 1>&2)
ifneq (, $(FEATURES_CONFLICT_MSG))
$(shell $(COLOR_ECHO) "$(COLOR_YELLOW)Rationale: $(COLOR_RESET)$(FEATURES_CONFLICT_MSG)" 1>&2)
endif
EXPECT_CONFLICT := 1
endif
# If there is a whitelist, then test if the board is whitelisted.
ifneq (, $(BOARD_WHITELIST))
ifeq (, $(filter $(BOARD_WHITELIST), $(BOARD)))
$(shell $(COLOR_ECHO) "$(COLOR_RED)The selected BOARD=${BOARD} is not whitelisted:$(COLOR_RESET) ${BOARD_WHITELIST}" 1>&2)
EXPECT_ERRORS := 1
endif
endif
# If there is a blacklist, then test if the board is blacklisted.
ifneq (, $(BOARD_BLACKLIST))
ifneq (, $(filter $(BOARD_BLACKLIST), $(BOARD)))
$(shell $(COLOR_ECHO) "$(COLOR_RED)The selected BOARD=${BOARD} is blacklisted:$(COLOR_RESET) ${BOARD_BLACKLIST}" 1>&2)
EXPECT_ERRORS := 1
endif
endif
ifneq (, $(EXPECT_CONFLICT))
$(shell $(COLOR_ECHO) "\n$(COLOR_YELLOW)EXPECT undesired behaviour!$(COLOR_RESET)" 1>&2)
endif
ifneq (, $(EXPECT_ERRORS))
$(shell $(COLOR_ECHO) "\n\n$(COLOR_RED)EXPECT ERRORS!$(COLOR_RESET)\n\n" 1>&2)
endif
endif
2014-10-30 22:40:41 +01:00
else # RIOT_VERSION
export __RIOTBUILD_FLAG := RIOT
NUM_RIOT_VERSION := $(shell cd $(RIOTBASE) && git rev-parse --verify --short "$(RIOT_VERSION)" 2>/dev/null)
ifeq (, ${NUM_RIOT_VERSION})
$(error The supplied RIOT_VERSION=$(RIOT_VERSION) is invalid!)
endif
all $(filter-out clean, ${MAKECMDGOALS}): ..delegate
ifneq (, $(filter clean, $(MAKECMDGOALS)))
all $(filter-out clean, ${MAKECMDGOALS}): clean
endif
clean:
-$(Q)rm -rf $(BINDIR)
2014-10-30 22:40:41 +01:00
$(BINDIR)/riot-version/$(NUM_RIOT_VERSION)/Makefile.include:
$(Q)rm -rf $(@D)
$(Q)mkdir -p $(@D)
$(Q)cd $(RIOTBASE) && git archive --format=tar $(NUM_RIOT_VERSION) | ( cd $(@D) && tar x 1>&2 )
2014-10-30 22:40:41 +01:00
..delegate: $(BINDIR)/riot-version/$(NUM_RIOT_VERSION)/Makefile.include
2014-10-30 22:40:41 +01:00
@$(COLOR_ECHO) '$(COLOR_GREEN)Using RIOT_VERSION=${NUM_RIOT_VERSION}$(COLOR_RESET)' 1>&2
@$(COLOR_ECHO)
$(MAKE) RIOTBASE=$(<D) $(filter-out clean, ${MAKECMDGOALS})
endif
help:
@$(MAKE) -qp | sed -ne 's/\(^[a-z][a-z_-]*\):.*/\1/p' | sort | uniq
2015-08-21 16:10:57 +02:00
info-modules:
@for i in $(sort $(USEMODULE)); do echo $$i; done
2015-08-19 20:59:06 +02:00
ifneq (,$(filter iotlab-m3 wsn430-v1_3b wsn430-v1_4,$(BOARD)))
ifneq (,$(filter iotlab-%,$(MAKECMDGOALS)))
include $(RIOTBASE)/dist/testbed-support/Makefile.iotlab
endif
endif
2016-03-10 15:21:09 +01:00
# Include desvirt Makefile
include $(RIOTBASE)/dist/tools/desvirt/Makefile.desvirt
2015-01-27 17:25:16 +01:00
# include bindist target
include $(RIOTMAKE)/bindist.inc.mk
# Add all USEMODULE modules to CFLAGS
include $(RIOTMAKE)/modules.inc.mk
# Build a header file with all common macro definitions and undefinitions
# make it phony to force re-run of the script every time even if the file exists
# The script will only touch the file if anything has changed since last time.
.PHONY: $(RIOTBUILD_CONFIG_HEADER_C)
$(RIOTBUILD_CONFIG_HEADER_C):
@mkdir -p '$(dir $@)'
$(Q)'$(RIOTBASE)/dist/tools/genconfigheader/genconfigheader.sh' '$@' $(CFLAGS_WITH_MACROS)
CFLAGS_WITH_MACROS := $(CFLAGS)
ifneq (,$(RIOT_VERSION_OVERRIDE))
export CFLAGS_WITH_MACROS += -DRIOT_VERSION=\"$(RIOT_VERSION_OVERRIDE)\"
else
export CFLAGS_WITH_MACROS += -DRIOT_VERSION=\"$(RIOT_VERSION)\"
endif
CFLAGS := $(patsubst -D%,,$(CFLAGS))
CFLAGS := $(patsubst -U%,,$(CFLAGS))
CFLAGS += -include '$(RIOTBUILD_CONFIG_HEADER_C)'