]> git.cameronkatri.com Git - mandoc.git/blob - Makefile
Break schwarze@'s release notes into sections. Ok schwarze@.
[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.7
15 VDATE = 2 September 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 += -DUSE_WCHAR
22 CFLAGS += -g -DHAVE_CONFIG_H -DVERSION="\"$(VERSION)\""
23 CFLAGS += -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings
24 PREFIX = /usr/local
25 BINDIR = $(PREFIX)/bin
26 INCLUDEDIR = $(PREFIX)/include/mandoc
27 LIBDIR = $(PREFIX)/lib/mandoc
28 MANDIR = $(PREFIX)/man
29 EXAMPLEDIR = $(PREFIX)/share/examples/mandoc
30 INSTALL = install
31 INSTALL_PROGRAM = $(INSTALL) -m 0755
32 INSTALL_DATA = $(INSTALL) -m 0444
33 INSTALL_LIB = $(INSTALL) -m 0644
34 INSTALL_SOURCE = $(INSTALL) -m 0644
35 INSTALL_MAN = $(INSTALL_DATA)
36
37 # Linux needs -ldb to compile mandocdb.
38 #DBLIB = -ldb
39
40 all: mandoc preconv demandoc
41
42 SRCS = Makefile \
43 arch.c \
44 arch.in \
45 att.c \
46 att.in \
47 chars.c \
48 chars.in \
49 compat_getsubopt.c \
50 compat_strlcat.c \
51 compat_strlcpy.c \
52 config.h.post \
53 config.h.pre \
54 demandoc.c \
55 demandoc.1 \
56 eqn.7 \
57 eqn.c \
58 eqn_html.c \
59 eqn_term.c \
60 example.style.css \
61 external.png \
62 html.c \
63 html.h \
64 index.css \
65 index.sgml \
66 lib.c \
67 lib.in \
68 libman.h \
69 libmandoc.h \
70 libmdoc.h \
71 libroff.h \
72 main.c \
73 main.h \
74 man.h \
75 man.7 \
76 man.c \
77 man_hash.c \
78 man_html.c \
79 man_macro.c \
80 man_term.c \
81 man_validate.c \
82 mandoc.1 \
83 mandoc.3 \
84 mandoc.c \
85 mandoc.h \
86 mandocdb.8 \
87 mandocdb.c \
88 mandoc_char.7 \
89 mdoc.h \
90 mdoc.7 \
91 mdoc.c \
92 mdoc_argv.c \
93 mdoc_hash.c \
94 mdoc_html.c \
95 mdoc_macro.c \
96 mdoc_man.c \
97 mdoc_term.c \
98 mdoc_validate.c \
99 msec.c \
100 msec.in \
101 out.c \
102 out.h \
103 preconv.1 \
104 preconv.c \
105 predefs.in \
106 read.c \
107 roff.7 \
108 roff.c \
109 st.c \
110 st.in \
111 style.css \
112 tbl.7 \
113 tbl.c \
114 tbl_data.c \
115 tbl_html.c \
116 tbl_layout.c \
117 tbl_opts.c \
118 tbl_term.c \
119 term.c \
120 term.h \
121 term_ascii.c \
122 term_ps.c \
123 test-getsubopt.c \
124 test-mmap.c \
125 test-strlcat.c \
126 test-strlcpy.c \
127 test-strptime.c \
128 tree.c \
129 vol.c \
130 vol.in
131
132 LIBMAN_OBJS = man.o \
133 man_hash.o \
134 man_macro.o \
135 man_validate.o
136 LIBMAN_LNS = man.ln \
137 man_hash.ln \
138 man_macro.ln \
139 man_validate.ln
140
141 LIBMDOC_OBJS = arch.o \
142 att.o \
143 lib.o \
144 mdoc.o \
145 mdoc_argv.o \
146 mdoc_hash.o \
147 mdoc_macro.o \
148 mdoc_validate.o \
149 msec.o \
150 st.o \
151 vol.o
152 LIBMDOC_LNS = arch.ln \
153 att.ln \
154 lib.ln \
155 mdoc.ln \
156 mdoc_argv.ln \
157 mdoc_hash.ln \
158 mdoc_macro.ln \
159 mdoc_validate.ln \
160 msec.ln \
161 st.ln \
162 vol.ln
163
164 LIBROFF_OBJS = eqn.o \
165 roff.o \
166 tbl.o \
167 tbl_data.o \
168 tbl_layout.o \
169 tbl_opts.o
170 LIBROFF_LNS = eqn.ln \
171 roff.ln \
172 tbl.ln \
173 tbl_data.ln \
174 tbl_layout.ln \
175 tbl_opts.ln
176
177 LIBMANDOC_OBJS = $(LIBMAN_OBJS) \
178 $(LIBMDOC_OBJS) \
179 $(LIBROFF_OBJS) \
180 chars.o \
181 mandoc.o \
182 read.o
183 LIBMANDOC_LNS = $(LIBMAN_LNS) \
184 $(LIBMDOC_LNS) \
185 $(LIBROFF_LNS) \
186 chars.ln \
187 mandoc.ln \
188 read.ln
189
190 COMPAT_OBJS = compat_getsubopt.o \
191 compat_strlcat.o \
192 compat_strlcpy.o
193 COMPAT_LNS = compat_getsubopt.ln \
194 compat_strlcat.ln \
195 compat_strlcpy.ln
196
197 arch.o arch.ln: arch.in
198 att.o att.ln: att.in
199 chars.o chars.ln: chars.in
200 lib.o lib.ln: lib.in
201 msec.o msec.ln: msec.in
202 roff.o roff.ln: predefs.in
203 st.o st.ln: st.in
204 vol.o vol.ln: vol.in
205
206 $(LIBMAN_OBJS) $(LIBMAN_LNS): libman.h
207 $(LIBMDOC_OBJS) $(LIBMDOC_LNS): libmdoc.h
208 $(LIBROFF_OBJS) $(LIBROFF_LNS): libroff.h
209 $(LIBMANDOC_OBJS) $(LIBMANDOC_LNS): mandoc.h mdoc.h man.h libmandoc.h config.h
210
211 $(COMPAT_OBJS) $(COMPAT_LNS): config.h
212
213 MANDOC_HTML_OBJS = eqn_html.o \
214 html.o \
215 man_html.o \
216 mdoc_html.o \
217 tbl_html.o
218 MANDOC_HTML_LNS = eqn_html.ln \
219 html.ln \
220 man_html.ln \
221 mdoc_html.ln \
222 tbl_html.ln
223
224 MANDOC_MAN_OBJS = mdoc_man.o
225 MANDOC_MAN_LNS = mdoc_man.ln
226
227 MANDOC_TERM_OBJS = eqn_term.o \
228 man_term.o \
229 mdoc_term.o \
230 term.o \
231 term_ascii.o \
232 term_ps.o \
233 tbl_term.o
234 MANDOC_TERM_LNS = eqn_term.ln \
235 man_term.ln \
236 mdoc_term.ln \
237 term.ln \
238 term_ascii.ln \
239 term_ps.ln \
240 tbl_term.ln
241
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_LNS = $(MANDOC_HTML_LNS) \
249 $(MANDOC_MAN_LNS) \
250 $(MANDOC_TERM_LNS) \
251 main.ln \
252 out.ln \
253 tree.ln
254
255 $(MANDOC_HTML_OBJS) $(MANDOC_HTML_LNS): html.h
256 $(MANDOC_TERM_OBJS) $(MANDOC_TERM_LNS): term.h
257 $(MANDOC_OBJS) $(MANDOC_LNS): main.h mandoc.h mdoc.h man.h config.h out.h
258
259 MANDOCDB_OBJS = mandocdb.o
260 MANDOCDB_LNS = mandocdb.ln
261
262 $(MANDOCDB_OBJS) $(MANDOCDB_LNS): mandoc.h mdoc.h man.h config.h
263
264 PRECONV_OBJS = preconv.o
265 PRECONV_LNS = preconv.ln
266
267 $(PRECONV_OBJS) $(PRECONV_LNS): config.h
268
269 DEMANDOC_OBJS = demandoc.o
270 DEMANDOC_LNS = demandoc.ln
271
272 $(DEMANDOC_OBJS) $(DEMANDOC_LNS): config.h
273
274 INDEX_MANS = demandoc.1.html \
275 demandoc.1.xhtml \
276 demandoc.1.ps \
277 demandoc.1.pdf \
278 demandoc.1.txt \
279 mandoc.1.html \
280 mandoc.1.xhtml \
281 mandoc.1.ps \
282 mandoc.1.pdf \
283 mandoc.1.txt \
284 mandoc.3.html \
285 mandoc.3.xhtml \
286 mandoc.3.ps \
287 mandoc.3.pdf \
288 mandoc.3.txt \
289 eqn.7.html \
290 eqn.7.xhtml \
291 eqn.7.ps \
292 eqn.7.pdf \
293 eqn.7.txt \
294 man.7.html \
295 man.7.xhtml \
296 man.7.ps \
297 man.7.pdf \
298 man.7.txt \
299 mandoc_char.7.html \
300 mandoc_char.7.xhtml \
301 mandoc_char.7.ps \
302 mandoc_char.7.pdf \
303 mandoc_char.7.txt \
304 mdoc.7.html \
305 mdoc.7.xhtml \
306 mdoc.7.ps \
307 mdoc.7.pdf \
308 mdoc.7.txt \
309 preconv.1.html \
310 preconv.1.xhtml \
311 preconv.1.ps \
312 preconv.1.pdf \
313 preconv.1.txt \
314 roff.7.html \
315 roff.7.xhtml \
316 roff.7.ps \
317 roff.7.pdf \
318 roff.7.txt \
319 tbl.7.html \
320 tbl.7.xhtml \
321 tbl.7.ps \
322 tbl.7.pdf \
323 tbl.7.txt \
324 mandocdb.8.html \
325 mandocdb.8.xhtml \
326 mandocdb.8.ps \
327 mandocdb.8.pdf \
328 mandocdb.8.txt
329
330 $(INDEX_MANS): mandoc
331
332 INDEX_OBJS = $(INDEX_MANS) \
333 man.h.html \
334 mandoc.h.html \
335 mdoc.h.html \
336 mdocml.tar.gz \
337 mdocml.md5
338
339 www: index.html
340
341 lint: llib-llibmandoc.ln llib-lmandoc.ln llib-lpreconv.ln llib-ldemandoc.ln
342
343 clean:
344 rm -f libmandoc.a $(LIBMANDOC_OBJS)
345 rm -f llib-llibmandoc.ln $(LIBMANDOC_LNS)
346 rm -f mandocdb $(MANDOCDB_OBJS)
347 rm -f llib-lmandocdb.ln $(MANDOCDB_LNS)
348 rm -f preconv $(PRECONV_OBJS)
349 rm -f llib-lpreconv.ln $(PRECONV_LNS)
350 rm -f demandoc $(DEMANDOC_OBJS)
351 rm -f llib-ldemandoc.ln $(DEMANDOC_LNS)
352 rm -f mandoc $(MANDOC_OBJS)
353 rm -f llib-lmandoc.ln $(MANDOC_LNS)
354 rm -f config.h config.log $(COMPAT_OBJS) $(COMPAT_LNS)
355 rm -f mdocml.tar.gz mdocml-win32.zip mdocml-win64.zip mdocml-macosx.zip
356 rm -f index.html $(INDEX_OBJS)
357 rm -rf test-strlcpy.DSYM
358 rm -rf test-strlcat.DSYM
359 rm -rf test-strptime.DSYM
360 rm -rf test-mmap.DSYM
361 rm -rf test-getsubopt.DSYM
362
363 install: all
364 mkdir -p $(DESTDIR)$(BINDIR)
365 mkdir -p $(DESTDIR)$(EXAMPLEDIR)
366 mkdir -p $(DESTDIR)$(LIBDIR)
367 mkdir -p $(DESTDIR)$(INCLUDEDIR)
368 mkdir -p $(DESTDIR)$(MANDIR)/man1
369 mkdir -p $(DESTDIR)$(MANDIR)/man3
370 mkdir -p $(DESTDIR)$(MANDIR)/man7
371 mkdir -p $(DESTDIR)$(MANDIR)/man8
372 $(INSTALL_PROGRAM) mandoc preconv demandoc $(DESTDIR)$(BINDIR)
373 $(INSTALL_LIB) libmandoc.a $(DESTDIR)$(LIBDIR)
374 $(INSTALL_LIB) man.h mdoc.h mandoc.h $(DESTDIR)$(INCLUDEDIR)
375 $(INSTALL_MAN) mandoc.1 preconv.1 demandoc.1 $(DESTDIR)$(MANDIR)/man1
376 $(INSTALL_MAN) mandoc.3 $(DESTDIR)$(MANDIR)/man3
377 $(INSTALL_MAN) man.7 mdoc.7 roff.7 eqn.7 tbl.7 mandoc_char.7 $(DESTDIR)$(MANDIR)/man7
378 $(INSTALL_DATA) example.style.css $(DESTDIR)$(EXAMPLEDIR)
379
380 installwww: www
381 mkdir -p $(PREFIX)/snapshots
382 mkdir -p $(PREFIX)/binaries
383 $(INSTALL_DATA) index.html external.png index.css $(PREFIX)
384 $(INSTALL_DATA) $(INDEX_MANS) style.css $(PREFIX)
385 $(INSTALL_DATA) mandoc.h.html man.h.html mdoc.h.html $(PREFIX)
386 $(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots
387 $(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots
388 $(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots/mdocml-$(VERSION).tar.gz
389 $(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots/mdocml-$(VERSION).md5
390
391 libmandoc.a: $(COMPAT_OBJS) $(LIBMANDOC_OBJS)
392 $(AR) rs $@ $(COMPAT_OBJS) $(LIBMANDOC_OBJS)
393
394 llib-llibmandoc.ln: $(COMPAT_LNS) $(LIBMANDOC_LNS)
395 $(LINT) $(LINTFLAGS) -Clibmandoc $(COMPAT_LNS) $(LIBMANDOC_LNS)
396
397 mandoc: $(MANDOC_OBJS) libmandoc.a
398 $(CC) $(LDFLAGS) -o $@ $(MANDOC_OBJS) libmandoc.a
399
400 llib-lmandoc.ln: $(MANDOC_LNS)
401 $(LINT) $(LINTFLAGS) -Cmandoc $(MANDOC_LNS)
402
403 mandocdb: $(MANDOCDB_OBJS) libmandoc.a
404 $(CC) $(LDFLAGS) -o $@ $(MANDOCDB_OBJS) libmandoc.a $(DBLIB)
405
406 llib-lmandocdb.ln: $(MANDOCDB_LNS)
407 $(LINT) $(LINTFLAGS) -Cmandocdb $(MANDOCDB_LNS)
408
409 preconv: $(PRECONV_OBJS)
410 $(CC) $(LDFLAGS) -o $@ $(PRECONV_OBJS)
411
412 llib-lpreconv.ln: $(PRECONV_LNS)
413 $(LINT) $(LINTFLAGS) -Cpreconv $(PRECONV_LNS)
414
415 demandoc: $(DEMANDOC_OBJS) libmandoc.a
416 $(CC) $(LDFLAGS) -o $@ $(DEMANDOC_OBJS) libmandoc.a
417
418 llib-ldemandoc.ln: $(DEMANDOC_LNS)
419 $(LINT) $(LINTFLAGS) -Cdemandoc $(DEMANDOC_LNS)
420
421 mdocml.md5: mdocml.tar.gz
422 md5 mdocml.tar.gz >$@
423
424 mdocml.tar.gz: $(SRCS)
425 mkdir -p .dist/mdocml-$(VERSION)/
426 $(INSTALL_SOURCE) $(SRCS) .dist/mdocml-$(VERSION)
427 ( cd .dist/ && tar zcf ../$@ ./ )
428 rm -rf .dist/
429
430 mdocml-win32.zip: $(SRCS)
431 mkdir -p .win32/mdocml-$(VERSION)/
432 $(INSTALL_SOURCE) $(SRCS) .win32
433 cp .win32/Makefile .win32/Makefile.old
434 grep -v DUSE_WCHAR .win32/Makefile.old >.win32/Makefile
435 ( cd .win32; \
436 CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar CFLAGS='-DOSNAME=\"Windows\"' make; \
437 make install PREFIX=mdocml-$(VERSION) ; \
438 zip -r ../$@ mdocml-$(VERSION) )
439 rm -rf .win32
440
441 mdocml-win64.zip: $(SRCS)
442 mkdir -p .win64/mdocml-$(VERSION)/
443 $(INSTALL_SOURCE) $(SRCS) .win64
444 cp .win64/Makefile .win64/Makefile.old
445 grep -v DUSE_WCHAR .win64/Makefile.old >.win64/Makefile
446 ( cd .win64; \
447 CC=x86_64-w64-mingw32-gcc AR=x86_64-w64-mingw32-ar CFLAGS='-DOSNAME=\"Windows\"' make; \
448 make install PREFIX=mdocml-$(VERSION) ; \
449 zip -r ../$@ mdocml-$(VERSION) )
450 rm -rf .win64
451
452 mdocml-macosx.zip: $(SRCS)
453 mkdir -p .macosx/mdocml-$(VERSION)/
454 $(INSTALL_SOURCE) $(SRCS) .macosx
455 ( cd .macosx; \
456 CFLAGS="-arch i386 -arch x86_64 -arch ppc" LDFLAGS="-arch i386 -arch x86_64 -arch ppc" make; \
457 make install PREFIX=mdocml-$(VERSION) ; \
458 zip -r ../$@ mdocml-$(VERSION) )
459 rm -rf .macosx
460
461 index.html: $(INDEX_OBJS)
462
463 config.h: config.h.pre config.h.post
464 rm -f config.log
465 ( cat config.h.pre; \
466 echo; \
467 if $(CC) $(CFLAGS) -Werror -o test-strptime test-strptime.c >> config.log 2>&1; then \
468 echo '#define HAVE_STRPTIME'; \
469 rm test-strptime; \
470 fi; \
471 if $(CC) $(CFLAGS) -Werror -o test-getsubopt test-getsubopt.c >> config.log 2>&1; then \
472 echo '#define HAVE_GETSUBOPT'; \
473 rm test-getsubopt; \
474 fi; \
475 if $(CC) $(CFLAGS) -Werror -o test-strlcat test-strlcat.c >> config.log 2>&1; then \
476 echo '#define HAVE_STRLCAT'; \
477 rm test-strlcat; \
478 fi; \
479 if $(CC) $(CFLAGS) -Werror -o test-mmap test-mmap.c >> config.log 2>&1; then \
480 echo '#define HAVE_MMAP'; \
481 rm test-mmap; \
482 fi; \
483 if $(CC) $(CFLAGS) -Werror -o test-strlcpy test-strlcpy.c >> config.log 2>&1; then \
484 echo '#define HAVE_STRLCPY'; \
485 rm test-strlcpy; \
486 fi; \
487 echo; \
488 cat config.h.post \
489 ) > $@
490
491 .h.h.html:
492 highlight -I $< >$@
493
494 .1.1.txt .3.3.txt .7.7.txt .8.8.txt:
495 ./mandoc -Tascii -Wall,stop $< | col -b >$@
496
497 .1.1.html .3.3.html .7.7.html .8.8.html:
498 ./mandoc -Thtml -Wall,stop -Ostyle=style.css,man=%N.%S.html,includes=%I.html $< >$@
499
500 .1.1.ps .3.3.ps .7.7.ps .8.8.ps:
501 ./mandoc -Tps -Wall,stop $< >$@
502
503 .1.1.xhtml .3.3.xhtml .7.7.xhtml .8.8.xhtml:
504 ./mandoc -Txhtml -Wall,stop -Ostyle=style.css,man=%N.%S.xhtml,includes=%I.html $< >$@
505
506 .1.1.pdf .3.3.pdf .7.7.pdf .8.8.pdf:
507 ./mandoc -Tpdf -Wall,stop $< >$@
508
509 .sgml.html:
510 validate --warn $<
511 sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< >$@