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