]> git.cameronkatri.com Git - mandoc.git/blob - Makefile
Clean up {mdoc,man}_pmsg and vmsg invocations (ignore return values).
[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.8
22 VDATE = 24 December 2010
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
35
36 ROFFSRCS = roff.c tbl.c tbl_opts.c tbl_layout.c tbl_data.c
37
38 ROFFOBJS = roff.o tbl.o tbl_opts.o tbl_layout.o tbl_data.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 mdoc_strings.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 mdoc_strings.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 mdoc_strings.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
70 MAINOBJS = main.o mdoc_term.o chars.o term.o tree.o compat.o \
71 man_term.o html.o mdoc_html.o man_html.o out.o \
72 term_ps.o term_ascii.o
73
74 MAINSRCS = main.c mdoc_term.c chars.c term.c tree.c compat.c \
75 man_term.c html.c mdoc_html.c man_html.c out.c \
76 term_ps.c term_ascii.c
77
78 LLNS = llib-llibmdoc.ln llib-llibman.ln llib-lmandoc.ln \
79 llib-llibmandoc.ln llib-llibroff.ln
80
81 LNS = $(MAINLNS) $(MDOCLNS) $(MANLNS) \
82 $(MANDOCLNS) $(ROFFLNS)
83
84 LIBS = libmdoc.a libman.a libmandoc.a libroff.a
85
86 OBJS = $(MDOCOBJS) $(MAINOBJS) $(MANOBJS) \
87 $(MANDOCOBJS) $(ROFFOBJS)
88
89 SRCS = $(MDOCSRCS) $(MAINSRCS) $(MANSRCS) \
90 $(MANDOCSRCS) $(ROFFSRCS)
91
92 DATAS = arch.in att.in lib.in msec.in st.in \
93 vol.in chars.in
94
95 HEADS = mdoc.h libmdoc.h man.h libman.h term.h \
96 libmandoc.h html.h chars.h out.h main.h roff.h \
97 mandoc.h libroff.h
98
99 GSGMLS = mandoc.1.sgml mdoc.3.sgml mdoc.7.sgml \
100 mandoc_char.7.sgml man.7.sgml man.3.sgml roff.7.sgml \
101 roff.3.sgml
102
103 SGMLS = index.sgml
104
105 XHTMLS = mandoc.1.xhtml mdoc.3.xhtml \
106 man.3.xhtml mdoc.7.xhtml man.7.xhtml mandoc_char.7.xhtml \
107 roff.7.xhtml roff.3.xhtml
108
109 HTMLS = ChangeLog.html index.html man.h.html mdoc.h.html \
110 mandoc.h.html roff.h.html mandoc.1.html mdoc.3.html \
111 man.3.html mdoc.7.html man.7.html mandoc_char.7.html \
112 roff.7.html roff.3.html
113
114 PSS = mandoc.1.ps mdoc.3.ps man.3.ps mdoc.7.ps man.7.ps \
115 mandoc_char.7.ps roff.7.ps roff.3.ps
116
117 PDFS = mandoc.1.pdf mdoc.3.pdf man.3.pdf mdoc.7.pdf man.7.pdf \
118 mandoc_char.7.pdf roff.7.pdf roff.3.pdf
119
120 XSLS = ChangeLog.xsl
121
122 TEXTS = mandoc.1.txt mdoc.3.txt man.3.txt mdoc.7.txt man.7.txt \
123 mandoc_char.7.txt ChangeLog.txt \
124 roff.7.txt roff.3.txt
125
126 EXAMPLES = example.style.css
127
128 XMLS = ChangeLog.xml
129
130 STATICS = index.css style.css external.png
131
132 MD5S = mdocml-$(VERSION).md5
133
134 TARGZS = mdocml-$(VERSION).tar.gz
135
136 MANS = mandoc.1 mdoc.3 mdoc.7 mandoc_char.7 man.7 \
137 man.3 roff.7 roff.3
138
139 BINS = mandoc
140
141 TESTS = test-strlcat.c test-strlcpy.c
142
143 CONFIGS = config.h.pre config.h.post
144
145 DOCLEAN = $(BINS) $(LNS) $(LLNS) $(LIBS) $(OBJS) $(HTMLS) \
146 $(TARGZS) tags $(MD5S) $(XMLS) $(TEXTS) $(GSGMLS) \
147 config.h config.log $(PSS) $(PDFS) $(XHTMLS)
148
149 DOINSTALL = $(SRCS) $(HEADS) Makefile $(MANS) $(SGMLS) $(STATICS) \
150 $(DATAS) $(XSLS) $(EXAMPLES) $(TESTS) $(CONFIGS)
151
152 all: $(BINS)
153
154 lint: $(LLNS)
155
156 clean:
157 rm -f $(DOCLEAN)
158
159 dist: mdocml-$(VERSION).tar.gz
160
161 www: all $(GSGMLS) $(HTMLS) $(XHTMLS) $(TEXTS) $(MD5S) $(TARGZS) $(PSS) $(PDFS)
162
163 ps: $(PSS)
164
165 pdf: $(PDFS)
166
167 installwww: www
168 $(INSTALL_DATA) $(HTMLS) $(XHTMLS) $(PSS) $(PDFS) $(TEXTS) $(STATICS) $(DESTDIR)$(PREFIX)/
169 $(INSTALL_DATA) mdocml-$(VERSION).tar.gz $(DESTDIR)$(PREFIX)/snapshots/
170 $(INSTALL_DATA) mdocml-$(VERSION).md5 $(DESTDIR)$(PREFIX)/snapshots/
171 $(INSTALL_DATA) mdocml-$(VERSION).tar.gz $(DESTDIR)$(PREFIX)/snapshots/mdocml.tar.gz
172 $(INSTALL_DATA) mdocml-$(VERSION).md5 $(DESTDIR)$(PREFIX)/snapshots/mdocml.md5
173
174 install:
175 mkdir -p $(DESTDIR)$(BINDIR)
176 mkdir -p $(DESTDIR)$(EXAMPLEDIR)
177 mkdir -p $(DESTDIR)$(MANDIR)/man1
178 mkdir -p $(DESTDIR)$(MANDIR)/man7
179 $(INSTALL_PROGRAM) mandoc $(DESTDIR)$(BINDIR)
180 $(INSTALL_MAN) mandoc.1 $(DESTDIR)$(MANDIR)/man1
181 $(INSTALL_MAN) man.7 mdoc.7 roff.7 mandoc_char.7 $(DESTDIR)$(MANDIR)/man7
182 $(INSTALL_DATA) example.style.css $(DESTDIR)$(EXAMPLEDIR)
183
184 uninstall:
185 rm -f $(DESTDIR)$(BINDIR)/mandoc
186 rm -f $(DESTDIR)$(MANDIR)/man1/mandoc.1
187 rm -f $(DESTDIR)$(MANDIR)/man7/mdoc.7
188 rm -f $(DESTDIR)$(MANDIR)/man7/roff.7
189 rm -f $(DESTDIR)$(MANDIR)/man7/man.7
190 rm -f $(DESTDIR)$(MANDIR)/man7/mandoc_char.7
191 rm -f $(DESTDIR)$(EXAMPLEDIR)/example.style.css
192
193 $(OBJS): config.h
194
195 $(LNS): config.h
196
197 man_macro.ln man_macro.o: man_macro.c libman.h
198
199 lib.ln lib.o: lib.c lib.in libmdoc.h
200
201 att.ln att.o: att.c att.in libmdoc.h
202
203 arch.ln arch.o: arch.c arch.in libmdoc.h
204
205 vol.ln vol.o: vol.c vol.in libmdoc.h
206
207 chars.ln chars.o: chars.c chars.in chars.h
208
209 msec.ln msec.o: msec.c msec.in libmdoc.h
210
211 st.ln st.o: st.c st.in libmdoc.h
212
213 mdoc_macro.ln mdoc_macro.o: mdoc_macro.c libmdoc.h
214
215 mdoc_term.ln mdoc_term.o: mdoc_term.c term.h mdoc.h
216
217 mdoc_strings.ln mdoc_strings.o: mdoc_strings.c libmdoc.h
218
219 man_hash.ln man_hash.o: man_hash.c libman.h
220
221 mdoc_hash.ln mdoc_hash.o: mdoc_hash.c libmdoc.h
222
223 mdoc.ln mdoc.o: mdoc.c libmdoc.h
224
225 man.ln man.o: man.c libman.h
226
227 main.ln main.o: main.c mdoc.h man.h roff.h
228
229 compat.ln compat.o: compat.c
230
231 term.ln term.o: term.c term.h man.h mdoc.h chars.h
232
233 term_ps.ln term_ps.o: term_ps.c term.h main.h
234
235 term_ascii.ln term_ascii.o: term_ascii.c term.h main.h
236
237 html.ln html.o: html.c html.h chars.h
238
239 mdoc_html.ln mdoc_html.o: mdoc_html.c html.h mdoc.h
240
241 man_html.ln man_html.o: man_html.c html.h man.h out.h
242
243 out.ln out.o: out.c out.h
244
245 mandoc.ln mandoc.o: mandoc.c libmandoc.h
246
247 tree.ln tree.o: tree.c man.h mdoc.h
248
249 mdoc_argv.ln mdoc_argv.o: mdoc_argv.c libmdoc.h
250
251 man_argv.ln man_argv.o: man_argv.c libman.h
252
253 man_validate.ln man_validate.o: man_validate.c libman.h
254
255 mdoc_validate.ln mdoc_validate.o: mdoc_validate.c libmdoc.h
256
257 libmdoc.h: mdoc.h
258
259 ChangeLog.xml:
260 cvs2cl --xml --xml-encoding iso-8859-15 -t --noxmlns -f $@
261
262 ChangeLog.txt:
263 cvs2cl -t -f $@
264
265 ChangeLog.html: ChangeLog.xml ChangeLog.xsl
266 xsltproc -o $@ ChangeLog.xsl ChangeLog.xml
267
268 mdocml-$(VERSION).tar.gz: $(DOINSTALL)
269 mkdir -p .dist/mdocml/mdocml-$(VERSION)/
270 cp -f $(DOINSTALL) .dist/mdocml/mdocml-$(VERSION)/
271 ( cd .dist/mdocml/ && tar zcf ../../$@ mdocml-$(VERSION)/ )
272 rm -rf .dist/
273
274 llib-llibmdoc.ln: $(MDOCLNS)
275 $(LINT) -Clibmdoc $(MDOCLNS)
276
277 llib-llibman.ln: $(MANLNS)
278 $(LINT) -Clibman $(MANLNS)
279
280 llib-llibmandoc.ln: $(MANDOCLNS)
281 $(LINT) -Clibmandoc $(MANDOCLNS)
282
283 llib-llibroff.ln: $(ROFFLNS)
284 $(LINT) -Clibroff $(ROFFLNS)
285
286 llib-lmandoc.ln: $(MAINLNS) llib-llibmdoc.ln llib-llibman.ln llib-llibmandoc.ln llib-llibroff.ln
287 $(LINT) -Cmandoc $(MAINLNS) llib-llibmdoc.ln llib-llibman.ln llib-llibmandoc.ln llib-llibroff.ln
288
289 libmdoc.a: $(MDOCOBJS)
290 $(AR) rs $@ $(MDOCOBJS)
291
292 libman.a: $(MANOBJS)
293 $(AR) rs $@ $(MANOBJS)
294
295 libmandoc.a: $(MANDOCOBJS)
296 $(AR) rs $@ $(MANDOCOBJS)
297
298 libroff.a: $(ROFFOBJS)
299 $(AR) rs $@ $(ROFFOBJS)
300
301 mandoc: $(MAINOBJS) libroff.a libmdoc.a libman.a libmandoc.a
302 $(CC) $(CFLAGS) -o $@ $(MAINOBJS) libroff.a libmdoc.a libman.a libmandoc.a
303
304 .sgml.html:
305 validate --warn $<
306 sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< > $@
307
308 .1.1.txt .3.3.txt .7.7.txt:
309 ./mandoc -Tascii -Wall,stop $< | col -b > $@
310
311 .1.1.sgml .3.3.sgml .7.7.sgml:
312 ./mandoc -Thtml -Wall,stop -Ostyle=style.css,man=%N.%S.html,includes=%I.html $< > $@
313
314 .1.1.ps .3.3.ps .7.7.ps:
315 ./mandoc -Tps -Wall,stop $< > $@
316
317 .1.1.xhtml .3.3.xhtml .7.7.xhtml:
318 ./mandoc -Txhtml -Wall,stop -Ostyle=style.css,man=%N.%S.xhtml,includes=%I.html $< > $@
319
320 .1.1.pdf .3.3.pdf .7.7.pdf:
321 ./mandoc -Tpdf -Wall,stop $< > $@
322
323 .tar.gz.md5:
324 md5 $< > $@
325
326 .h.h.html:
327 highlight -I $< >$@
328
329 config.h: config.h.pre config.h.post
330 rm -f config.log
331 ( cat config.h.pre; \
332 echo; \
333 if $(CC) $(CFLAGS) -Werror -c test-strlcat.c >> config.log 2>&1; then \
334 echo '#define HAVE_STRLCAT'; \
335 rm test-strlcat.o; \
336 fi; \
337 if $(CC) $(CFLAGS) -Werror -c test-strlcpy.c >> config.log 2>&1; then \
338 echo '#define HAVE_STRLCPY'; \
339 rm test-strlcpy.o; \
340 fi; \
341 echo; \
342 cat config.h.post \
343 ) > $@