]> rtime.felk.cvut.cz Git - pes-rpp/rpp-test-sw.git/blob - Makefile
Add Makefile for command line compilation
[pes-rpp/rpp-test-sw.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-test-sw-workspace.XXXXXXXXXX)
10
11 all: rpp-test-sw
12         rm -rf $(WORKSPACE)
13
14 rpp-test-sw: $(WORKSPACE)
15         $(ECLIPSE) -noSplash -data $(WORKSPACE) -application com.ti.ccstudio.apps.projectImport -ccs.location $(CURDIR)/rpp-test-sw
16         $(ECLIPSE) -noSplash -data $(WORKSPACE) -application com.ti.ccstudio.apps.projectImport -ccs.location $(CURDIR)/rpp-lib
17         $(ECLIPSE) -noSplash -data $(WORKSPACE) -application com.ti.ccstudio.apps.projectBuild -ccs.projects rpp-test-sw
18 # Previous commands do not always return non-zero exit code on build failure - invoke make directly to not miss a potential error
19         $(MAKE) -C $(CURDIR)/rpp-test-sw/Debug all
20
21 clean:
22         rm -rf $(wildcard $(dir $(WORKSPACE))rpp-test-sw-workspace.*)
23
24 $(WORKSPACE):
25         mkdir -p $(WORKSPACE)
26
27 # Usage: $(call build_ccs,project directory) or
28 #        $(call build_ccs,,project name) for project in current directory
29 define build_ccs
30 all: $(or $2,$(notdir $1))
31 $(or $2,$(notdir $1)): $(WORKSPACE)
32         $(ECLIPSE) -noSplash -data $(WORKSPACE) -application com.ti.ccstudio.apps.projectImport -ccs.location $(if $1,$(CURDIR)/$1,$(CURDIR))
33         $(ECLIPSE) -noSplash -data $(WORKSPACE) -application com.ti.ccstudio.apps.projectBuild -ccs.projects $(or $2,$(notdir $1))
34 # Previous commands do not always return non-zero exit code on build failure - invoke make directly to not miss a potential error
35         $(MAKE) -C $(CURDIR)/$1/Debug all
36 endef
37
38 ccs-help: $(WORKSPACE)
39         $(ECLIPSE) -noSplash -data $(WORKSPACE) -application com.ti.ccstudio.apps.projectBuild -ccs.help