]> git.cameronkatri.com Git - mandoc.git/blob - Makefile
Added argv regression tests.
[mandoc.git] / Makefile
1 .SUFFIXES: .html .sgml
2
3 VERSION = 1.3.18
4 VDATE = 04 March 2009
5
6 BINDIR = $(PREFIX)/bin
7 INCLUDEDIR = $(PREFIX)/include
8 LIBDIR = $(PREFIX)/lib
9 MANDIR = $(PREFIX)/man
10
11 INSTALL_PROGRAM = install -m 0755
12 INSTALL_DATA = install -m 0444
13 INSTALL_LIB = install -m 0644
14 INSTALL_MAN = $(INSTALL_DATA)
15
16 CFLAGS += -W -Wall -Wstrict-prototypes -Wno-unused-parameter -g
17
18 LIBLNS = macro.ln mdoc.ln hash.ln strings.ln xstd.ln argv.ln \
19 validate.ln action.ln
20
21 TREELNS = mdoctree.ln mmain.ln
22
23 TERMLNS = mdoctree.ln mmain.ln term.ln
24
25 LINTLNS = mdoclint.ln mmain.ln
26
27 LNS = $(LIBLNS) $(TREELNS) $(TERMLNS)
28
29 LLNS = llib-llibmdoc.ln llib-lmdoctree.ln llib-lmdocterm.ln
30
31 LIBS = libmdoc.a
32
33 LIBOBJS = macro.o mdoc.o hash.o strings.o xstd.o argv.o \
34 validate.o action.o
35
36 TERMOBJS= mdocterm.o mmain.o term.o
37
38 TREEOBJS= mdoctree.o mmain.o
39
40 LINTOBJS= mdoclint.o mmain.o
41
42 OBJS = $(LIBOBJS) $(TERMOBJS) $(TREEOBJS)
43
44 SRCS = macro.c mdoc.c hash.c strings.c xstd.c argv.c validate.c \
45 action.c term.c mdoctree.c mdocterm.c mmain.c mdoclint.c
46
47 HEADS = mdoc.h private.h term.h mmain.h
48
49 SGMLS = index.sgml
50
51 HTMLS = index.html
52
53 STATICS = style.css external.png
54
55 TARGZS = mdocml-$(VERSION).tar.gz mdocml-oport-$(VERSION).tar.gz \
56 mdocml-nport-$(VERSION).tar.gz
57
58 MANS = mdoctree.1 mdocterm.1 mdoclint.1 mdoc.3
59
60 BINS = mdocterm mdoctree mdoclint
61
62 CLEAN = $(BINS) $(LNS) $(LLNS) $(LIBS) $(OBJS) $(HTMLS) \
63 $(TARGZS)
64
65 INSTALL = $(SRCS) $(HEADS) Makefile DESCR $(MANS) $(SGMLS) \
66 $(STATICS) Makefile.netbsd Makefile.openbsd
67
68 FAIL = regress/test.empty \
69 regress/test.prologue.00 \
70 regress/test.prologue.01 \
71 regress/test.prologue.02 \
72 regress/test.prologue.03 \
73 regress/test.prologue.04 \
74 regress/test.prologue.06 \
75 regress/test.prologue.13 \
76 regress/test.prologue.15 \
77 regress/test.prologue.16 \
78 regress/test.prologue.18 \
79 regress/test.prologue.19 \
80 regress/test.prologue.21 \
81 regress/test.prologue.22 \
82 regress/test.prologue.23 \
83 regress/test.prologue.24 \
84 regress/test.prologue.25 \
85 regress/test.prologue.26 \
86 regress/test.prologue.27 \
87 regress/test.prologue.28 \
88 regress/test.prologue.29 \
89 regress/test.prologue.30 \
90 regress/test.prologue.31 \
91 regress/test.prologue.32 \
92 regress/test.prologue.33 \
93 regress/test.sh.03 \
94 regress/test.escape.01 \
95 regress/test.escape.02 \
96 regress/test.escape.03 \
97 regress/test.escape.04 \
98 regress/test.escape.06 \
99 regress/test.escape.07 \
100 regress/test.escape.08 \
101 regress/test.escape.09 \
102 regress/test.escape.11 \
103 regress/test.escape.12 \
104 regress/test.escape.14 \
105 regress/test.argv.01
106
107 SUCCEED = regress/test.prologue.05 \
108 regress/test.prologue.07 \
109 regress/test.prologue.08 \
110 regress/test.prologue.09 \
111 regress/test.prologue.10 \
112 regress/test.prologue.11 \
113 regress/test.prologue.12 \
114 regress/test.prologue.14 \
115 regress/test.prologue.17 \
116 regress/test.prologue.20 \
117 regress/test.sh.00 \
118 regress/test.name.00 \
119 regress/test.name.01 \
120 regress/test.name.02 \
121 regress/test.name.03 \
122 regress/test.list.00 \
123 regress/test.list.01 \
124 regress/test.list.02 \
125 regress/test.list.03 \
126 regress/test.list.04 \
127 regress/test.list.05 \
128 regress/test.list.06 \
129 regress/test.list.07 \
130 regress/test.sh.01 \
131 regress/test.sh.02 \
132 regress/test.escape.00 \
133 regress/test.escape.05 \
134 regress/test.escape.10 \
135 regress/test.escape.13 \
136 regress/test.argv.00
137
138 REGRESS = $(FAIL) $(SUCCEED)
139
140 all: $(BINS)
141
142 lint: $(LLNS)
143
144 clean:
145 rm -f $(CLEAN)
146
147 cleanlint:
148 rm -f $(LNS) $(LLNS)
149
150 dist: mdocml-$(VERSION).tar.gz
151
152 port: mdocml-oport-$(VERSION).tar.gz mdocml-nport-$(VERSION).tar.gz
153
154 www: $(HTMLS) $(TARGZS)
155
156 installwww: www
157 install -m 0444 $(HTMLS) $(STATICS) $(PREFIX)/
158 install -m 0444 mdocml-$(VERSION).tar.gz $(PREFIX)/snapshots/
159 install -m 0444 mdocml-$(VERSION).tar.gz $(PREFIX)/snapshots/mdocml.tar.gz
160 install -m 0444 mdocml-oport-$(VERSION).tar.gz $(PREFIX)/ports-openbsd/
161 install -m 0444 mdocml-oport-$(VERSION).tar.gz $(PREFIX)/ports-openbsd/mdocml.tar.gz
162 install -m 0444 mdocml-nport-$(VERSION).tar.gz $(PREFIX)/ports-netbsd/
163 install -m 0444 mdocml-nport-$(VERSION).tar.gz $(PREFIX)/ports-netbsd/mdocml.tar.gz
164
165 regress: mdoclint
166 @for f in $(FAIL); do \
167 echo "./mdoclint $$f" ; \
168 ./mdoclint $$f 2>/dev/null || continue ; exit 1 ; done
169 @for f in $(SUCCEED); do \
170 echo "./mdoclint $$f" ; \
171 ./mdoclint $$f 2>/dev/null || exit 1 ; done
172
173 install:
174 mkdir -p $(BINDIR)
175 mkdir -p $(INCLUDEDIR)
176 mkdir -p $(LIBDIR)/lib
177 mkdir -p $(MANDIR)/man1
178 mkdir -p $(MANDIR)/man3
179 $(INSTALL_PROGRAM) mdocterm $(BINDIR)
180 $(INSTALL_PROGRAM) mdoctree $(BINDIR)
181 $(INSTALL_PROGRAM) mdoclint $(BINDIR)
182 $(INSTALL_MAN) mdocterm.1 $(MANDIR)/man1
183 $(INSTALL_MAN) mdoctree.1 $(MANDIR)/man1
184 $(INSTALL_MAN) mdoclint.1 $(MANDIR)/man1
185 $(INSTALL_MAN) mdoc.3 $(MANDIR)/man3
186 $(INSTALL_LIB) libmdoc.a $(LIBDIR)
187 $(INSTALL_DATA) mdoc.h $(INCLUDEDIR)
188
189 uninstall:
190 rm -f $(BINDIR)/mdocterm
191 rm -f $(BINDIR)/mdoctree
192 rm -f $(BINDIR)/mdoclint
193 rm -f $(MANDIR)/man1/mdocterm.1
194 rm -f $(MANDIR)/man1/mdoctree.1
195 rm -f $(MANDIR)/man1/mdoclint.1
196 rm -f $(MANDIR)/man3/mdoc.3
197 rm -f $(LIBDIR)/libmdoc.a
198 rm -f $(INCLUDEDIR)/mdoc.h
199
200 macro.ln: macro.c private.h
201 macro.o: macro.c private.h
202
203 term.ln: term.c term.h
204 term.o: term.c term.h
205
206 strings.ln: strings.c private.h
207 strings.o: strings.c private.h
208
209 hash.ln: hash.c private.h
210 hash.o: hash.c private.h
211
212 mdoc.ln: mdoc.c private.h
213 mdoc.o: mdoc.c private.h
214
215 mdocterm.ln: mdocterm.c mmain.h
216 mdocterm.o: mdocterm.c mmain.h
217
218 mdoclint.ln: mdoclint.c mmain.h
219 mdoclint.o: mdoclint.c mmain.h
220
221 mdoctree.ln: mdoctree.c mmain.h
222 mdoctree.o: mdoctree.c mmain.h
223
224 xstd.ln: xstd.c private.h
225 xstd.o: xstd.c private.h
226
227 argv.ln: argv.c private.h
228 argv.o: argv.c private.h
229
230 validate.ln: validate.c private.h
231 validate.o: validate.c private.h
232
233 action.ln: action.c private.h
234 action.o: action.c private.h
235
236 mmain.ln: mmain.c mmain.h
237 mmain.o: mmain.c mmain.h
238
239 private.h: mdoc.h
240
241 mmain.h: mdoc.h
242
243 term.h: mdoc.h
244
245 mdocml-nport-$(VERSION).tar.gz: mdocml-$(VERSION).tar.gz Makefile.netbsd DESCR
246 mkdir -p .dist/mdocml/
247 sed -e "s!@VERSION@!$(VERSION)!" Makefile.netbsd > \
248 .dist/mdocml/Makefile
249 md5 mdocml-$(VERSION).tar.gz > .dist/mdocml/distinfo
250 rmd160 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
251 sha1 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
252 install -m 0644 DESCR .dist/mdocml/
253 echo @comment $$NetBSD$$ > .dist/mdocml/PLIST
254 echo bin/mdocterm >> .dist/mdocml/PLIST
255 echo bin/mdoctree >> .dist/mdocml/PLIST
256 echo bin/mdoclint >> .dist/mdocml/PLIST
257 echo lib/libmdoc.a >> .dist/mdocml/PLIST
258 echo include/mdoc.h >> .dist/mdocml/PLIST
259 echo man/man1/mdoctree.1 >> .dist/mdocml/PLIST
260 echo man/man1/mdocterm.1 >> .dist/mdocml/PLIST
261 echo man/man1/mdoclint.1 >> .dist/mdocml/PLIST
262 echo man/man3/mdoc.3 >> .dist/mdocml/PLIST
263 ( cd .dist/ && tar zcf ../$@ mdocml/ )
264 rm -rf .dist/
265
266 mdocml-oport-$(VERSION).tar.gz: mdocml-$(VERSION).tar.gz Makefile.openbsd DESCR
267 mkdir -p .dist/mdocml/pkg
268 sed -e "s!@VERSION@!$(VERSION)!" Makefile.openbsd > \
269 .dist/mdocml/Makefile
270 md5 mdocml-$(VERSION).tar.gz > .dist/mdocml/distinfo
271 rmd160 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
272 sha1 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
273 install -m 0644 DESCR .dist/mdocml/pkg/DESCR
274 echo @comment $$OpenBSD$$ > .dist/mdocml/pkg/PLIST
275 echo bin/mdocterm >> .dist/mdocml/pkg/PLIST
276 echo bin/mdoctree >> .dist/mdocml/pkg/PLIST
277 echo bin/mdoclint >> .dist/mdocml/pkg/PLIST
278 echo lib/libmdoc.a >> .dist/mdocml/pkg/PLIST
279 echo include/mdoc.h >> .dist/mdocml/pkg/PLIST
280 echo @man man/man1/mdoctree.1 >> .dist/mdocml/pkg/PLIST
281 echo @man man/man1/mdocterm.1 >> .dist/mdocml/pkg/PLIST
282 echo @man man/man1/mdoclint.1 >> .dist/mdocml/pkg/PLIST
283 echo @man man/man3/mdoc.3 >> .dist/mdocml/pkg/PLIST
284 ( cd .dist/ && tar zcf ../$@ mdocml/ )
285 rm -rf .dist/
286
287 mdocml-$(VERSION).tar.gz: $(INSTALL)
288 mkdir -p .dist/mdocml/mdocml-$(VERSION)/
289 mkdir -p .dist/mdocml/mdocml-$(VERSION)/regress/
290 install -m 0644 $(INSTALL) .dist/mdocml/mdocml-$(VERSION)/
291 install -m 0644 $(REGRESS) .dist/mdocml/mdocml-$(VERSION)/regress/
292 ( cd .dist/mdocml/ && tar zcf ../../$@ mdocml-$(VERSION)/ )
293 rm -rf .dist/
294
295 llib-llibmdoc.ln: $(LIBLNS)
296 $(LINT) $(LINTFLAGS) -Clibmdoc $(LIBLNS)
297
298 llib-lmdoctree.ln: $(TREELNS) llib-llibmdoc.ln
299 $(LINT) $(LINTFLAGS) -Cmdoctree $(TREELNS) llib-llibmdoc.ln
300
301 llib-lmdocterm.ln: $(TERMLNS) llib-llibmdoc.ln
302 $(LINT) $(LINTFLAGS) -Cmdocterm $(TERMLNS) llib-llibmdoc.ln
303
304 libmdoc.a: $(LIBOBJS)
305 $(AR) rs $@ $(LIBOBJS)
306
307 mdocterm: $(TERMOBJS) libmdoc.a
308 $(CC) $(CFLAGS) -o $@ $(TERMOBJS) libmdoc.a
309
310 mdoctree: $(TREEOBJS) libmdoc.a
311 $(CC) $(CFLAGS) -o $@ $(TREEOBJS) libmdoc.a
312
313 mdoclint: $(LINTOBJS) libmdoc.a
314 $(CC) $(CFLAGS) -o $@ $(LINTOBJS) libmdoc.a
315
316 .sgml.html:
317 validate $<
318 sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< > $@
319