Routino SVN Repository Browser

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

ViewVC logotype

Contents of /trunk/src/xml/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 366 - (show annotations) (download)
Mon Apr 12 17:33:52 2010 UTC (14 years, 11 months ago) by amb
File size: 2952 byte(s)
Change the last parameter to the ParseXML function to be general options.

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

Properties

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