Correct math and limerick.
[dragonfly.git] / contrib / mdocml / Makefile
blobc0248c9b7be392c804483135ed97ae6f89c965c5
1 .PHONY: clean install installwww
2 .SUFFIXES: .sgml .html .md5 .h .h.html
3 .SUFFIXES: .1 .3 .7 .8
4 .SUFFIXES: .1.html .3.html .7.html .8.html
6 # Specify this if you want to hard-code the operating system to appear
7 # in the lower-left hand corner of -mdoc manuals.
9 # CFLAGS += -DOSNAME="\"OpenBSD 5.4\""
11 VERSION = 1.12.3
12 VDATE = 31 December 2013
14 # IFF your system supports multi-byte functions (setlocale(), wcwidth(),
15 # putwchar()) AND has __STDC_ISO_10646__ (that is, wchar_t is simply a
16 # UCS-4 value) should you define USE_WCHAR. If you define it and your
17 # system DOESN'T support this, -Tlocale will produce garbage.
18 # If you don't define it, -Tlocale is a synonym for -Tacsii.
20 CFLAGS += -DUSE_WCHAR
22 # If your system has manpath(1), uncomment this. This is most any
23 # system that's not OpenBSD or NetBSD. If uncommented, apropos(1),
24 # mandocdb(8), and man.cgi will popen(3) manpath(1) to get the MANPATH
25 # variable.
26 #CFLAGS += -DUSE_MANPATH
28 # If your system does not support static binaries, comment this,
29 # for example on Mac OS X.
30 STATIC = -static
31 # Linux requires -pthread to statically link with libdb.
32 #STATIC += -pthread
34 CFLAGS += -g -DHAVE_CONFIG_H
35 CFLAGS += -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings
36 PREFIX = /usr/local
37 WWWPREFIX = /var/www
38 HTDOCDIR = $(WWWPREFIX)/htdocs
39 CGIBINDIR = $(WWWPREFIX)/cgi-bin
40 BINDIR = $(PREFIX)/bin
41 INCLUDEDIR = $(PREFIX)/include/mandoc
42 LIBDIR = $(PREFIX)/lib/mandoc
43 MANDIR = $(PREFIX)/man
44 EXAMPLEDIR = $(PREFIX)/share/examples/mandoc
45 INSTALL = install
46 INSTALL_PROGRAM = $(INSTALL) -m 0755
47 INSTALL_DATA = $(INSTALL) -m 0444
48 INSTALL_LIB = $(INSTALL) -m 0644
49 INSTALL_SOURCE = $(INSTALL) -m 0644
50 INSTALL_MAN = $(INSTALL_DATA)
52 # Non-BSD systems (Linux, etc.) need -ldb to compile mandocdb and
53 # apropos.
54 # However, if you don't have -ldb at all (or it's not native), then
55 # comment out apropos and mandocdb.
57 #DBLIB = -ldb
58 DBBIN = apropos mandocdb man.cgi catman whatis
59 DBLN = llib-lapropos.ln llib-lmandocdb.ln llib-lman.cgi.ln llib-lcatman.ln
61 all: mandoc preconv demandoc $(DBBIN)
63 SRCS = Makefile \
64 NEWS \
65 TODO \
66 apropos.1 \
67 apropos.c \
68 apropos_db.c \
69 apropos_db.h \
70 arch.c \
71 arch.in \
72 att.c \
73 att.in \
74 catman.8 \
75 catman.c \
76 cgi.c \
77 chars.c \
78 chars.in \
79 compat_fgetln.c \
80 compat_getsubopt.c \
81 compat_strlcat.c \
82 compat_strlcpy.c \
83 config.h.post \
84 config.h.pre \
85 demandoc.1 \
86 demandoc.c \
87 eqn.7 \
88 eqn.c \
89 eqn_html.c \
90 eqn_term.c \
91 example.style.css \
92 external.png \
93 gmdiff \
94 html.c \
95 html.h \
96 index.css \
97 index.sgml \
98 lib.c \
99 lib.in \
100 libman.h \
101 libmandoc.h \
102 libmdoc.h \
103 libroff.h \
104 main.c \
105 main.h \
106 man.7 \
107 man.c \
108 man.cgi.7 \
109 man-cgi.css \
110 man.h \
111 man_hash.c \
112 man_html.c \
113 man_macro.c \
114 man_term.c \
115 man_validate.c \
116 mandoc.1 \
117 mandoc.3 \
118 mandoc.c \
119 mandoc.h \
120 mandoc_char.7 \
121 mandocdb.8 \
122 mandocdb.c \
123 mandocdb.h \
124 manpath.c \
125 manpath.h \
126 mdoc.7 \
127 mdoc.c \
128 mdoc.h \
129 mdoc_argv.c \
130 mdoc_hash.c \
131 mdoc_html.c \
132 mdoc_macro.c \
133 mdoc_man.c \
134 mdoc_term.c \
135 mdoc_validate.c \
136 msec.c \
137 msec.in \
138 out.c \
139 out.h \
140 preconv.1 \
141 preconv.c \
142 predefs.in \
143 read.c \
144 roff.7 \
145 roff.c \
146 st.c \
147 st.in \
148 style.css \
149 tbl.3 \
150 tbl.7 \
151 tbl.c \
152 tbl_data.c \
153 tbl_html.c \
154 tbl_layout.c \
155 tbl_opts.c \
156 tbl_term.c \
157 term.c \
158 term.h \
159 term_ascii.c \
160 term_ps.c \
161 test-betoh64.c \
162 test-fgetln.c \
163 test-getsubopt.c \
164 test-mmap.c \
165 test-strlcat.c \
166 test-strlcpy.c \
167 test-strptime.c \
168 tree.c \
169 vol.c \
170 vol.in \
171 whatis.1
173 LIBMAN_OBJS = man.o \
174 man_hash.o \
175 man_macro.o \
176 man_validate.o
178 LIBMDOC_OBJS = arch.o \
179 att.o \
180 lib.o \
181 mdoc.o \
182 mdoc_argv.o \
183 mdoc_hash.o \
184 mdoc_macro.o \
185 mdoc_validate.o \
186 st.o \
187 vol.o
189 LIBROFF_OBJS = eqn.o \
190 roff.o \
191 tbl.o \
192 tbl_data.o \
193 tbl_layout.o \
194 tbl_opts.o
196 LIBMANDOC_OBJS = $(LIBMAN_OBJS) \
197 $(LIBMDOC_OBJS) \
198 $(LIBROFF_OBJS) \
199 chars.o \
200 mandoc.o \
201 msec.o \
202 read.o
204 COMPAT_OBJS = compat_fgetln.o \
205 compat_getsubopt.o \
206 compat_strlcat.o \
207 compat_strlcpy.o
209 arch.o: arch.in
210 att.o: att.in
211 chars.o: chars.in
212 lib.o: lib.in
213 msec.o: msec.in
214 roff.o: predefs.in
215 st.o: st.in
216 vol.o: vol.in
218 $(LIBMAN_OBJS): libman.h
219 $(LIBMDOC_OBJS): libmdoc.h
220 $(LIBROFF_OBJS): libroff.h
221 $(LIBMANDOC_OBJS): mandoc.h mdoc.h man.h libmandoc.h config.h
222 $(COMPAT_OBJS): config.h
224 MANDOC_HTML_OBJS = eqn_html.o \
225 html.o \
226 man_html.o \
227 mdoc_html.o \
228 tbl_html.o
229 $(MANDOC_HTML_OBJS): html.h
231 MANDOC_MAN_OBJS = mdoc_man.o
233 MANDOC_TERM_OBJS = eqn_term.o \
234 man_term.o \
235 mdoc_term.o \
236 term.o \
237 term_ascii.o \
238 term_ps.o \
239 tbl_term.o
240 $(MANDOC_TERM_OBJS): term.h
242 MANDOC_OBJS = $(MANDOC_HTML_OBJS) \
243 $(MANDOC_MAN_OBJS) \
244 $(MANDOC_TERM_OBJS) \
245 main.o \
246 out.o \
247 tree.o
248 $(MANDOC_OBJS): main.h mandoc.h mdoc.h man.h config.h out.h
250 MANDOCDB_OBJS = mandocdb.o manpath.o
251 $(MANDOCDB_OBJS): mandocdb.h mandoc.h mdoc.h man.h config.h manpath.h
253 PRECONV_OBJS = preconv.o
254 $(PRECONV_OBJS): config.h
256 APROPOS_OBJS = apropos.o apropos_db.o manpath.o
257 $(APROPOS_OBJS): config.h mandoc.h apropos_db.h manpath.h mandocdb.h
259 CGI_OBJS = $(MANDOC_HTML_OBJS) \
260 $(MANDOC_MAN_OBJS) \
261 $(MANDOC_TERM_OBJS) \
262 cgi.o \
263 apropos_db.o \
264 manpath.o \
265 out.o \
266 tree.o
267 $(CGI_OBJS): main.h mdoc.h man.h out.h config.h mandoc.h apropos_db.h manpath.h mandocdb.h
269 CATMAN_OBJS = catman.o manpath.o
270 $(CATMAN_OBJS): config.h mandoc.h manpath.h mandocdb.h
272 DEMANDOC_OBJS = demandoc.o
273 $(DEMANDOC_OBJS): config.h
275 INDEX_MANS = apropos.1.html \
276 catman.8.html \
277 demandoc.1.html \
278 mandoc.1.html \
279 whatis.1.html \
280 mandoc.3.html \
281 tbl.3.html \
282 eqn.7.html \
283 man.7.html \
284 man.cgi.7.html \
285 mandoc_char.7.html \
286 mdoc.7.html \
287 preconv.1.html \
288 roff.7.html \
289 tbl.7.html \
290 mandocdb.8.html
292 $(INDEX_MANS): mandoc
294 INDEX_OBJS = $(INDEX_MANS) \
295 man.h.html \
296 mandoc.h.html \
297 mdoc.h.html \
298 mdocml.tar.gz \
299 mdocml.md5
301 www: index.html
303 clean:
304 rm -f libmandoc.a $(LIBMANDOC_OBJS)
305 rm -f mandocdb $(MANDOCDB_OBJS)
306 rm -f preconv $(PRECONV_OBJS)
307 rm -f apropos whatis $(APROPOS_OBJS)
308 rm -f man.cgi $(CGI_OBJS)
309 rm -f catman $(CATMAN_OBJS)
310 rm -f demandoc $(DEMANDOC_OBJS)
311 rm -f mandoc $(MANDOC_OBJS)
312 rm -f config.log $(COMPAT_OBJS)
313 rm -f mdocml.tar.gz
314 rm -f index.html $(INDEX_OBJS)
315 rm -rf *.dSYM
317 install: all
318 mkdir -p $(DESTDIR)$(BINDIR)
319 mkdir -p $(DESTDIR)$(EXAMPLEDIR)
320 mkdir -p $(DESTDIR)$(LIBDIR)
321 mkdir -p $(DESTDIR)$(INCLUDEDIR)
322 mkdir -p $(DESTDIR)$(MANDIR)/man1
323 mkdir -p $(DESTDIR)$(MANDIR)/man3
324 mkdir -p $(DESTDIR)$(MANDIR)/man7
325 $(INSTALL_PROGRAM) mandoc preconv demandoc $(DESTDIR)$(BINDIR)
326 $(INSTALL_LIB) libmandoc.a $(DESTDIR)$(LIBDIR)
327 $(INSTALL_LIB) man.h mdoc.h mandoc.h $(DESTDIR)$(INCLUDEDIR)
328 $(INSTALL_MAN) mandoc.1 preconv.1 demandoc.1 $(DESTDIR)$(MANDIR)/man1
329 $(INSTALL_MAN) mandoc.3 tbl.3 $(DESTDIR)$(MANDIR)/man3
330 $(INSTALL_MAN) man.7 mdoc.7 roff.7 eqn.7 tbl.7 mandoc_char.7 $(DESTDIR)$(MANDIR)/man7
331 $(INSTALL_DATA) example.style.css $(DESTDIR)$(EXAMPLEDIR)
333 installcgi: all
334 mkdir -p $(DESTDIR)$(CGIBINDIR)
335 mkdir -p $(DESTDIR)$(HTDOCDIR)
336 $(INSTALL_PROGRAM) man.cgi $(DESTDIR)$(CGIBINDIR)
337 $(INSTALL_DATA) example.style.css $(DESTDIR)$(HTDOCDIR)/man.css
338 $(INSTALL_DATA) man-cgi.css $(DESTDIR)$(HTDOCDIR)
340 installwww: www
341 mkdir -p $(PREFIX)/snapshots
342 mkdir -p $(PREFIX)/binaries
343 $(INSTALL_DATA) index.html external.png index.css $(PREFIX)
344 $(INSTALL_DATA) $(INDEX_MANS) style.css $(PREFIX)
345 $(INSTALL_DATA) mandoc.h.html man.h.html mdoc.h.html $(PREFIX)
346 $(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots
347 $(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots
348 $(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots/mdocml-$(VERSION).tar.gz
349 $(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots/mdocml-$(VERSION).md5
351 libmandoc.a: $(COMPAT_OBJS) $(LIBMANDOC_OBJS)
352 $(AR) rs $@ $(COMPAT_OBJS) $(LIBMANDOC_OBJS)
354 mandoc: $(MANDOC_OBJS) libmandoc.a
355 $(CC) $(LDFLAGS) -o $@ $(MANDOC_OBJS) libmandoc.a
357 mandocdb: $(MANDOCDB_OBJS) libmandoc.a
358 $(CC) $(LDFLAGS) -o $@ $(MANDOCDB_OBJS) libmandoc.a $(DBLIB)
360 preconv: $(PRECONV_OBJS)
361 $(CC) $(LDFLAGS) -o $@ $(PRECONV_OBJS)
363 whatis: apropos
364 cp -f apropos whatis
366 apropos: $(APROPOS_OBJS) libmandoc.a
367 $(CC) $(LDFLAGS) -o $@ $(APROPOS_OBJS) libmandoc.a $(DBLIB)
369 catman: $(CATMAN_OBJS) libmandoc.a
370 $(CC) $(LDFLAGS) -o $@ $(CATMAN_OBJS) libmandoc.a $(DBLIB)
372 man.cgi: $(CGI_OBJS) libmandoc.a
373 $(CC) $(LDFLAGS) $(STATIC) -o $@ $(CGI_OBJS) libmandoc.a $(DBLIB)
375 demandoc: $(DEMANDOC_OBJS) libmandoc.a
376 $(CC) $(LDFLAGS) -o $@ $(DEMANDOC_OBJS) libmandoc.a
378 mdocml.md5: mdocml.tar.gz
379 md5 mdocml.tar.gz >$@
381 mdocml.tar.gz: $(SRCS)
382 mkdir -p .dist/mdocml-$(VERSION)/
383 $(INSTALL_SOURCE) $(SRCS) .dist/mdocml-$(VERSION)
384 ( cd .dist/ && tar zcf ../$@ ./ )
385 rm -rf .dist/
387 index.html: $(INDEX_OBJS)
389 config.h: config.h.pre config.h.post
390 rm -f config.log
391 ( cat config.h.pre; \
392 echo; \
393 echo '#define VERSION "$(VERSION)"'; \
394 if $(CC) $(CFLAGS) -Werror -Wno-unused -o test-fgetln test-fgetln.c >> config.log 2>&1; then \
395 echo '#define HAVE_FGETLN'; \
396 rm test-fgetln; \
397 fi; \
398 if $(CC) $(CFLAGS) -Werror -Wno-unused -o test-strptime test-strptime.c >> config.log 2>&1; then \
399 echo '#define HAVE_STRPTIME'; \
400 rm test-strptime; \
401 fi; \
402 if $(CC) $(CFLAGS) -Werror -Wno-unused -o test-getsubopt test-getsubopt.c >> config.log 2>&1; then \
403 echo '#define HAVE_GETSUBOPT'; \
404 rm test-getsubopt; \
405 fi; \
406 if $(CC) $(CFLAGS) -Werror -Wno-unused -o test-strlcat test-strlcat.c >> config.log 2>&1; then \
407 echo '#define HAVE_STRLCAT'; \
408 rm test-strlcat; \
409 fi; \
410 if $(CC) $(CFLAGS) -Werror -Wno-unused -o test-mmap test-mmap.c >> config.log 2>&1; then \
411 echo '#define HAVE_MMAP'; \
412 rm test-mmap; \
413 fi; \
414 if $(CC) $(CFLAGS) -Werror -Wno-unused -o test-strlcpy test-strlcpy.c >> config.log 2>&1; then \
415 echo '#define HAVE_STRLCPY'; \
416 rm test-strlcpy; \
417 fi; \
418 if $(CC) $(CFLAGS) -Werror -Wno-unused -o test-betoh64 test-betoh64.c >> config.log 2>&1; then \
419 echo '#define HAVE_BETOH64'; \
420 rm test-betoh64; \
421 fi; \
422 echo; \
423 cat config.h.post \
424 ) > $@
426 .h.h.html:
427 highlight -I $< >$@
429 .1.1.html .3.3.html .7.7.html .8.8.html:
430 ./mandoc -Thtml -Wall,stop -Ostyle=style.css,man=%N.%S.html,includes=%I.html $< >$@
432 .sgml.html:
433 validate --warn $<
434 sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< >$@