]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blob - Makefile
Change license to MIT
[pes-rpp/rpp-lib.git] / Makefile
1 # Copyright (C) 2013-2015 Czech Technical University in Prague
2 #
3 # Authors:
4 #     - Michal Sojka <sojkam1@fel.cvut.cz>
5 #
6 # Permission is hereby granted, free of charge, to any person
7 # obtaining a copy of this software and associated documentation
8 # files (the "Software"), to deal in the Software without
9 # restriction, including without limitation the rights to use,
10 # copy, modify, merge, publish, distribute, sublicense, and/or sell
11 # copies of the Software, and to permit persons to whom the
12 # Software is furnished to do so, subject to the following
13 # conditions:
14
15 # The above copyright notice and this permission notice shall be
16 # included in all copies or substantial portions of the Software.
17
18 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 # OTHER DEALINGS IN THE SOFTWARE.
26 #
27 # File : Makefile
28 # Abstract:
29 #        This makefile tries to build all RPP projects in this repository.
30
31 TARGETS=$(sort $(notdir $(patsubst %/,%,$(dir $(wildcard build/*/Makefile.config)))))
32
33 SUBDIRS = $(foreach t,$(TARGETS),build/$(t)/Debug build/$(t)/apps/helloworld build/$(t)/apps/rpp-test-suite)
34
35 subdir-targets = $(SUBDIRS:%=subdir-%)
36
37 all: $(subdir-targets)
38
39 print-targets:
40         @echo "Building for targets: $(TARGETS)"
41
42 clean: $(subdir-targets)
43
44 lib: # Build only the library
45         $(MAKE) -C build/tms570_hydctr/Debug
46
47 doc: # Build API documentation (Doxygen)
48         $(MAKE) -C rpp/doc/api/
49
50 .PHONY: all clean lib
51
52 # Multiple submakes are invoked in the same directory - e.g.
53 # rpp-test-suite/Debug/GNUmakefile invokes Debug/GNUmakefile. We don't
54 # want these targets to be invoked twice so we forbid parallel
55 # invocation in this Makefile. Note that the submakes still run in
56 # parallel.
57 .NOTPARALLEL:
58
59 subdir-build/%: print-targets
60         $(MAKE) -C $(@:subdir-%=%) $(MAKECMDGOALS)
61
62
63 UNCRUSTIFY_FILES = $(shell etc/git-ls-files-attr uncrustify)
64 UNCRUSTIFY_CFG = etc/uncrustify.cfg
65 define UNCRUSTIFY_ALL
66 $(foreach i,$(UNCRUSTIFY_FILES),git show HEAD:$i | uncrustify -c $(UNCRUSTIFY_CFG) -o $i
67 )
68 endef
69
70 # Usage: Run 'make uncrustify' and then 'git add -p' to commit the
71 # changes you agree with.
72 uncrustify:
73         git diff --quiet # Check that the tree is clean
74         $(UNCRUSTIFY_ALL)
75
76
77 include common.mk
78
79 $(eval $(call release_rules,rpp-lib))
80 release: $(RELEASE_BASENAME).zip
81
82 $(RELEASE_BASENAME)::
83 # lwIP
84         git --git-dir=lwip/.git archive --prefix=$@/lwip/ $(RELEASE_COMMIT) | tar xf -
85 # API doc
86         rm -rf rpp/doc/api/html
87         $(MAKE) -C rpp/doc/api
88         mkdir -p $@/rpp/doc/api/html
89         cp -rT rpp/doc/api/html $@/rpp/doc/api/html