2 # This makefile helps to build the examples. It tries to figure out if
\r
3 # it is an in-tree-build or if it is a seperate project (it's then invoked
\r
4 # from the top makefile)
\r
8 $(error EXAMPLENAME is not set. . This makefile is invoked the wrong way))
\r
12 $(error ROOTDIR is not set. This makefile is invoked the wrong way)
\r
15 ifeq (${MAKELEVEL},0)
\r
18 ifneq ($(BOARDDIR),)
\r
19 $(warning BOARDDIR defined in an in-tree-build)
\r
22 boardpath=$(realpath $(CURDIR)/../..)
\r
23 boarddir=$(subst $(realpath $(ROOTDIR)/boards)/,,$(boardpath))
\r
26 ifeq (${BUILD_IN_TREE},y)
\r
28 export example:=$(subst $(abspath $(CURDIR)/..)/,,$(CURDIR))
\r
32 @echo "==========[ Building \"$(example)\" ]=========="
\r
33 $(Q)$(MAKE) -C $(ROOTDIR) BOARDDIR=$(boarddir) BDIR=$(CURDIR) all
\r
36 @echo Cleaning dir $(boarddir)
\r
37 $(Q)rm -rf obj_$(boarddir)
\r
42 ifneq (${MAKELEVEL},0)
\r
45 VPATH += $(ROOTDIR)/examples
\r
48 ldcmdfile-y = linkscript_$(COMPILER).lcf
\r
49 vpath %.ldf $(ROOTDIR)/$(ARCH_PATH-y)/scripts
\r
51 # What I want to build
\r
52 build-exe-y = $(EXAMPLENAME).elf
\r