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