]> rtime.felk.cvut.cz Git - arc.git/blob - examples/build_example.mk
Cleanup before push...
[arc.git] / examples / build_example.mk
1 #\r
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
5 #\r
6 \r
7 ifndef EXAMPLENAME\r
8 $(error EXAMPLENAME is not set. . This makefile is invoked the wrong way))\r
9 endif\r
10 \r
11 ifndef ROOTDIR\r
12 $(error ROOTDIR is not set. This makefile is invoked the wrong way)\r
13 endif\r
14 \r
15 ifeq (${MAKELEVEL},0)\r
16 BUILD_IN_TREE=y\r
17 \r
18     ifneq ($(BOARDDIR),)\r
19     $(warning BOARDDIR defined in an in-tree-build)\r
20     endif\r
21 \r
22     boardpath=$(realpath $(CURDIR)/../..)\r
23     boarddir=$(subst $(realpath $(ROOTDIR)/boards)/,,$(boardpath))\r
24 endif\r
25 \r
26 ifeq (${BUILD_IN_TREE},y) \r
27 \r
28 export example:=$(subst $(abspath $(CURDIR)/..)/,,$(CURDIR))\r
29 \r
30 .PHONY: all clean\r
31 all:\r
32         @echo "==========[ Building \"$(example)\" ]=========="\r
33         $(Q)$(MAKE) -C $(ROOTDIR) BOARDDIR=$(boarddir) BDIR=$(CURDIR) all\r
34         \r
35 clean:  \r
36         @echo Cleaning dir $(boarddir) \r
37         $(Q)rm -rf obj_$(boarddir)\r
38         @echo done!\r
39 \r
40 endif\r
41 \r
42 ifneq (${MAKELEVEL},0)\r
43 \r
44 VPATH += ..\r
45 VPATH += $(ROOTDIR)/examples\r
46 inc-y += ..\r
47 \r
48 ldcmdfile-y = linkscript_$(COMPILER).lcf\r
49 vpath %.ldf $(ROOTDIR)/$(ARCH_PATH-y)/scripts\r
50         \r
51 # What I want to build\r
52 build-exe-y = $(EXAMPLENAME).elf\r
53 \r
54 endif\r
55 \r