Debian Codegraph @

examples/Makefile

raw
1 # Make(1) rules for FleXML XML processor generator system.
2 # Copyright (c) 1999 Kristoffer Rose. All rights reserved.
3 #
4 # This file is part of the FleXML XML processor generator system.
5 # Copyright (c) 1999 Kristoffer Rose. All rights reserved.
6 #
7 # This program is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by the Free
9 # Software Foundation; either version 2 of the License, or (at your option)
10 # any later version.
11 #
12 # This program is distributed in the hope that it will be useful, but WITHOUT
13 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 # more details.
16 #
17 # You should have received a copy of the GNU General Public License along
18 # with this program; if not, write to the Free Software Foundation, Inc., 59
19 # Temple Place, Suite 330, Boston, MA 02111-1307 USA.
20
21 # $Id: Makefile,v 1.9 2006/09/29 19:40:46 wdowling Exp $
22
23 # FILES.
24
25 include ../Makefile.defs
26
27 # Test the version in this dir, not the installed one
28 SKEL=../skel
29 ACT=../flexml-act
30
31 SAMPS = my.dtd my-show.act my-joke.xml my-joke2.xml my-joke3.xml \
32 tricky.dtd tricky.act tricky.xml \
33 test.html xhtml1-transitional.dtd
34
35 SRC = $(SAMPS)
36 ALL = $(SAMPS)
37
38 .PHONY: all install dist test clean
39
40 # PRIMARY TARGETS.
41
42 start: test
43
44 all: $(ALL)
45
46 install: $(ALL)
47 mkdir -p $(DESTDIR)$(DOCDIR)/examples
48 $(INSTALL) -m444 $(SAMPS) $(DESTDIR)$(DOCDIR)/examples/
49
50 dist: clean
51 #rsync -v FleXML.html $(WEBHOME)/FleXML.html
52 #rsync -va --cvs-exclude --delete-excluded ./ $(FTPHOME)/
53
54 clean::; @echo "Cleaning examples..."
55 $(RM) *.[olh1] *-dummy.? lex.* *~ ./#*
56
57 test:: all
58 @echo "Testing..."
59
60
61 # DEFAULT RULES.
62 FLEXML_PROG = ../$(FLEXML) -s$(SKEL) -T$(ACT)
63
64 # Generate C source from flex scanner.
65 %.c: %.l
66 $(FLEX) -B -s -v $(FLEXDEBUG) -o$@ $<
67
68 # Direct generation of stand-alone XML processor+application.
69 # Note: The dependency must be of the form "appl.l: appl.act proc.dtd".
70 %.l: %.act
71 $(FLEXML_PROG) $(FLEXDEBUG) -vA -a $^
72
73 # Generate XML processor to link with application.
74 %.l %.h: %.dtd
75 $(FLEXML_PROG) $(FLEXDEBUG) -v $<
76
77 # Generate XML application C source to compile and link with processor.
78 # Note: The dependency must be of the form "appl.c: appl.act proc.dtd".
79 %.c: %.act
80 $(FLEXML_PROG) $(FLEXDEBUG) -vD -a $^
81
82
83 clean::; $(RM) flexml-act flexml-act.c
84
85 # Example: LINK processor with application:
86
87 my.l my.h: my.dtd
88 my.c: my.l
89 my.o: my.c my.h
90
91 my-show.c: my-show.act my.dtd
92 my-show.o: my-show.c my.h
93 my-show: my-show.o my.o
94
95 test:: my-show
96 @echo "XXXXX Test: LINK processor with application"
97 if ./my-show <my-joke.xml ; then echo "TEST PASSED"; else echo "TEST FAILED"; fi
98 if ./my-show <my-joke2.xml ; then echo "TEST PASSED"; else echo "TEST FAILED"; fi
99 if ./my-show <my-joke3.xml ; then echo "TEST FAILED"; else echo "TEST PASSED"; fi
100
101 clean::; $(RM) my.c my-show my-show.c my-dummy my-dummy.c
102
103 # Example: COMPILE processor into application
104
105 tricky.l: tricky.act tricky.dtd
106 tricky.c: tricky.l
107 tricky.o: tricky.c
108 tricky: tricky.o
109
110 test:: tricky
111 @echo "XXXXX Test: COMPILE processor with application"
112 if ./tricky <tricky.xml ; then echo "TEST PASSED"; else echo "TEST FAILED"; fi
113
114 clean::; $(RM) tricky.[lco] tricky
115
116 # Complex example: application to print XHTML <a href=...> values.
117
118 xhtml1-transitional.l xhtml1-transitional.h: xhtml1-transitional.dtd
119 $(FLEXML_PROG) -rhtml \
120 -p "-//IETF//DTD XHTML 1.0 Transitional//EN" \
121 -u "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" \
122 xhtml1-transitional.dtd
123
124 xhtml1-transitional.c: xhtml1-transitional.l
125 $(FLEX) -B -s -v -Ca -oxhtml1-transitional.c xhtml1-transitional.l
126
127 # turn off the -O2 when building this -- it takes too long to run
128 xhtml1-transitional.o: CFLAGS = -g
129
130 xhtml1-transitional.o: xhtml1-transitional.c xhtml1-transitional.h
131
132 xhtml-href.c: xhtml-href.act xhtml1-transitional.dtd
133 xhtml-href.o: xhtml-href.c xhtml1-transitional.h
134 xhtml-href: xhtml-href.o xhtml1-transitional.o
135
136 test:: xhtml-href FleXML.xml
137 @echo "XXXXX Test: application to print XHTML <a href=...> values"
138 if ./xhtml-href <test.html ; then echo "TEST PASSED"; else echo "TEST FAILED"; fi
139 if ./xhtml-href < FleXML.xml ; then echo "TEST PASSED"; else echo "TEST FAILED"; fi
140
141 clean::; $(RM) xhtml1-*.[lhco] xhtml-href.[co] xhtml-href
142
143 # END.
144
145 clean::; @echo "Done cleaning."
146 test::; @echo "Done testing."
147 test:: clean
148
149 .PHONEY : echov
150
151 # on command line say 'make v=foo echov' to see the value
152 # of the variable foo
153 echov:
154 @echo "$(subst ",\",$($(v)))"; #"# for emacs