]> rtime.felk.cvut.cz Git - pes-rpp/rpp-test-sw.git/blobdiff - Makefile
Update CCS project to somehow work
[pes-rpp/rpp-test-sw.git] / Makefile
index 6be686dbf6433418972b17cd84cda75764dafcf9..7481ccec5e9042820c1ecea38f320e4c16d0cb5c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,25 +4,70 @@
 # See http://processors.wiki.ti.com/index.php/Projects_-_Command_Line_Build/Create
 # and https://bugs.eclipse.org/bugs/show_bug.cgi?id=186847
 
-ECLIPSE=/opt/ti/ccsv5/eclipse/eclipse
-
-WORKSPACE:=$(shell mktemp --dry-run --tmpdir -d rpp-test-sw-workspace.XXXXXXXXXX)
+include rpp-lib/Makefile.var
 
 all: rpp-test-sw
-       rm -rf $(WORKSPACE)
+       $(call rmdir,$(TMP_WORKSPACE))
+
+RELEASE_PREFIX = rpp-test-sw
+include rpp-lib/common.mk
 
-rpp-test-sw: $(WORKSPACE)
-       $(ECLIPSE) -noSplash -data $(WORKSPACE) -application com.ti.ccstudio.apps.projectImport -ccs.location $(CURDIR)/rpp-test-sw
-       $(ECLIPSE) -noSplash -data $(WORKSPACE) -application com.ti.ccstudio.apps.projectImport -ccs.location $(CURDIR)/rpp-lib
-       $(ECLIPSE) -noSplash -data $(WORKSPACE) -application com.ti.ccstudio.apps.projectBuild -ccs.projects rpp-test-sw
+rpp-test-sw: $(TMP_WORKSPACE)
+       $(ECLIPSE) -noSplash -data $(TMP_WORKSPACE) -application com.ti.ccstudio.apps.projectImport -ccs.location $(CURDIR)/rpp-test-sw
+       $(ECLIPSE) -noSplash -data $(TMP_WORKSPACE) -application com.ti.ccstudio.apps.projectImport -ccs.location $(CURDIR)/rpp-lib/build/tms570_hdk
+       $(ECLIPSE) -noSplash -data $(TMP_WORKSPACE) -application com.ti.ccstudio.apps.projectBuild -ccs.projects rpp-test-sw
 # Previous commands do not always return non-zero exit code on build failure - invoke make directly to not miss a potential error
        $(MAKE) -C $(CURDIR)/rpp-test-sw/Debug all
 
+define RM_OLD_WORKSPACES
+$(foreach i,$(wildcard $(TMP_WORKSPACE) $(basename $(TMP_WORKSPACE)).*),$(call rmdir,$(i))
+)
+endef
+
 clean:
-       rm -rf $(wildcard $(dir $(WORKSPACE))rpp-test-sw-workspace.*)
+       -$(RM_OLD_WORKSPACES)
+
+$(TMP_WORKSPACE):
+       $(call mkdir,$(TMP_WORKSPACE))
+
+ccs-help: $(TMP_WORKSPACE)
+       $(ECLIPSE) -noSplash -data $(TMP_WORKSPACE) -application com.ti.ccstudio.apps.projectBuild -ccs.help
+       $(call rmdir,$(TMP_WORKSPACE))
+
+UNCRUSTIFY_FILES = $(shell git ls-files|git check-attr --stdin uncrustify|awk -F: '/uncrustify: set$$/ {print $$1}')
+define UNCRUSTIFY_ALL
+$(foreach i,$(UNCRUSTIFY_FILES),git show HEAD:$i | uncrustify -c rpp-lib/etc/uncrustify.cfg -o $i
+)
+endef
+
+# Usage: Run 'make uncrustify' and then 'git add -p' to commit the
+# changes you agree with.
+uncrustify:
+       git diff --quiet # Check that the tree is clean
+       $(UNCRUSTIFY_ALL)
+
+release: $(RELEASE_BASENAME).zip
+
+$(RELEASE_BASENAME):: lib
+       @echo 'Get version from git'
+       mkdir -p $@/rpp-test-sw/Debug
+       $(MAKE) -C $@/rpp-test-sw/Debug -f $(CURDIR)/rpp-test-sw/Makefile.version version.h
+
+       mkdir -p $@/rpp-lib/rpp/
+       mkdir -p $@/rpp-lib/os/$(rpp_lib_OS)
+ifneq ($(filter lwip/src/include,$(rpp_lib_INCLUDES)),)
+       mkdir -p $@/rpp-lib/lwip/src
+endif
+
+       cp --parents rpp-lib/rpp-lib.lib rpp-lib/common.mk $@/
+       cp --parents rpp-lib/.ccsproject rpp-lib/.cproject rpp-lib/.project $@/
+       cp -r rpp-lib/rpp/include $@/rpp-lib/rpp/include
+       cp rpp-lib/rpp/$(rpp_lib_$(TARGET)_LD_SCRIPT) $@/rpp-lib/rpp/$(rpp_lib_$(TARGET)_LD_SCRIPT)
+       cp -r rpp-lib/os/$(rpp_lib_OS)/include $@/rpp-lib/os/$(rpp_lib_OS)/include
+ifneq ($(filter lwip/src/include,$(rpp_lib_INCLUDES)),)
+       cp -r rpp-lib/lwip/src/include $@/rpp-lib/lwip/src/include
+endif
 
-$(WORKSPACE):
-       mkdir -p $(WORKSPACE)
 
-ccs-help: $(WORKSPACE)
-       $(ECLIPSE) -noSplash -data $(WORKSPACE) -application com.ti.ccstudio.apps.projectBuild -ccs.help
+lib:
+       $(MAKE) -C rpp-lib/Release