Check out the latest version of Routino: svn co http://routino.org/svn/trunk routino
Contents of /trunk/src/xml/Makefile
Parent Directory
|
Revision Log
Revision 859 -
(show annotations)
(download)
Wed Oct 5 18:02:37 2011 UTC (13 years, 6 months ago) by amb
File size: 3096 byte(s)
Wed Oct 5 18:02:37 2011 UTC (13 years, 6 months ago) by amb
File size: 3096 byte(s)
Add the gcc options for profiling (coverage) and delete the files generated by it.
1 | # XML test programs Makefile |
2 | # |
3 | # Part of the Routino routing software. |
4 | # |
5 | # This file Copyright 2010-2011 Andrew M. Bishop |
6 | # |
7 | # This program is free software: you can redistribute it and/or modify |
8 | # it under the terms of the GNU Affero General Public License as published by |
9 | # the Free Software Foundation, either version 3 of the License, or |
10 | # (at your option) any later version. |
11 | # |
12 | # This program is distributed in the hope that it will be useful, |
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | # GNU Affero General Public License for more details. |
16 | # |
17 | # You should have received a copy of the GNU Affero General Public License |
18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | # |
20 | |
21 | # Programs |
22 | |
23 | CC=gcc |
24 | LD=gcc |
25 | |
26 | # Program options |
27 | |
28 | CFLAGS=-Wall -Wmissing-prototypes -O0 -g |
29 | LDFLAGS=-lm -lc |
30 | |
31 | # Required to use stdio with files > 2GiB on 32-bit system. |
32 | |
33 | FLAGS64=-D_FILE_OFFSET_BITS=64 |
34 | |
35 | # Compilation targets |
36 | |
37 | XMLDIR=../../xml |
38 | |
39 | X=$(notdir $(wildcard $(XMLDIR)/*.xsd)) |
40 | C=$(foreach f,$(X),$(addsuffix -skeleton.c,$(basename $f))) |
41 | D=$(foreach f,$(C),$(addprefix .deps/,$(addsuffix .d,$(basename $f)))) |
42 | O=$(foreach f,$(C),$(addsuffix .o,$(basename $f))) |
43 | E=$(foreach f,$(C),$(basename $f)) |
44 | |
45 | EXE=xsd-to-xmlparser |
46 | |
47 | ######## |
48 | |
49 | all : $(EXE) $(C) $(E) |
50 | @true |
51 | |
52 | ######## |
53 | |
54 | xsd-to-xmlparser : xsd-to-xmlparser.o ../xmlparse.o |
55 | $(LD) xsd-to-xmlparser.o ../xmlparse.o -o $@ $(LDFLAGS) |
56 | |
57 | ######## |
58 | |
59 | %-skeleton.c : $(XMLDIR)/%.xsd xsd-to-xmlparser |
60 | -./xsd-to-xmlparser < $< > $@ |
61 | @test -s $@ || rm $@ |
62 | |
63 | %-skeleton : %-skeleton.o ../xmlparse.o |
64 | $(LD) $< ../xmlparse.o -o $@ $(LDFLAGS) |
65 | |
66 | .SECONDARY : $(O) |
67 | |
68 | ######## |
69 | |
70 | ../xmlparse.o : ../xmlparse.c ../xmlparse.h |
71 | cd .. && $(MAKE) xmlparse.o |
72 | |
73 | ../xmlparse.c : ../xmlparse.l |
74 | cd .. && $(MAKE) xmlparse.o |
75 | |
76 | ######## |
77 | |
78 | %.o : %.c |
79 | $(CC) -c $(CFLAGS) $(FLAGS64) -I.. $< -o $@ -MMD -MP -MF $(addprefix .deps/,$(addsuffix .d,$(basename $@))) |
80 | |
81 | ######## |
82 | |
83 | test : all test-skeleton .FORCE |
84 | @status=true ;\ |
85 | echo "" ;\ |
86 | for good in test/good*.xml; do \ |
87 | echo "Testing: $$good ... " ;\ |
88 | if ./test-skeleton < $$good > /dev/null; then echo "... passed"; else echo "... FAILED"; status=false; fi ;\ |
89 | echo "" ;\ |
90 | done ;\ |
91 | for bad in test/bad*.xml; do \ |
92 | echo "Testing: $$bad ... " ;\ |
93 | if ./test-skeleton < $$bad > /dev/null; then echo "... FAILED"; status=false; else echo "... passed"; fi ;\ |
94 | echo "" ;\ |
95 | done ;\ |
96 | if $$status; then echo "Success: all tests passed"; else echo "Warning: Some tests FAILED"; fi ;\ |
97 | $$status |
98 | |
99 | test-skeleton : test-skeleton.o |
100 | $(LD) $< ../xmlparse.o -o $@ $(LDFLAGS) |
101 | |
102 | test-skeleton.c : test/test.xsd xsd-to-xmlparser |
103 | ./xsd-to-xmlparser < $< | sed -e 's/XMLPARSE_UNKNOWN_ATTR_WARN/XMLPARSE_UNKNOWN_ATTR_ERROR/' > $@ |
104 | |
105 | ######## |
106 | |
107 | clean: |
108 | rm -f *.o |
109 | rm -f *~ |
110 | rm -f *.gcda *.gcno *.gcov gmon.out |
111 | |
112 | ######## |
113 | |
114 | distclean: clean |
115 | -rm -f $(EXE) |
116 | -rm -f $(E) test-skeleton |
117 | -rm -f $(D) .deps/test-skeleton.d |
118 | -rm -f $(C) test-skeleton.c |
119 | -rm -fr .deps |
120 | |
121 | ######## |
122 | |
123 | .deps : .FORCE |
124 | @[ -d .deps ] || mkdir $@ |
125 | |
126 | $(D) : .deps |
127 | @touch $@ |
128 | |
129 | include $(D) |
130 | |
131 | ######## |
132 | |
133 | .FORCE : |
Properties
Name | Value |
---|---|
cvs:description | A Makefile for the XML utilities. |