]> rtime.felk.cvut.cz Git - pes-rpp/rpp-test-sw.git/blob - Makefile
c48c42582af96b54c1c78be47801e5c5c9d07f7c
[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 include rpp-lib/Makefile.var
8
9 all: rpp-test-sw
10         $(call rmdir,$(TMP_WORKSPACE))
11
12 RELEASE_PREFIX = rpp-test-sw
13 include rpp-lib/common.mk
14
15 rpp-test-sw: $(TMP_WORKSPACE)
16         $(ECLIPSE) -noSplash -data $(TMP_WORKSPACE) -application com.ti.ccstudio.apps.projectImport -ccs.location $(CURDIR)/rpp-test-sw
17         $(ECLIPSE) -noSplash -data $(TMP_WORKSPACE) -application com.ti.ccstudio.apps.projectImport -ccs.location $(CURDIR)/rpp-lib/build/tms570_hdk
18         $(ECLIPSE) -noSplash -data $(TMP_WORKSPACE) -application com.ti.ccstudio.apps.projectBuild -ccs.projects rpp-test-sw
19 # Previous commands do not always return non-zero exit code on build failure - invoke make directly to not miss a potential error
20         $(MAKE) -C $(CURDIR)/rpp-test-sw/Debug all
21
22 define RM_OLD_WORKSPACES
23 $(foreach i,$(wildcard $(TMP_WORKSPACE) $(basename $(TMP_WORKSPACE)).*),$(call rmdir,$(i))
24 )
25 endef
26
27 clean:
28         -$(RM_OLD_WORKSPACES)
29
30 $(TMP_WORKSPACE):
31         $(call mkdir,$(TMP_WORKSPACE))
32
33 ccs-help: $(TMP_WORKSPACE)
34         $(ECLIPSE) -noSplash -data $(TMP_WORKSPACE) -application com.ti.ccstudio.apps.projectBuild -ccs.help
35         $(call rmdir,$(TMP_WORKSPACE))
36
37 UNCRUSTIFY_FILES = $(shell git ls-files|git check-attr --stdin uncrustify|awk -F: '/uncrustify: set$$/ {print $$1}')
38 define UNCRUSTIFY_ALL
39 $(foreach i,$(UNCRUSTIFY_FILES),git show HEAD:$i | uncrustify -c rpp-lib/etc/uncrustify.cfg -o $i
40 )
41 endef
42
43 # Usage: Run 'make uncrustify' and then 'git add -p' to commit the
44 # changes you agree with.
45 uncrustify:
46         git diff --quiet # Check that the tree is clean
47         $(UNCRUSTIFY_ALL)
48
49 release: $(RELEASE_BASENAME).zip
50
51 RELEASE_TARGET ?= tms570_hdk
52 include rpp-lib/build/$(RELEASE_TARGET)/Makefile.config
53
54 RELEASE_LIB_GIT_FILES = \
55         Makefile.var \
56         build/$(RELEASE_TARGET)/$(TARGET_LDCMD) \
57         build/Makefile.rules \
58         build/Makefile.rules.arm \
59         common.mk \
60         os/$(rpp_lib_OS)/include/ \
61         rpp/include/
62
63 ifneq ($(filter lwip/src/include,$(rpp_lib_INCLUDES)),)
64 RELEASE_LIB_GIT_FILES += lwip/src/include/
65 endif
66
67 RELEASE_LIB_GEN_FILES = Makefile.config build/$(RELEASE_TARGET)/Debug/rpp-lib.lib
68
69 $(RELEASE_BASENAME):: lib
70         @echo 'Generate version.h from git'
71         mkdir -p $@/rpp-test-sw/Debug
72         $(MAKE) -C $@/rpp-test-sw/Debug -f $(CURDIR)/rpp-test-sw/Makefile.version version.h
73
74         git --git-dir=rpp-lib/.git archive --worktree-attributes --prefix=$@/rpp-lib/ HEAD $(RELEASE_LIB_GIT_FILES) | tar xf -
75         cp --parents  $(RELEASE_LIB_GEN_FILES:%=rpp-lib/%) $@/
76
77 lib:
78         $(MAKE) -C rpp-lib/build/$(RELEASE_TARGET)/Debug