]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blobdiff - Makefile
Add target specific pinmux for TMS570_HYDCTR
[pes-rpp/rpp-lib.git] / Makefile
index b339a345324eaebbc85f86a61e111d93dd5b125a..62551c761948f6fbbc88653bfea78352c4aa5b7a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,49 +1,73 @@
-# This makefile tries to build all RPP projects by calling various
-# Eclipse commands from command line.
+# Copyright (C) 2013-2015 Czech Technical University in Prague
 #
-# See http://processors.wiki.ti.com/index.php/Projects_-_Command_Line_Build/Create
-# and https://bugs.eclipse.org/bugs/show_bug.cgi?id=186847
+# Authors:
+#     - Michal Sojka <sojkam1@fel.cvut.cz>
+#
+# This document contains proprietary information belonging to Czech
+# Technical University in Prague. Passing on and copying of this
+# document, and communication of its contents is not permitted
+# without prior written authorization.
+#
+# File : Makefile
+# Abstract:
+#       This makefile tries to build all RPP projects in this repository.
 
-ECLIPSE=/opt/ti/ccsv5/eclipse/eclipse
+TARGETS=$(sort $(notdir $(patsubst %/,%,$(dir $(wildcard build/*/Makefile.config)))))
 
-WORKSPACE:=$(shell mktemp --dry-run --tmpdir -d rpp-lib-workspace.XXXXXXXXXX)
+SUBDIRS = $(foreach t,$(TARGETS),build/$(t)/Debug build/$(t)/apps/helloworld build/$(t)/apps/rpp-test-suite)
 
-all:
-       rm -rf $(WORKSPACE)
+subdir-targets = $(SUBDIRS:%=subdir-%)
 
-lib: rpp-lib.lib
-       rm -rf $(WORKSPACE)
+all: $(subdir-targets)
 
-clean:
-       rm -rf $(wildcard $(dir $(WORKSPACE))rpp-lib-workspace.*) rpp-lib.lib
+print-targets:
+       @echo "Building for targets: $(TARGETS)"
 
-rpp-lib.lib: $(shell find os rpp -name *.[ch])
-       $(MAKE) rpp-lib WORKSPACE=$(WORKSPACE)
+clean: $(subdir-targets)
 
-$(WORKSPACE):
-       mkdir -p $(WORKSPACE)
+lib: # Build only the library
+       $(MAKE) -C build/tms570_hydctr/Debug
 
-define build_ccs
-all: $(or $2,$(notdir $1))
-$(or $2,$(notdir $1)): $(WORKSPACE)
-       $(ECLIPSE) -noSplash -data $(WORKSPACE) -application com.ti.ccstudio.apps.projectImport -ccs.location $(if $1,$(CURDIR)/$1,$(CURDIR))
-       $(ECLIPSE) -noSplash -data $(WORKSPACE) -application com.ti.ccstudio.apps.projectBuild -ccs.projects $(or $2,$(notdir $1))
-# Previous commands do not return non-zero exit code on build failure - invoke make directly to not miss a potential error
-       $(MAKE) -C $(CURDIR)/$1/Debug all
-endef
+doc: # Build API documentation (Doxygen)
+       $(MAKE) -C rpp/doc/api/
+
+.PHONY: all clean lib
+
+# Multiple submakes are invoked in the same directory - e.g.
+# rpp-test-suite/Debug/GNUmakefile invokes Debug/GNUmakefile. We don't
+# want these targets to be invoked twice so we forbid parallel
+# invocation in this Makefile. Note that the submakes still run in
+# parallel.
+.NOTPARALLEL:
 
-define build_cdt
-all: $1
-$1: $(WORKSPACE)
-       $(ECLIPSE) -noSplash -data $(WORKSPACE) -application org.eclipse.cdt.managedbuilder.core.headlessbuild -import $(CURDIR)/apps/$1
-       $(ECLIPSE) -noSplash -data $(WORKSPACE) -application org.eclipse.cdt.managedbuilder.core.headlessbuild -build $1
+subdir-build/%: print-targets
+       $(MAKE) -C $(@:subdir-%=%) $(MAKECMDGOALS)
+
+
+UNCRUSTIFY_FILES = $(shell git ls-files|git check-attr --stdin uncrustify|awk -F: '/uncrustify: set$$/ {print $$1}')
+UNCRUSTIFY_CFG = etc/uncrustify.cfg
+define UNCRUSTIFY_ALL
+$(foreach i,$(UNCRUSTIFY_FILES),git show HEAD:$i | uncrustify -c $(UNCRUSTIFY_CFG) -o $i
+)
 endef
 
-$(eval $(call build_ccs,,rpp-lib))
-$(eval $(call build_ccs,apps/rpp-test-suite))
+# 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)
+
+
+include common.mk
 
-$(eval $(call build_cdt,rpp-lib_posix))
-$(eval $(call build_cdt,rpp-test-suite_posix))
+$(eval $(call release_rules,rpp-lib))
+release: $(RELEASE_BASENAME).zip
 
-ccs-help: $(WORKSPACE)
-       $(ECLIPSE) -noSplash -data $(WORKSPACE) -application com.ti.ccstudio.apps.projectBuild -ccs.help
+$(RELEASE_BASENAME)::
+# lwIP
+       git --git-dir=lwip/.git archive --prefix=$@/lwip/ $(RELEASE_COMMIT) | tar xf -
+# API doc
+       rm -rf rpp/doc/api/html
+       $(MAKE) -C rpp/doc/api
+       mkdir -p $@/rpp/doc/api/html
+       cp -rT rpp/doc/api/html $@/rpp/doc/api/html