]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/commitdiff
Move common Makefile definition to a separate file
authorMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 7 Nov 2014 12:56:51 +0000 (13:56 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 7 Nov 2014 12:56:51 +0000 (13:56 +0100)
We want to use these definitions also in other project (e.g. rpp-test-sw).

Debug/GNUmakefile
Makefile.ccs
common.mk [new file with mode: 0644]

index c4d25233cd6ae0931da46c2a0e83c624222b6784..4ea2f31bb2a7ac43e4cce548a330b76fe96907c9 100644 (file)
@@ -6,15 +6,7 @@ CCS_UTILS_DIR ?= /opt/ti/ccsv5/utils
 
 ARM_COMPILER_DIR ?= $(dir $(CCS_UTILS_DIR))/tools/compiler/arm_5.1.1
 
-ifeq ($(OS),Windows_NT)
-mkdir=-mkdir $(subst /,\,$1)
-rm=-del $(subst /,\,$1)
-cp=copy $(subst /,\,$1) $(subst /,\,$2)
-else
-mkdir=mkdir -p $1
-rm=rm -rf $1
-cp=cp $1 $2
-endif
+include ../common.mk
 
 CC=$(ARM_COMPILER_DIR)/bin/armcl
 AR=$(ARM_COMPILER_DIR)/bin/armar
index 14136284a58a9ded153adc1974edf7892279463b..d303a77c6406d74d60cee68cd62d57bd151a4da8 100644 (file)
@@ -4,40 +4,15 @@
 # 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=$(foreach file,\
-                  /opt/ti/ccsv5/eclipse/eclipse \
-                  C:/ti/ccsv5/eclipse/eclipsec.exe,\
-            $(if $(wildcard $(file)),$(file)))
-
-ifeq ($(OS),Windows_NT)
-WORKSPACE=$(TEMP)/_workspace
-else
-WORKSPACE:=$(shell mktemp --dry-run --tmpdir -d rpp-test-sw-workspace.XXXXXXXXXX)
-endif
-
-
-ifeq ($(OS),Windows_NT)
-pathconv=$(subst /,\,$1)
-mkdir=-mkdir $(subst /,\,$1)
-rm=-del /Q $(call pathconv,$1)
-rmdir=-rmdir /S /Q $(call pathconv,$1)
-cp=copy $(subst /,\,$1) $(subst /,\,$2)
-else
-pathconv=$1
-mkdir=mkdir -p $1
-rm=rm -rf $1
-rmdir=-rm -rf $(call pathconv,$1)
-cp=cp $1 $2
-endif
+include common.mk
 
 all: lib
 
 lib:
-       $(call rmdir,$(WORKSPACE))
-       $(call mkdir,$(WORKSPACE))
-       $(ECLIPSE) -noSplash -data $(WORKSPACE) -application com.ti.ccstudio.apps.projectImport -ccs.location $(CURDIR)
-       $(ECLIPSE) -noSplash -data $(WORKSPACE) -application com.ti.ccstudio.apps.projectBuild -ccs.projects rpp-lib
+       $(call rmdir,$(TMP_WORKSPACE))
+       $(call mkdir,$(TMP_WORKSPACE))
+       $(ECLIPSE) -noSplash -data $(TMP_WORKSPACE) -application com.ti.ccstudio.apps.projectImport -ccs.location $(CURDIR)
+       $(ECLIPSE) -noSplash -data $(TMP_WORKSPACE) -application com.ti.ccstudio.apps.projectBuild -ccs.projects rpp-lib
 # Previous commands do not always return non-zero exit code on build failure - invoke make directly to not miss a potential error
        $(MAKE) -f Makefile lib
-       $(call rmdir,$(WORKSPACE))
+       $(call rmdir,$(TMP_WORKSPACE))
diff --git a/common.mk b/common.mk
new file mode 100644 (file)
index 0000000..ae420bd
--- /dev/null
+++ b/common.mk
@@ -0,0 +1,27 @@
+# Common GNU Make definitions useful for multiple Makefiles
+
+ECLIPSE=$(foreach file,\
+                  /opt/ti/ccsv5/eclipse/eclipse \
+                  C:/ti/ccsv5/eclipse/eclipsec.exe,\
+            $(if $(wildcard $(file)),$(file)))
+
+ifeq ($(OS),Windows_NT)
+TMP_WORKSPACE=$(TEMP)/_workspace
+else
+TMP_WORKSPACE:=$(shell mktemp --dry-run --tmpdir -d rpp-test-sw-workspace.XXXXXXXXXX)
+endif
+
+
+ifeq ($(OS),Windows_NT)
+pathconv=$(subst /,\,$1)
+mkdir=-mkdir $(subst /,\,$1)
+rm=-del /Q $(call pathconv,$1)
+rmdir=-rmdir /S /Q $(call pathconv,$1)
+cp=copy $(subst /,\,$1) $(subst /,\,$2)
+else
+pathconv=$1
+mkdir=mkdir -p $1
+rm=rm -rf $1
+rmdir=-rm -rf $1
+cp=cp $1 $2
+endif