Routino SVN Repository Browser

Check out the latest version of Routino: svn co http://routino.org/svn/trunk routino

ViewVC logotype

Contents of /branches/libroutino/src/xml/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1783 - (show annotations) (download)
Sat Aug 15 12:51:00 2015 UTC (9 years, 7 months ago) by amb
File size: 2944 byte(s)
Add '.exe' to the EXE targets to stop MinGW recompiling the
executables each time.

1 # XML test programs Makefile
2 #
3 # Part of the Routino routing software.
4 #
5 # This file Copyright 2010-2015 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 # All configuration is in the top-level Makefile.conf
22
23 include ../../Makefile.conf
24
25 # Compilation targets
26
27 XMLDIR=../../xml
28
29 X=$(notdir $(wildcard $(XMLDIR)/*.xsd))
30 C=$(foreach f,$(X),$(addsuffix -skeleton.c,$(basename $f)))
31 D=$(wildcard .deps/*.d)
32 O=$(foreach f,$(C),$(addsuffix .o,$(basename $f)))
33 E=$(foreach f,$(C),$(addsuffix $(.EXE),$(basename $f)))
34
35 EXE=xsd-to-xmlparser$(.EXE)
36
37 ########
38
39 all: $(EXE) $(C) $(E)
40
41 ########
42
43 xsd-to-xmlparser$(.EXE) : xsd-to-xmlparser.o ../xmlparse.o
44 $(LD) xsd-to-xmlparser.o ../xmlparse.o -o $@ $(LDFLAGS)
45
46 ########
47
48 %-skeleton.c : $(XMLDIR)/%.xsd xsd-to-xmlparser$(.EXE)
49 -./xsd-to-xmlparser < $< > $@
50 @test -s $@ || rm $@
51
52 %-skeleton$(.EXE) : %-skeleton.o ../xmlparse.o
53 $(LD) $< ../xmlparse.o -o $@ $(LDFLAGS)
54
55 .SECONDARY : $(O)
56
57 ########
58
59 ../xmlparse.o : ../xmlparse.c ../xmlparse.h
60 cd .. && $(MAKE) xmlparse.o
61
62 ########
63
64 %.o : %.c
65 @[ -d .deps ] || mkdir .deps
66 $(CC) -c $(CFLAGS) -I.. $< -o $@ -MMD -MP -MF $(addprefix .deps/,$(addsuffix .d,$(basename $@)))
67
68 ########
69
70 test: test-skeleton$(.EXE)
71 @status=true ;\
72 echo "" ;\
73 for good in test/good*.xml; do \
74 echo "Testing: $$good ... " ;\
75 if ./test-skeleton < $$good > /dev/null; then echo "... passed"; else echo "... FAILED"; status=false; fi ;\
76 echo "" ;\
77 done ;\
78 for bad in test/bad*.xml; do \
79 echo "Testing: $$bad ... " ;\
80 if ./test-skeleton < $$bad > /dev/null; then echo "... FAILED"; status=false; else echo "... passed"; fi ;\
81 echo "" ;\
82 done ;\
83 if $$status; then echo "Success: all tests passed"; else echo "Warning: Some tests FAILED"; fi ;\
84 $$status
85
86 test-skeleton$(.EXE) : test-skeleton.o
87 $(LD) $< ../xmlparse.o -o $@ $(LDFLAGS)
88
89 test-skeleton.c : test/test.xsd xsd-to-xmlparser$(.EXE)
90 ./xsd-to-xmlparser < $< | sed -e 's/XMLPARSE_UNKNOWN_ATTR_WARN/XMLPARSE_UNKNOWN_ATTR_ERROR/' > $@
91
92 ########
93
94 install:
95
96 ########
97
98 clean:
99 rm -f *~
100 rm -f *.o
101 rm -f $(EXE)
102 rm -f $(E) test-skeleton$(.EXE)
103 rm -f $(D) .deps/test-skeleton.d
104 rm -f $(C) test-skeleton.c
105 rm -fr .deps
106 rm -f core
107 rm -f *.gcda *.gcno *.gcov gmon.out
108
109 ########
110
111 distclean: clean
112
113 ########
114
115 include $(D)
116
117 ########
118
119 .PHONY:: all test install clean distclean

Properties

Name Value
cvs:description A Makefile for the XML utilities.