]> git.cameronkatri.com Git - mandoc.git/blob - Makefile
Flip on equation printing for -T[x]html.
[mandoc.git] / Makefile
1 .PHONY: clean install installwww
2 .SUFFIXES: .sgml .html .md5 .h .h.html
3 .SUFFIXES: .1 .3 .7 .8
4 .SUFFIXES: .1.txt .3.txt .7.txt .8.txt
5 .SUFFIXES: .1.pdf .3.pdf .7.pdf .8.pdf
6 .SUFFIXES: .1.ps .3.ps .7.ps .8.ps
7 .SUFFIXES: .1.html .3.html .7.html .8.html
8 .SUFFIXES: .1.xhtml .3.xhtml .7.xhtml .8.xhtml
9
10 # Specify this if you want to hard-code the operating system to appear
11 # in the lower-left hand corner of -mdoc manuals.
12 # CFLAGS += -DOSNAME="\"OpenBSD 4.5\""
13
14 VERSION = 1.11.4
15 VDATE = 12 July 2011
16 # IFF your system supports multi-byte functions (setlocale(), wcwidth(),
17 # putwchar()) AND has __STDC_ISO_10646__ (that is, wchar_t is simply a
18 # UCS-4 value) should you define USE_WCHAR. If you define it and your
19 # system DOESN'T support this, -Tlocale will produce garbage.
20 # If you don't define it, -Tlocale is a synonym for -Tacsii.
21 CFLAGS += -g -DUSE_WCHAR -DHAVE_CONFIG_H -DVERSION="\"$(VERSION)\""
22 CFLAGS += -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings
23 PREFIX = /usr/local
24 BINDIR = $(PREFIX)/bin
25 INCLUDEDIR = $(PREFIX)/include/mandoc
26 LIBDIR = $(PREFIX)/lib/mandoc
27 MANDIR = $(PREFIX)/man
28 EXAMPLEDIR = $(PREFIX)/share/examples/mandoc
29 INSTALL = install
30 INSTALL_PROGRAM = $(INSTALL) -m 0755
31 INSTALL_DATA = $(INSTALL) -m 0444
32 INSTALL_LIB = $(INSTALL) -m 0644
33 INSTALL_SOURCE = $(INSTALL) -m 0644
34 INSTALL_MAN = $(INSTALL_DATA)
35
36 # Linux needs -ldb to compile mandocdb.
37 #DBLIB = -ldb
38
39 all: mandoc preconv
40
41 SRCS = Makefile \
42 arch.c \
43 arch.in \
44 att.c \
45 att.in \
46 chars.c \
47 chars.in \
48 compat.c \
49 config.h.post \
50 config.h.pre \
51 eqn.7 \
52 eqn.c \
53 eqn_html.c \
54 eqn_term.c \
55 example.style.css \
56 external.png \
57 html.c \
58 html.h \
59 index.css \
60 index.sgml \
61 lib.c \
62 lib.in \
63 libman.h \
64 libmandoc.h \
65 libmdoc.h \
66 libroff.h \
67 main.c \
68 main.h \
69 man.h \
70 man.7 \
71 man.c \
72 man_hash.c \
73 man_html.c \
74 man_macro.c \
75 man_term.c \
76 man_validate.c \
77 mandoc.1 \
78 mandoc.3 \
79 mandoc.c \
80 mandoc.h \
81 mandocdb.8 \
82 mandocdb.c \
83 mandoc_char.7 \
84 mdoc.h \
85 mdoc.7 \
86 mdoc.c \
87 mdoc_argv.c \
88 mdoc_hash.c \
89 mdoc_html.c \
90 mdoc_macro.c \
91 mdoc_term.c \
92 mdoc_validate.c \
93 msec.c \
94 msec.in \
95 out.c \
96 out.h \
97 preconv.1 \
98 preconv.c \
99 predefs.in \
100 read.c \
101 roff.7 \
102 roff.c \
103 st.c \
104 st.in \
105 style.css \
106 tbl.7 \
107 tbl.c \
108 tbl_data.c \
109 tbl_html.c \
110 tbl_layout.c \
111 tbl_opts.c \
112 tbl_term.c \
113 term.c \
114 term.h \
115 term_ascii.c \
116 term_ps.c \
117 test-mmap.c \
118 test-strlcat.c \
119 test-strlcpy.c \
120 tree.c \
121 vol.c \
122 vol.in
123
124 LIBMAN_OBJS = man.o \
125 man_hash.o \
126 man_macro.o \
127 man_validate.o
128 LIBMAN_LNS = man.ln \
129 man_hash.ln \
130 man_macro.ln \
131 man_validate.ln
132
133 LIBMDOC_OBJS = arch.o \
134 att.o \
135 lib.o \
136 mdoc.o \
137 mdoc_argv.o \
138 mdoc_hash.o \
139 mdoc_macro.o \
140 mdoc_validate.o \
141 msec.o \
142 st.o \
143 vol.o
144 LIBMDOC_LNS = arch.ln \
145 att.ln \
146 lib.ln \
147 mdoc.ln \
148 mdoc_argv.ln \
149 mdoc_hash.ln \
150 mdoc_macro.ln \
151 mdoc_validate.ln \
152 msec.ln \
153 st.ln \
154 vol.ln
155
156 LIBROFF_OBJS = eqn.o \
157 roff.o \
158 tbl.o \
159 tbl_data.o \
160 tbl_layout.o \
161 tbl_opts.o
162 LIBROFF_LNS = eqn.ln \
163 roff.ln \
164 tbl.ln \
165 tbl_data.ln \
166 tbl_layout.ln \
167 tbl_opts.ln
168
169 LIBMANDOC_OBJS = $(LIBMAN_OBJS) \
170 $(LIBMDOC_OBJS) \
171 $(LIBROFF_OBJS) \
172 chars.o \
173 mandoc.o \
174 read.o
175 LIBMANDOC_LNS = $(LIBMAN_LNS) \
176 $(LIBMDOC_LNS) \
177 $(LIBROFF_LNS) \
178 chars.ln \
179 mandoc.ln \
180 read.ln
181
182 arch.o arch.ln: arch.in
183 att.o att.ln: att.in
184 chars.o chars.ln: chars.in
185 lib.o lib.ln: lib.in
186 msec.o msec.ln: msec.in
187 roff.o roff.ln: predefs.in
188 st.o st.ln: st.in
189 vol.o vol.ln: vol.in
190
191 $(LIBMAN_OBJS) $(LIBMAN_LNS): libman.h
192 $(LIBMDOC_OBJS) $(LIBMDOC_LNS): libmdoc.h
193 $(LIBROFF_OBJS) $(LIBROFF_LNS): libroff.h
194 $(LIBMANDOC_OBJS) $(LIBMANDOC_LNS): mandoc.h mdoc.h man.h libmandoc.h config.h
195
196 MANDOC_HTML_OBJS = eqn_html.o \
197 html.o \
198 man_html.o \
199 mdoc_html.o \
200 tbl_html.o
201 MANDOC_HTML_LNS = eqn_html.ln \
202 html.ln \
203 man_html.ln \
204 mdoc_html.ln \
205 tbl_html.ln
206
207 MANDOC_TERM_OBJS = eqn_term.o \
208 man_term.o \
209 mdoc_term.o \
210 term.o \
211 term_ascii.o \
212 term_ps.o \
213 tbl_term.o
214 MANDOC_TERM_LNS = eqn_term.ln \
215 man_term.ln \
216 mdoc_term.ln \
217 term.ln \
218 term_ascii.ln \
219 term_ps.ln \
220 tbl_term.ln
221
222 MANDOC_OBJS = $(MANDOC_HTML_OBJS) \
223 $(MANDOC_TERM_OBJS) \
224 main.o \
225 out.o \
226 tree.o
227 MANDOC_LNS = $(MANDOC_HTML_LNS) \
228 $(MANDOC_TERM_LNS) \
229 main.ln \
230 out.ln \
231 tree.ln
232
233 $(MANDOC_HTML_OBJS) $(MANDOC_HTML_LNS): html.h
234 $(MANDOC_TERM_OBJS) $(MANDOC_TERM_LNS): term.h
235 $(MANDOC_OBJS) $(MANDOC_LNS): main.h mandoc.h mdoc.h man.h config.h out.h
236
237 compat.o compat.ln: config.h
238
239 MANDOCDB_OBJS = mandocdb.o
240 MANDOCDB_LNS = mandocdb.ln
241
242 $(MANDOCDB_OBJS) $(MANDOCDB_LNS): mandoc.h mdoc.h man.h config.h
243
244 PRECONV_OBJS = preconv.o
245 PRECONV_LNS = preconv.ln
246
247 $(PRECONV_OBJS) $(PRECONV_LNS): config.h
248
249 INDEX_MANS = mandoc.1.html \
250 mandoc.1.xhtml \
251 mandoc.1.ps \
252 mandoc.1.pdf \
253 mandoc.1.txt \
254 mandoc.3.html \
255 mandoc.3.xhtml \
256 mandoc.3.ps \
257 mandoc.3.pdf \
258 mandoc.3.txt \
259 eqn.7.html \
260 eqn.7.xhtml \
261 eqn.7.ps \
262 eqn.7.pdf \
263 eqn.7.txt \
264 man.7.html \
265 man.7.xhtml \
266 man.7.ps \
267 man.7.pdf \
268 man.7.txt \
269 mandoc_char.7.html \
270 mandoc_char.7.xhtml \
271 mandoc_char.7.ps \
272 mandoc_char.7.pdf \
273 mandoc_char.7.txt \
274 mdoc.7.html \
275 mdoc.7.xhtml \
276 mdoc.7.ps \
277 mdoc.7.pdf \
278 mdoc.7.txt \
279 preconv.1.html \
280 preconv.1.xhtml \
281 preconv.1.ps \
282 preconv.1.pdf \
283 preconv.1.txt \
284 roff.7.html \
285 roff.7.xhtml \
286 roff.7.ps \
287 roff.7.pdf \
288 roff.7.txt \
289 tbl.7.html \
290 tbl.7.xhtml \
291 tbl.7.ps \
292 tbl.7.pdf \
293 tbl.7.txt \
294 mandocdb.8.html \
295 mandocdb.8.xhtml \
296 mandocdb.8.ps \
297 mandocdb.8.pdf \
298 mandocdb.8.txt
299
300 $(INDEX_MANS): mandoc
301
302 INDEX_OBJS = $(INDEX_MANS) \
303 man.h.html \
304 mandoc.h.html \
305 mdoc.h.html \
306 mdocml.tar.gz \
307 mdocml.md5
308
309 www: index.html
310
311 lint: llib-llibmandoc.ln llib-lmandoc.ln llib-lpreconv.ln
312
313 clean:
314 rm -f libmandoc.a $(LIBMANDOC_OBJS)
315 rm -f llib-llibmandoc.ln $(LIBMANDOC_LNS)
316 rm -f mandocdb $(MANDOCDB_OBJS)
317 rm -f llib-lmandocdb.ln $(MANDOCDB_LNS)
318 rm -f preconv $(PRECONV_OBJS)
319 rm -f llib-lpreconv.ln $(PRECONV_LNS)
320 rm -f mandoc $(MANDOC_OBJS)
321 rm -f llib-lmandoc.ln $(MANDOC_LNS)
322 rm -f config.h config.log compat.o compat.ln
323 rm -f mdocml.tar.gz
324 rm -f index.html $(INDEX_OBJS)
325
326 install: all
327 mkdir -p $(DESTDIR)$(BINDIR)
328 mkdir -p $(DESTDIR)$(EXAMPLEDIR)
329 mkdir -p $(DESTDIR)$(LIBDIR)
330 mkdir -p $(DESTDIR)$(INCLUDEDIR)
331 mkdir -p $(DESTDIR)$(MANDIR)/man1
332 mkdir -p $(DESTDIR)$(MANDIR)/man3
333 mkdir -p $(DESTDIR)$(MANDIR)/man7
334 mkdir -p $(DESTDIR)$(MANDIR)/man8
335 $(INSTALL_PROGRAM) mandoc preconv $(DESTDIR)$(BINDIR)
336 $(INSTALL_LIB) libmandoc.a $(DESTDIR)$(LIBDIR)
337 $(INSTALL_LIB) man.h mdoc.h mandoc.h $(DESTDIR)$(INCLUDEDIR)
338 $(INSTALL_MAN) mandoc.1 preconv.1 $(DESTDIR)$(MANDIR)/man1
339 $(INSTALL_MAN) mandoc.3 $(DESTDIR)$(MANDIR)/man3
340 $(INSTALL_MAN) man.7 mdoc.7 roff.7 eqn.7 tbl.7 mandoc_char.7 $(DESTDIR)$(MANDIR)/man7
341 $(INSTALL_DATA) example.style.css $(DESTDIR)$(EXAMPLEDIR)
342
343 installwww: www
344 mkdir -p $(PREFIX)/snapshots
345 $(INSTALL_DATA) index.html external.png index.css $(PREFIX)
346 $(INSTALL_DATA) $(INDEX_MANS) style.css $(PREFIX)
347 $(INSTALL_DATA) mandoc.h.html man.h.html mdoc.h.html $(PREFIX)
348 $(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots
349 $(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots
350 $(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots/mdocml-$(VERSION).tar.gz
351 $(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots/mdocml-$(VERSION).md5
352
353 libmandoc.a: compat.o $(LIBMANDOC_OBJS)
354 $(AR) rs $@ compat.o $(LIBMANDOC_OBJS)
355
356 llib-llibmandoc.ln: compat.ln $(LIBMANDOC_LNS)
357 $(LINT) $(LINTFLAGS) -Clibmandoc compat.ln $(LIBMANDOC_LNS)
358
359 mandoc: $(MANDOC_OBJS) libmandoc.a
360 $(CC) -o $@ $(MANDOC_OBJS) libmandoc.a
361
362 llib-lmandoc.ln: $(MANDOC_LNS)
363 $(LINT) $(LINTFLAGS) -Cmandoc $(MANDOC_LNS)
364
365 mandocdb: $(MANDOCDB_OBJS) libmandoc.a
366 $(CC) -o $@ $(MANDOCDB_OBJS) libmandoc.a $(DBLIB)
367
368 llib-lmandocdb.ln: $(MANDOCDB_LNS)
369 $(LINT) $(LINTFLAGS) -Cmandocdb $(MANDOCDB_LNS)
370
371 preconv: $(PRECONV_OBJS)
372 $(CC) -o $@ $(PRECONV_OBJS)
373
374 llib-lpreconv.ln: $(PRECONV_LNS)
375 $(LINT) $(LINTFLAGS) -Cpreconv $(PRECONV_LNS)
376
377 mdocml.md5: mdocml.tar.gz
378 md5 mdocml.tar.gz >$@
379
380 mdocml.tar.gz: $(SRCS)
381 mkdir -p .dist/mdocml-$(VERSION)/
382 $(INSTALL_SOURCE) $(SRCS) .dist/mdocml-$(VERSION)
383 ( cd .dist/ && tar zcf ../$@ ./ )
384 rm -rf .dist/
385
386 index.html: $(INDEX_OBJS)
387
388 config.h: config.h.pre config.h.post
389 rm -f config.log
390 ( cat config.h.pre; \
391 echo; \
392 if $(CC) $(CFLAGS) -Werror -o test-strlcat test-strlcat.c >> config.log 2>&1; then \
393 echo '#define HAVE_STRLCAT'; \
394 rm test-strlcat; \
395 fi; \
396 if $(CC) $(CFLAGS) -Werror -o test-mmap test-mmap.c >> config.log 2>&1; then \
397 echo '#define HAVE_MMAP'; \
398 rm test-mmap; \
399 fi; \
400 if $(CC) $(CFLAGS) -Werror -o test-strlcpy test-strlcpy.c >> config.log 2>&1; then \
401 echo '#define HAVE_STRLCPY'; \
402 rm test-strlcpy; \
403 fi; \
404 echo; \
405 cat config.h.post \
406 ) > $@
407
408 .h.h.html:
409 highlight -I $< >$@
410
411 .1.1.txt .3.3.txt .7.7.txt .8.8.txt:
412 ./mandoc -Tascii -Wall,stop $< | col -b >$@
413
414 .1.1.html .3.3.html .7.7.html .8.8.html:
415 ./mandoc -Thtml -Wall,stop -Ostyle=style.css,man=%N.%S.html,includes=%I.html $< >$@
416
417 .1.1.ps .3.3.ps .7.7.ps .8.8.ps:
418 ./mandoc -Tps -Wall,stop $< >$@
419
420 .1.1.xhtml .3.3.xhtml .7.7.xhtml .8.8.xhtml:
421 ./mandoc -Txhtml -Wall,stop -Ostyle=style.css,man=%N.%S.xhtml,includes=%I.html $< >$@
422
423 .1.1.pdf .3.3.pdf .7.7.pdf .8.8.pdf:
424 ./mandoc -Tpdf -Wall,stop $< >$@
425
426 .sgml.html:
427 validate --warn $<
428 sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< >$@