File: Makefile

package info (click to toggle)
flexml 1-5
  • links: PTS
  • area: main
  • in suites: potato, woody
  • size: 884 kB
  • ctags: 203
  • sloc: perl: 2,016; makefile: 160; ansic: 56; xml: 28
file content (220 lines) | stat: -rw-r--r-- 5,943 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# Make(1) rules for FleXML XML processor generator system.
# Copyright  1999 Kristoffer Rose.  All rights reserved.
#
# This file is part of the FleXML XML processor generator system.
# Copyright  1999 Kristoffer Rose.  All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc., 59
# Temple Place, Suite 330, Boston, MA 02111-1307 USA.

# $Id: Makefile,v 1.24 1999/12/09 16:48:35 krisrose Exp krisrose $

# FILES.

STUFF =	GPL Makefile flexml.pl FleXML.html
BINS =	flexml
LIBS =	flexml-act
DATA =	skel
MANS =	flexml.1
DOCS =	README flexml-act.dtd EnlargeFlex.patch
HTMLS =	index.html flexml.html paper.html
SAMPS =	my.dtd my-show.act my-joke.xml my-joke2.xml my-joke3.xml \
	tricky.dtd tricky.act tricky.xml \
	test.html

SRC =	$(STUFF) $(DATA) $(DOCS) $(HTMLS) $(SAMPS)
ALL =	$(PROGS) $(LIBS) $(DATA) $(MANS) $(DOCS) $(HTMLS) $(SAMPS)

# SETUP.

# Installation paths
USR = /usr
BINDIR = $(USR)/bin
LIBDIR = $(USR)/lib
SHARE = /usr/share
MAN1DIR = $(SHARE)/man/man1
DOCDIR = $(SHARE)/doc
DATADIR = $(SHARE)/flexml
TMPDIR = /var/tmp

# Permanent program locations
PERL = /usr/bin/perl
FLEX = /usr/bin/flex
FLEXML = $(BINDIR)/flexml
ACT = $(LIBDIR)/flexml-act
SKEL = $(DATADIR)/skel

# Build compilation setup.
CC = gcc -Wall -ansi -pedantic
CFLAGS = -O2 -g
#FLEXDEBUG = -d

# Web location.

WEBHOME = info:public_html
FTPHOME = info:public_html/ftp/FleXML

# PRIMARY TARGETS.

.PHONY:		all install dist test clean

all:		$(ALL)

install:	$(ALL)
	mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) \
		$(DESTDIR)$(MAN1DIR) $(DESTDIR)$(DOCDIR) \
		$(DESTDIR)$(DATADIR) \
		$(DESTDIR)$(DOCDIR)/flexml/html \
		$(DESTDIR)$(DOCDIR)/flexml/examples
	install -m555 $(BINS) $(DESTDIR)$(BINDIR)/
	install -m555 $(LIBS) $(DESTDIR)$(LIBDIR)/
	install -m444 $(DATA) $(DESTDIR)$(DATADIR)/
	install -m444 $(MANS) $(DESTDIR)$(MAN1DIR)/
	install -m444 $(DOCS) $(DESTDIR)$(DOCDIR)/flexml/
	install -m444 $(HTMLS) $(DESTDIR)$(DOCDIR)/flexml/html/
	install -m444 $(SAMPS) $(DESTDIR)$(DOCDIR)/flexml/examples/

dist:		clean
	rsync -v FleXML.html $(WEBHOME)/FleXML.html
	rsync -va --cvs-exclude --delete-excluded ./ $(FTPHOME)/

clean::; @echo "Cleaning..."
	$(RM) *.[olh1] *-dummy.? lex.* *~ ./#*
test::		all
	@echo "Testing..."

# DEFAULT RULES.

# Generate C source from flex scanner.
%.c: 		%.l
	$(FLEX) -Bsv $(FLEXDEBUG) -o$@ $<

# Direct generation of stand-alone XML processor+application.
# Note: The dependency must be of the form "appl.l: appl.act proc.dtd".
%.l:		%.act
	./flexml.pl $(FLEXDEBUG) -vA -a $^

# Generate XML processor to link with application.
%.l %.h:	%.dtd
	./flexml.pl $(FLEXDEBUG) -v -s skel $<

# Generate XML application C source to compile and link with processor.
# Note: The dependency must be of the form "appl.c: appl.act proc.dtd".
%.c:		%.act
	./flexml.pl $(FLEXDEBUG) -vD -a $^


# MAIN PROGRAM.

clean::; $(RM) flexml flexml-act flexml-act.c

flexml:		flexml.pl
	sed -e "s;^[#][!].*perl;#!$(PERL);" \
	    -e "s;[.][/]flexml-act;$(ACT);g" \
	    -e "s;[.][/]skel;$(SKEL);g" \
	    -e "s;/var/tmp;$(TMPDIR);g" \
	    -e "s;/usr/share/doc/;$(DOCDIR)/;g" flexml.pl >flexml
	chmod +x flexml

# Action language...
flexml-act.l:		flexml-act.dtd
	./flexml.pl $(FLEXDEBUG) -Lv -ractions -s skel $<

flexml-act.c:		flexml-act.l
	$(FLEX) -Bsv -oflexml-act.c flexml-act.l

flexml-act.o:		flexml-act.c flexml-act.h
flexml-act-bootstrap.o:	flexml-act-bootstrap.c flexml-act.h
flexml-act:		flexml-act.o flexml-act-bootstrap.o

clean::; $(RM) TAGS
TAGS: 	$(SRC);	etags $(SRC)
ci:	$(SRC);	ci -u $(SRC)

# DOCUMENTS.

clean::; $(RM) flexml.html index.html pod2html-*

flexml.1:	flexml
	pod2man flexml >flexml.1

flexml.html:	flexml
	pod2html <flexml >flexml.html

index.html:	FleXML.html
	sed 's.ftp/FleXML/..g' FleXML.html >index.html

# TESTS.

# Example: LINK processor with application:

my.l my.h:	my.dtd
my.c:		my.l
my.o:		my.c my.h

my-show.c:	my-show.act my.dtd
my-show.o:	my-show.c my.h
my-show:	my-show.o my.o

test::		my-show
	./my-show <my-joke.xml && echo OK
	./my-show <my-joke2.xml && echo OK
	./my-show <my-joke3.xml || echo OK

clean::; $(RM) my.c my-show my-show.c my-dummy my-dummy.c

# Example: COMPILE processor into application

tricky.l:	tricky.act tricky.dtd
tricky.c:	tricky.l
tricky.o:	tricky.c
tricky:		tricky.o

test::		tricky
	./tricky <tricky.xml

clean::; $(RM) tricky.[lco] tricky

# Complex example: application to print XHTML <a href=...> values.
# XHTML is big, so...we must use a patched flex (included in Debian).


xhtml1-transitional.dtd:
	wget 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'

xhtml1-transitional.l xhtml1-transitional.h: xhtml1-transitional.dtd
	./flexml.pl $(FLEXDEBUG) -sskel -rhtml \
		-p "-//W3C//DTD XHTML 1.0 Transitional//EN" \
		-u "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" \
		xhtml1-transitional.dtd

xhtml1-transitional.c:	xhtml1-transitional.l
	$(FLEX) -Bsv -Ca -oxhtml1-transitional.c xhtml1-transitional.l

xhtml1-transitional.o:	xhtml1-transitional.c xhtml1-transitional.h

xhtml-href.c:	xhtml-href.act xhtml1-transitional.dtd
xhtml-href.o:	xhtml-href.c xhtml1-transitional.h
xhtml-href:	xhtml-href.o xhtml1-transitional.o

test::		xhtml-href
	./xhtml-href <test.html
	./xhtml-href <FleXML.html

clean::; $(RM) xhtml1-*.dtd xhtml1-*.[lhco] xhtml-href.[co] xhtml-href

# END.

clean::; @echo "Done cleaning."
test::;	@echo "Done testing."