1 # $Header: /home/amb/routino/src/xml/RCS/Makefile,v 1.10 2010/07/07 17:26:24 amb Exp $
3 # XML test programs Makefile
5 # Part of the Routino routing software.
7 # This file Copyright 2010 Andrew M. Bishop
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.
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.
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/>.
30 CFLAGS=-Wall -Wmissing-prototypes -O0 -g
33 # Required to use stdio with files > 2GiB on 32-bit system.
35 FLAGS64=-D_FILE_OFFSET_BITS=64
41 X=$(notdir $(wildcard $(XMLDIR)/*.xsd))
42 C=$(foreach f,$(X),$(addsuffix -skeleton.c,$(basename $f)))
43 D=$(foreach f,$(C),$(addprefix .deps/,$(addsuffix .d,$(basename $f))))
44 O=$(foreach f,$(C),$(addsuffix .o,$(basename $f)))
45 E=$(foreach f,$(C),$(basename $f))
51 all : $(EXE) $(C) $(E)
56 xsd-to-xmlparser : xsd-to-xmlparser.o ../xmlparse.o
57 $(LD) xsd-to-xmlparser.o ../xmlparse.o -o $@ $(LDFLAGS)
61 %-skeleton.c : $(XMLDIR)/%.xsd xsd-to-xmlparser
62 -./xsd-to-xmlparser < $< > $@
65 %-skeleton : %-skeleton.o ../xmlparse.o
66 $(LD) $< ../xmlparse.o -o $@ $(LDFLAGS)
72 ../xmlparse.o : ../xmlparse.c ../xmlparse.h
73 cd .. && $(MAKE) xmlparse.o
75 ../xmlparse.c : ../xmlparse.l
76 cd .. && $(MAKE) xmlparse.o
81 $(CC) -c $(CFLAGS) $(FLAGS64) -I.. $< -o $@ -MMD -MP -MF $(addprefix .deps/,$(addsuffix .d,$(basename $<)))
85 test : all test-skeleton .FORCE
88 for good in test/good*.xml; do \
89 echo "Testing: $$good ... " ;\
90 if ./test-skeleton < $$good > /dev/null; then echo "... passed"; else echo "... FAILED"; status=false; fi ;\
93 for bad in test/bad*.xml; do \
94 echo "Testing: $$bad ... " ;\
95 if ./test-skeleton < $$bad > /dev/null; then echo "... FAILED"; status=false; else echo "... passed"; fi ;\
98 if $$status; then echo "Success: all tests passed"; else echo "Warning: Some tests FAILED"; fi ;\
101 test-skeleton : test-skeleton.o
102 $(LD) $< ../xmlparse.o -o $@ $(LDFLAGS)
104 test-skeleton.c : test/test.xsd xsd-to-xmlparser
105 ./xsd-to-xmlparser < $< | sed -e 's/XMLPARSE_UNKNOWN_ATTR_WARN/XMLPARSE_UNKNOWN_ATTR_ERROR/' > $@
117 -rm -f $(E) test-skeleton
118 -rm -f $(D) .deps/test-skeleton.d
119 -rm -f $(C) test-skeleton.c
125 @[ -d .deps ] || mkdir $@