]> git.cameronkatri.com Git - mandoc.git/blob - Makefile
Split the document parsing sequence out of main.c and into read.c,
[mandoc.git] / Makefile
1 .SUFFIXES: .html .xml .sgml .1 .3 .7 .md5 .tar.gz
2 .SUFFIXES: .1.txt .3.txt .7.txt
3 .SUFFIXES: .1.xhtml .3.xhtml .7.xhtml
4 .SUFFIXES: .1.sgml .3.sgml .7.sgml
5 .SUFFIXES: .h .h.html
6 .SUFFIXES: .1.ps .3.ps .7.ps
7 .SUFFIXES: .1.pdf .3.pdf .7.pdf
8
9 PREFIX = /usr/local
10 BINDIR = $(PREFIX)/bin
11 INCLUDEDIR = $(PREFIX)/include
12 LIBDIR = $(PREFIX)/lib
13 MANDIR = $(PREFIX)/man
14 EXAMPLEDIR = $(PREFIX)/share/examples/mandoc
15 INSTALL = install
16 INSTALL_PROGRAM = $(INSTALL) -m 0755
17 INSTALL_DATA = $(INSTALL) -m 0444
18 INSTALL_LIB = $(INSTALL) -m 0644
19 INSTALL_MAN = $(INSTALL_DATA)
20
21 VERSION = 1.10.10
22 VDATE = 20 March 2011
23
24 VFLAGS = -DVERSION="\"$(VERSION)\""
25 WFLAGS = -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings
26 CFLAGS += -g $(WFLAGS) $(VFLAGS) -DHAVE_CONFIG_H
27
28 # Specify this if you want to hard-code the operating system to appear
29 # in the lower-left hand corner of -mdoc manuals.
30 # CFLAGS += -DOSNAME="\"OpenBSD 4.5\""
31
32 LINTFLAGS += $(VFLAGS)
33
34 ROFFLNS = roff.ln tbl.ln tbl_opts.ln tbl_layout.ln tbl_data.ln eqn.ln
35
36 ROFFSRCS = roff.c tbl.c tbl_opts.c tbl_layout.c tbl_data.c eqn.c
37
38 ROFFOBJS = roff.o tbl.o tbl_opts.o tbl_layout.o tbl_data.o eqn.o
39
40 MANDOCLNS = mandoc.ln
41
42 MANDOCSRCS = mandoc.c
43
44 MANDOCOBJS = mandoc.o
45
46 MDOCLNS = mdoc_macro.ln mdoc.ln mdoc_hash.ln \
47 mdoc_argv.ln mdoc_validate.ln \
48 lib.ln att.ln arch.ln vol.ln msec.ln st.ln
49
50 MDOCOBJS = mdoc_macro.o mdoc.o mdoc_hash.o \
51 mdoc_argv.o mdoc_validate.o lib.o att.o \
52 arch.o vol.o msec.o st.o
53
54 MDOCSRCS = mdoc_macro.c mdoc.c mdoc_hash.c \
55 mdoc_argv.c mdoc_validate.c lib.c att.c \
56 arch.c vol.c msec.c st.c
57
58 MANLNS = man_macro.ln man.ln man_hash.ln man_validate.ln \
59 man_argv.ln
60
61 MANOBJS = man_macro.o man.o man_hash.o man_validate.o \
62 man_argv.o
63 MANSRCS = man_macro.c man.c man_hash.c man_validate.c \
64 man_argv.c
65
66 MAINLNS = main.ln mdoc_term.ln chars.ln term.ln tree.ln \
67 compat.ln man_term.ln html.ln mdoc_html.ln \
68 man_html.ln out.ln term_ps.ln term_ascii.ln \
69 tbl_term.ln tbl_html.ln read.ln
70
71 MAINOBJS = main.o mdoc_term.o chars.o term.o tree.o compat.o \
72 man_term.o html.o mdoc_html.o man_html.o out.o \
73 term_ps.o term_ascii.o tbl_term.o tbl_html.o read.o
74
75 MAINSRCS = main.c mdoc_term.c chars.c term.c tree.c compat.c \
76 man_term.c html.c mdoc_html.c man_html.c out.c \
77 term_ps.c term_ascii.c tbl_term.c tbl_html.c read.c
78
79 LLNS = llib-llibmdoc.ln llib-llibman.ln llib-lmandoc.ln \
80 llib-llibmandoc.ln llib-llibroff.ln
81
82 LNS = $(MAINLNS) $(MDOCLNS) $(MANLNS) \
83 $(MANDOCLNS) $(ROFFLNS)
84
85 LIBS = libmdoc.a libman.a libmandoc.a libroff.a
86
87 OBJS = $(MDOCOBJS) $(MAINOBJS) $(MANOBJS) \
88 $(MANDOCOBJS) $(ROFFOBJS)
89
90 SRCS = $(MDOCSRCS) $(MAINSRCS) $(MANSRCS) \
91 $(MANDOCSRCS) $(ROFFSRCS)
92
93 DATAS = arch.in att.in lib.in msec.in st.in \
94 vol.in chars.in
95
96 HEADS = mdoc.h libmdoc.h man.h libman.h term.h \
97 libmandoc.h html.h chars.h out.h main.h roff.h \
98 mandoc.h libroff.h
99
100 GSGMLS = mandoc.1.sgml mdoc.3.sgml mdoc.7.sgml \
101 mandoc_char.7.sgml man.7.sgml man.3.sgml roff.7.sgml \
102 roff.3.sgml tbl.7.sgml eqn.7.sgml
103
104 SGMLS = index.sgml
105
106 XHTMLS = mandoc.1.xhtml mdoc.3.xhtml \
107 man.3.xhtml mdoc.7.xhtml man.7.xhtml mandoc_char.7.xhtml \
108 roff.7.xhtml roff.3.xhtml tbl.7.xhtml eqn.7.xhtml
109
110 HTMLS = ChangeLog.html index.html man.h.html mdoc.h.html \
111 mandoc.h.html roff.h.html mandoc.1.html mdoc.3.html \
112 man.3.html mdoc.7.html man.7.html mandoc_char.7.html \
113 roff.7.html roff.3.html tbl.7.html eqn.7.html
114
115 PSS = mandoc.1.ps mdoc.3.ps man.3.ps mdoc.7.ps man.7.ps \
116 mandoc_char.7.ps roff.7.ps roff.3.ps tbl.7.ps eqn.7.ps
117
118 PDFS = mandoc.1.pdf mdoc.3.pdf man.3.pdf mdoc.7.pdf man.7.pdf \
119 mandoc_char.7.pdf roff.7.pdf roff.3.pdf tbl.7.pdf eqn.7.pdf
120
121 XSLS = ChangeLog.xsl
122
123 TEXTS = mandoc.1.txt mdoc.3.txt man.3.txt mdoc.7.txt man.7.txt \
124 mandoc_char.7.txt ChangeLog.txt \
125 roff.7.txt roff.3.txt tbl.7.txt eqn.7.txt
126
127 EXAMPLES = example.style.css
128
129 XMLS = ChangeLog.xml
130
131 STATICS = index.css style.css external.png
132
133 MD5S = mdocml-$(VERSION).md5
134
135 TARGZS = mdocml-$(VERSION).tar.gz
136
137 MANS = mandoc.1 mdoc.3 mdoc.7 mandoc_char.7 man.7 \
138 man.3 roff.7 roff.3 tbl.7 eqn.7
139
140 BINS = mandoc
141
142 TESTS = test-strlcat.c test-strlcpy.c
143
144 CONFIGS = config.h.pre config.h.post
145
146 DOCLEAN = $(BINS) $(LNS) $(LLNS) $(LIBS) $(OBJS) $(HTMLS) \
147 $(TARGZS) tags $(MD5S) $(XMLS) $(TEXTS) $(GSGMLS) \
148 config.h config.log $(PSS) $(PDFS) $(XHTMLS)
149
150 DOINSTALL = $(SRCS) $(HEADS) Makefile $(MANS) $(SGMLS) $(STATICS) \
151 $(DATAS) $(XSLS) $(EXAMPLES) $(TESTS) $(CONFIGS)
152
153 all: $(BINS)
154
155 lint: $(LLNS)
156
157 clean:
158 rm -f $(DOCLEAN)
159
160 dist: mdocml-$(VERSION).tar.gz
161
162 www: all $(GSGMLS) $(HTMLS) $(XHTMLS) $(TEXTS) $(MD5S) $(TARGZS) $(PSS) $(PDFS)
163
164 ps: $(PSS)
165
166 pdf: $(PDFS)
167
168 installwww: www
169 $(INSTALL_DATA) $(HTMLS) $(XHTMLS) $(PSS) $(PDFS) $(TEXTS) $(STATICS) $(DESTDIR)$(PREFIX)/
170 $(INSTALL_DATA) mdocml-$(VERSION).tar.gz $(DESTDIR)$(PREFIX)/snapshots/
171 $(INSTALL_DATA) mdocml-$(VERSION).md5 $(DESTDIR)$(PREFIX)/snapshots/
172 $(INSTALL_DATA) mdocml-$(VERSION).tar.gz $(DESTDIR)$(PREFIX)/snapshots/mdocml.tar.gz
173 $(INSTALL_DATA) mdocml-$(VERSION).md5 $(DESTDIR)$(PREFIX)/snapshots/mdocml.md5
174
175 install:
176 mkdir -p $(DESTDIR)$(BINDIR)
177 mkdir -p $(DESTDIR)$(EXAMPLEDIR)
178 mkdir -p $(DESTDIR)$(MANDIR)/man1
179 mkdir -p $(DESTDIR)$(MANDIR)/man7
180 $(INSTALL_PROGRAM) mandoc $(DESTDIR)$(BINDIR)
181 $(INSTALL_MAN) mandoc.1 $(DESTDIR)$(MANDIR)/man1
182 $(INSTALL_MAN) man.7 mdoc.7 roff.7 eqn.7 tbl.7 mandoc_char.7 $(DESTDIR)$(MANDIR)/man7
183 $(INSTALL_DATA) example.style.css $(DESTDIR)$(EXAMPLEDIR)
184
185 uninstall:
186 rm -f $(DESTDIR)$(BINDIR)/mandoc
187 rm -f $(DESTDIR)$(MANDIR)/man1/mandoc.1
188 rm -f $(DESTDIR)$(MANDIR)/man7/mdoc.7
189 rm -f $(DESTDIR)$(MANDIR)/man7/roff.7
190 rm -f $(DESTDIR)$(MANDIR)/man7/eqn.7
191 rm -f $(DESTDIR)$(MANDIR)/man7/tbl.7
192 rm -f $(DESTDIR)$(MANDIR)/man7/man.7
193 rm -f $(DESTDIR)$(MANDIR)/man7/mandoc_char.7
194 rm -f $(DESTDIR)$(EXAMPLEDIR)/example.style.css
195
196 $(OBJS): config.h
197
198 $(LNS): config.h
199
200 man_macro.ln man_macro.o: man_macro.c libman.h
201
202 lib.ln lib.o: lib.c lib.in libmdoc.h
203
204 att.ln att.o: att.c att.in libmdoc.h
205
206 arch.ln arch.o: arch.c arch.in libmdoc.h
207
208 vol.ln vol.o: vol.c vol.in libmdoc.h
209
210 chars.ln chars.o: chars.c chars.in chars.h
211
212 msec.ln msec.o: msec.c msec.in libmdoc.h
213
214 st.ln st.o: st.c st.in libmdoc.h
215
216 mdoc_macro.ln mdoc_macro.o: mdoc_macro.c libmdoc.h
217
218 mdoc_term.ln mdoc_term.o: mdoc_term.c term.h mdoc.h
219
220 man_hash.ln man_hash.o: man_hash.c libman.h
221
222 mdoc_hash.ln mdoc_hash.o: mdoc_hash.c libmdoc.h
223
224 mdoc.ln mdoc.o: mdoc.c libmdoc.h
225
226 man.ln man.o: man.c libman.h
227
228 main.ln main.o: main.c mdoc.h man.h roff.h
229
230 compat.ln compat.o: compat.c
231
232 term.ln term.o: term.c term.h man.h mdoc.h chars.h
233
234 term_ps.ln term_ps.o: term_ps.c term.h main.h
235
236 term_ascii.ln term_ascii.o: term_ascii.c term.h main.h
237
238 html.ln html.o: html.c html.h chars.h
239
240 mdoc_html.ln mdoc_html.o: mdoc_html.c html.h mdoc.h
241
242 man_html.ln man_html.o: man_html.c html.h man.h out.h
243
244 out.ln out.o: out.c out.h
245
246 mandoc.ln mandoc.o: mandoc.c libmandoc.h
247
248 tree.ln tree.o: tree.c man.h mdoc.h
249
250 mdoc_argv.ln mdoc_argv.o: mdoc_argv.c libmdoc.h
251
252 man_argv.ln man_argv.o: man_argv.c libman.h
253
254 man_validate.ln man_validate.o: man_validate.c libman.h
255
256 mdoc_validate.ln mdoc_validate.o: mdoc_validate.c libmdoc.h
257
258 libmdoc.h: mdoc.h
259
260 ChangeLog.xml:
261 cvs2cl --xml --xml-encoding iso-8859-15 -t --noxmlns -f $@
262
263 ChangeLog.txt:
264 cvs2cl -t -f $@
265
266 ChangeLog.html: ChangeLog.xml ChangeLog.xsl
267 xsltproc -o $@ ChangeLog.xsl ChangeLog.xml
268
269 mdocml-$(VERSION).tar.gz: $(DOINSTALL)
270 mkdir -p .dist/mdocml/mdocml-$(VERSION)/
271 cp -f $(DOINSTALL) .dist/mdocml/mdocml-$(VERSION)/
272 ( cd .dist/mdocml/ && tar zcf ../../$@ mdocml-$(VERSION)/ )
273 rm -rf .dist/
274
275 llib-llibmdoc.ln: $(MDOCLNS)
276 $(LINT) -Clibmdoc $(MDOCLNS)
277
278 llib-llibman.ln: $(MANLNS)
279 $(LINT) -Clibman $(MANLNS)
280
281 llib-llibmandoc.ln: $(MANDOCLNS)
282 $(LINT) -Clibmandoc $(MANDOCLNS)
283
284 llib-llibroff.ln: $(ROFFLNS)
285 $(LINT) -Clibroff $(ROFFLNS)
286
287 llib-lmandoc.ln: $(MAINLNS) llib-llibmdoc.ln llib-llibman.ln llib-llibmandoc.ln llib-llibroff.ln
288 $(LINT) -Cmandoc $(MAINLNS) llib-llibmdoc.ln llib-llibman.ln llib-llibmandoc.ln llib-llibroff.ln
289
290 libmdoc.a: $(MDOCOBJS)
291 $(AR) rs $@ $(MDOCOBJS)
292
293 libman.a: $(MANOBJS)
294 $(AR) rs $@ $(MANOBJS)
295
296 libmandoc.a: $(MANDOCOBJS)
297 $(AR) rs $@ $(MANDOCOBJS)
298
299 libroff.a: $(ROFFOBJS)
300 $(AR) rs $@ $(ROFFOBJS)
301
302 mandoc: $(MAINOBJS) libroff.a libmdoc.a libman.a libmandoc.a
303 $(CC) $(CFLAGS) -o $@ $(MAINOBJS) libroff.a libmdoc.a libman.a libmandoc.a
304
305 .sgml.html:
306 validate --warn $<
307 sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< > $@
308
309 .1.1.txt .3.3.txt .7.7.txt:
310 ./mandoc -Tascii -Wall,stop $< | col -b > $@
311
312 .1.1.sgml .3.3.sgml .7.7.sgml:
313 ./mandoc -Thtml -Wall,stop -Ostyle=style.css,man=%N.%S.html,includes=%I.html $< > $@
314
315 .1.1.ps .3.3.ps .7.7.ps:
316 ./mandoc -Tps -Wall,stop $< > $@
317
318 .1.1.xhtml .3.3.xhtml .7.7.xhtml:
319 ./mandoc -Txhtml -Wall,stop -Ostyle=style.css,man=%N.%S.xhtml,includes=%I.html $< > $@
320
321 .1.1.pdf .3.3.pdf .7.7.pdf:
322 ./mandoc -Tpdf -Wall,stop $< > $@
323
324 .tar.gz.md5:
325 md5 $< > $@
326
327 .h.h.html:
328 highlight -I $< >$@
329
330 config.h: config.h.pre config.h.post
331 rm -f config.log
332 ( cat config.h.pre; \
333 echo; \
334 if $(CC) $(CFLAGS) -Werror -o test-strlcat test-strlcat.c >> config.log 2>&1; then \
335 echo '#define HAVE_STRLCAT'; \
336 rm test-strlcat; \
337 fi; \
338 if $(CC) $(CFLAGS) -Werror -o test-strlcpy test-strlcpy.c >> config.log 2>&1; then \
339 echo '#define HAVE_STRLCPY'; \
340 rm test-strlcpy; \
341 fi; \
342 echo; \
343 cat config.h.post \
344 ) > $@