]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blob - Makefile
Move the main rpp-lib CCS project to the top-level directory
[pes-rpp/rpp-lib.git] / Makefile
1 # This makefile tries to build all RPP projects by calling various
2 # Eclipse commands from command line.
3 #
4 # See http://processors.wiki.ti.com/index.php/Projects_-_Command_Line_Build/Create
5 # and https://bugs.eclipse.org/bugs/show_bug.cgi?id=186847
6
7 ECLIPSE=/opt/ti/ccsv5/eclipse/eclipse
8
9 WORKSPACE:=$(shell mktemp --dry-run --tmpdir -d rpp-lib-workspace.XXXXXXXXXX)
10
11 all:
12         rm -rf $(WORKSPACE)
13
14 lib: rpp-lib.lib
15         rm -rf $(WORKSPACE)
16
17 clean:
18         rm -rf $(wildcard $(dir $(WORKSPACE))rpp-lib-workspace.*) rpp-lib.lib
19
20 rpp-lib.lib: $(shell find os rpp -name *.[ch])
21         $(MAKE) rpp-lib WORKSPACE=$(WORKSPACE)
22
23 $(WORKSPACE):
24         mkdir -p $(WORKSPACE)
25
26 define build_ccs
27 all: $(or $2,$(notdir $1))
28 $(or $2,$(notdir $1)): $(WORKSPACE)
29         $(ECLIPSE) -noSplash -data $(WORKSPACE) -application com.ti.ccstudio.apps.projectImport -ccs.location $(if $1,$(CURDIR)/$1,$(CURDIR))
30         $(ECLIPSE) -noSplash -data $(WORKSPACE) -application com.ti.ccstudio.apps.projectBuild -ccs.projects $(or $2,$(notdir $1))
31 # Previous commands do not return non-zero exit code on build failure - invoke make directly to not miss a potential error
32         $(MAKE) -C $(CURDIR)/$1/Debug all
33 endef
34
35 define build_cdt
36 all: $1
37 $1: $(WORKSPACE)
38         $(ECLIPSE) -noSplash -data $(WORKSPACE) -application org.eclipse.cdt.managedbuilder.core.headlessbuild -import $(CURDIR)/apps/$1
39         $(ECLIPSE) -noSplash -data $(WORKSPACE) -application org.eclipse.cdt.managedbuilder.core.headlessbuild -build $1
40 endef
41
42 $(eval $(call build_ccs,,rpp-lib))
43 $(eval $(call build_ccs,apps/rpp-test-suite))
44
45 $(eval $(call build_cdt,rpp-lib_posix))
46 $(eval $(call build_cdt,rpp-test-suite_posix))
47
48 ccs-help: $(WORKSPACE)
49         $(ECLIPSE) -noSplash -data $(WORKSPACE) -application com.ti.ccstudio.apps.projectBuild -ccs.help