Annotation of mandoc/Makefile, Revision 1.406
1.319 kristaps 1: .PHONY: clean install installwww
2: .SUFFIXES: .sgml .html .md5 .h .h.html
1.356 schwarze 3: .SUFFIXES: .1 .3 .7 .8
4: .SUFFIXES: .1.html .3.html .7.html .8.html
1.259 kristaps 5:
6: # Specify this if you want to hard-code the operating system to appear
7: # in the lower-left hand corner of -mdoc manuals.
1.375 kristaps 8: #
1.401 schwarze 9: # CFLAGS += -DOSNAME="\"OpenBSD 5.4\""
1.259 kristaps 10:
1.405 schwarze 11: VERSION = 1.12.3
12: VDATE = 31 December 2013
1.375 kristaps 13:
1.341 kristaps 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.
1.375 kristaps 19: #
1.362 kristaps 20: CFLAGS += -DUSE_WCHAR
1.375 kristaps 21:
1.380 kristaps 22: # If your system has manpath(1), uncomment this. This is most any
1.396 kristaps 23: # system that's not OpenBSD or NetBSD. If uncommented, manpage(1) and
24: # mandocdb(8) will use manpath(1) to get the MANPATH variable.
1.399 kristaps 25: #CFLAGS += -DUSE_MANPATH
1.383 kristaps 26:
1.401 schwarze 27: # If your system does not support static binaries, comment this,
28: # for example on Mac OS X.
1.386 kristaps 29: STATIC = -static
1.401 schwarze 30: # Linux requires -pthread to statically link with libdb.
31: #STATIC += -pthread
1.379 kristaps 32:
1.404 schwarze 33: CFLAGS += -I/usr/local/include -g -DHAVE_CONFIG_H
1.319 kristaps 34: CFLAGS += -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings
35: PREFIX = /usr/local
1.387 kristaps 36: WWWPREFIX = /var/www
37: HTDOCDIR = $(WWWPREFIX)/htdocs
38: CGIBINDIR = $(WWWPREFIX)/cgi-bin
1.319 kristaps 39: BINDIR = $(PREFIX)/bin
1.321 kristaps 40: INCLUDEDIR = $(PREFIX)/include/mandoc
41: LIBDIR = $(PREFIX)/lib/mandoc
1.319 kristaps 42: MANDIR = $(PREFIX)/man
43: EXAMPLEDIR = $(PREFIX)/share/examples/mandoc
44: INSTALL = install
45: INSTALL_PROGRAM = $(INSTALL) -m 0755
46: INSTALL_DATA = $(INSTALL) -m 0444
47: INSTALL_LIB = $(INSTALL) -m 0644
1.353 kristaps 48: INSTALL_SOURCE = $(INSTALL) -m 0644
1.319 kristaps 49: INSTALL_MAN = $(INSTALL_DATA)
50:
1.396 kristaps 51: DBLIB = -L/usr/local/lib -lsqlite3
52: DBBIN = mandocdb manpage apropos
1.358 kristaps 53:
1.375 kristaps 54: all: mandoc preconv demandoc $(DBBIN)
1.319 kristaps 55:
56: SRCS = Makefile \
1.401 schwarze 57: NEWS \
1.389 kristaps 58: TODO \
1.401 schwarze 59: apropos.1 \
60: apropos.c \
1.319 kristaps 61: arch.c \
62: arch.in \
63: att.c \
64: att.in \
1.389 kristaps 65: cgi.c \
1.319 kristaps 66: chars.c \
67: chars.in \
1.390 kristaps 68: compat_fgetln.c \
1.362 kristaps 69: compat_getsubopt.c \
1.406 ! schwarze 70: compat_strcasestr.c \
1.362 kristaps 71: compat_strlcat.c \
72: compat_strlcpy.c \
1.406 ! schwarze 73: compat_strsep.c \
1.319 kristaps 74: config.h.post \
75: config.h.pre \
1.389 kristaps 76: demandoc.1 \
1.369 kristaps 77: demandoc.c \
1.319 kristaps 78: eqn.7 \
79: eqn.c \
1.360 kristaps 80: eqn_html.c \
1.359 kristaps 81: eqn_term.c \
1.319 kristaps 82: example.style.css \
83: external.png \
1.401 schwarze 84: gmdiff \
1.319 kristaps 85: html.c \
86: html.h \
87: index.css \
88: index.sgml \
89: lib.c \
90: lib.in \
91: libman.h \
92: libmandoc.h \
93: libmdoc.h \
94: libroff.h \
95: main.c \
96: main.h \
97: man.7 \
98: man.c \
1.391 kristaps 99: man-cgi.css \
1.389 kristaps 100: man.h \
1.319 kristaps 101: man_hash.c \
102: man_html.c \
103: man_macro.c \
104: man_term.c \
105: man_validate.c \
106: mandoc.1 \
107: mandoc.3 \
108: mandoc.c \
109: mandoc.h \
1.389 kristaps 110: mandoc_char.7 \
1.356 schwarze 111: mandocdb.8 \
1.355 kristaps 112: mandocdb.c \
1.380 kristaps 113: manpath.c \
114: manpath.h \
1.319 kristaps 115: mdoc.7 \
116: mdoc.c \
1.389 kristaps 117: mdoc.h \
1.319 kristaps 118: mdoc_argv.c \
119: mdoc_hash.c \
120: mdoc_html.c \
121: mdoc_macro.c \
1.371 schwarze 122: mdoc_man.c \
1.319 kristaps 123: mdoc_term.c \
124: mdoc_validate.c \
125: msec.c \
126: msec.in \
127: out.c \
128: out.h \
1.344 kristaps 129: preconv.1 \
130: preconv.c \
1.342 kristaps 131: predefs.in \
1.319 kristaps 132: read.c \
133: roff.7 \
134: roff.c \
135: st.c \
136: st.in \
137: style.css \
1.401 schwarze 138: tbl.3 \
1.319 kristaps 139: tbl.7 \
140: tbl.c \
141: tbl_data.c \
142: tbl_html.c \
143: tbl_layout.c \
144: tbl_opts.c \
145: tbl_term.c \
146: term.c \
147: term.h \
148: term_ascii.c \
149: term_ps.c \
1.390 kristaps 150: test-fgetln.c \
1.365 kristaps 151: test-getsubopt.c \
1.347 kristaps 152: test-mmap.c \
1.397 kristaps 153: test-ohash.c \
1.319 kristaps 154: test-strlcat.c \
155: test-strlcpy.c \
1.365 kristaps 156: test-strptime.c \
1.319 kristaps 157: tree.c \
158: vol.c \
1.396 kristaps 159: vol.in
1.319 kristaps 160:
161: LIBMAN_OBJS = man.o \
162: man_hash.o \
163: man_macro.o \
164: man_validate.o
1.325 kristaps 165:
1.319 kristaps 166: LIBMDOC_OBJS = arch.o \
167: att.o \
168: lib.o \
169: mdoc.o \
170: mdoc_argv.o \
171: mdoc_hash.o \
172: mdoc_macro.o \
173: mdoc_validate.o \
174: st.o \
175: vol.o
1.325 kristaps 176:
1.319 kristaps 177: LIBROFF_OBJS = eqn.o \
178: roff.o \
179: tbl.o \
180: tbl_data.o \
181: tbl_layout.o \
182: tbl_opts.o
1.325 kristaps 183:
1.319 kristaps 184: LIBMANDOC_OBJS = $(LIBMAN_OBJS) \
185: $(LIBMDOC_OBJS) \
186: $(LIBROFF_OBJS) \
1.333 kristaps 187: chars.o \
1.319 kristaps 188: mandoc.o \
1.385 schwarze 189: msec.o \
1.319 kristaps 190: read.o
1.325 kristaps 191:
1.390 kristaps 192: COMPAT_OBJS = compat_fgetln.o \
193: compat_getsubopt.o \
1.397 kristaps 194: compat_ohash.o \
1.406 ! schwarze 195: compat_strcasestr.o \
1.362 kristaps 196: compat_strlcat.o \
1.406 ! schwarze 197: compat_strlcpy.o \
! 198: compat_strsep.o
1.319 kristaps 199:
1.396 kristaps 200: arch.o: arch.in
201: att.o: att.in
202: chars.o: chars.in
203: lib.o: lib.in
204: msec.o: msec.in
205: roff.o: predefs.in
206: st.o: st.in
207: vol.o: vol.in
208:
209: $(LIBMAN_OBJS): libman.h
210: $(LIBMDOC_OBJS): libmdoc.h
211: $(LIBROFF_OBJS): libroff.h
212: $(LIBMANDOC_OBJS): mandoc.h mdoc.h man.h libmandoc.h config.h
1.397 kristaps 213: $(COMPAT_OBJS): config.h compat_ohash.h
1.362 kristaps 214:
1.360 kristaps 215: MANDOC_HTML_OBJS = eqn_html.o \
216: html.o \
1.319 kristaps 217: man_html.o \
218: mdoc_html.o \
219: tbl_html.o
1.396 kristaps 220: $(MANDOC_HTML_OBJS): html.h
1.325 kristaps 221:
1.371 schwarze 222: MANDOC_MAN_OBJS = mdoc_man.o
223:
1.359 kristaps 224: MANDOC_TERM_OBJS = eqn_term.o \
225: man_term.o \
1.319 kristaps 226: mdoc_term.o \
227: term.o \
228: term_ascii.o \
229: term_ps.o \
230: tbl_term.o
1.396 kristaps 231: $(MANDOC_TERM_OBJS): term.h
1.325 kristaps 232:
1.319 kristaps 233: MANDOC_OBJS = $(MANDOC_HTML_OBJS) \
1.371 schwarze 234: $(MANDOC_MAN_OBJS) \
1.319 kristaps 235: $(MANDOC_TERM_OBJS) \
236: main.o \
237: out.o \
238: tree.o
1.396 kristaps 239: $(MANDOC_OBJS): main.h mandoc.h mdoc.h man.h config.h out.h
1.319 kristaps 240:
1.380 kristaps 241: MANDOCDB_OBJS = mandocdb.o manpath.o
1.399 kristaps 242: $(MANDOCDB_OBJS): mansearch.h mandoc.h mdoc.h man.h config.h manpath.h
1.326 kristaps 243:
1.343 kristaps 244: PRECONV_OBJS = preconv.o
1.396 kristaps 245: $(PRECONV_OBJS): config.h
1.376 kristaps 246:
1.396 kristaps 247: APROPOS_OBJS = apropos.o mansearch.o manpath.o
1.399 kristaps 248: $(APROPOS_OBJS): config.h manpath.h mansearch.h
1.372 kristaps 249:
1.396 kristaps 250: MANPAGE_OBJS = manpage.o mansearch.o manpath.o
1.399 kristaps 251: $(MANPAGE_OBJS): config.h manpath.h mansearch.h
1.381 kristaps 252:
1.369 kristaps 253: DEMANDOC_OBJS = demandoc.o
1.396 kristaps 254: $(DEMANDOC_OBJS): config.h
1.369 kristaps 255:
1.401 schwarze 256: INDEX_MANS = apropos.1.html \
257: demandoc.1.html \
1.369 kristaps 258: mandoc.1.html \
1.401 schwarze 259: preconv.1.html \
1.319 kristaps 260: mandoc.3.html \
1.401 schwarze 261: tbl.3.html \
1.319 kristaps 262: eqn.7.html \
263: man.7.html \
264: mandoc_char.7.html \
265: mdoc.7.html \
266: roff.7.html \
267: tbl.7.html \
1.400 kristaps 268: mandocdb.8.html
1.319 kristaps 269:
270: $(INDEX_MANS): mandoc
271:
272: INDEX_OBJS = $(INDEX_MANS) \
273: man.h.html \
274: mandoc.h.html \
275: mdoc.h.html \
276: mdocml.tar.gz \
277: mdocml.md5
1.132 kristaps 278:
1.319 kristaps 279: www: index.html
1.42 kristaps 280:
1.1 kristaps 281: clean:
1.319 kristaps 282: rm -f libmandoc.a $(LIBMANDOC_OBJS)
1.396 kristaps 283: rm -f apropos $(APROPOS_OBJS)
1.355 kristaps 284: rm -f mandocdb $(MANDOCDB_OBJS)
1.343 kristaps 285: rm -f preconv $(PRECONV_OBJS)
1.396 kristaps 286: rm -f manpage $(MANPAGE_OBJS)
1.369 kristaps 287: rm -f demandoc $(DEMANDOC_OBJS)
1.319 kristaps 288: rm -f mandoc $(MANDOC_OBJS)
1.396 kristaps 289: rm -f config.h config.log $(COMPAT_OBJS)
290: rm -f mdocml.tar.gz
1.319 kristaps 291: rm -f index.html $(INDEX_OBJS)
1.396 kristaps 292: rm -rf *.dSYM
1.290 kristaps 293:
1.319 kristaps 294: install: all
1.270 joerg 295: mkdir -p $(DESTDIR)$(BINDIR)
296: mkdir -p $(DESTDIR)$(EXAMPLEDIR)
1.332 kristaps 297: mkdir -p $(DESTDIR)$(LIBDIR)
1.334 kristaps 298: mkdir -p $(DESTDIR)$(INCLUDEDIR)
1.270 joerg 299: mkdir -p $(DESTDIR)$(MANDIR)/man1
1.319 kristaps 300: mkdir -p $(DESTDIR)$(MANDIR)/man3
1.270 joerg 301: mkdir -p $(DESTDIR)$(MANDIR)/man7
1.369 kristaps 302: $(INSTALL_PROGRAM) mandoc preconv demandoc $(DESTDIR)$(BINDIR)
1.324 kristaps 303: $(INSTALL_LIB) libmandoc.a $(DESTDIR)$(LIBDIR)
1.352 kristaps 304: $(INSTALL_LIB) man.h mdoc.h mandoc.h $(DESTDIR)$(INCLUDEDIR)
1.369 kristaps 305: $(INSTALL_MAN) mandoc.1 preconv.1 demandoc.1 $(DESTDIR)$(MANDIR)/man1
1.401 schwarze 306: $(INSTALL_MAN) mandoc.3 tbl.3 $(DESTDIR)$(MANDIR)/man3
1.311 kristaps 307: $(INSTALL_MAN) man.7 mdoc.7 roff.7 eqn.7 tbl.7 mandoc_char.7 $(DESTDIR)$(MANDIR)/man7
1.270 joerg 308: $(INSTALL_DATA) example.style.css $(DESTDIR)$(EXAMPLEDIR)
1.387 kristaps 309:
310: installcgi: all
311: mkdir -p $(DESTDIR)$(CGIBINDIR)
312: mkdir -p $(DESTDIR)$(HTDOCDIR)
1.396 kristaps 313: #$(INSTALL_PROGRAM) man.cgi $(DESTDIR)$(CGIBINDIR)
1.387 kristaps 314: $(INSTALL_DATA) example.style.css $(DESTDIR)$(HTDOCDIR)/man.css
1.391 kristaps 315: $(INSTALL_DATA) man-cgi.css $(DESTDIR)$(HTDOCDIR)
1.60 kristaps 316:
1.319 kristaps 317: installwww: www
318: mkdir -p $(PREFIX)/snapshots
1.363 kristaps 319: mkdir -p $(PREFIX)/binaries
1.320 kristaps 320: $(INSTALL_DATA) index.html external.png index.css $(PREFIX)
321: $(INSTALL_DATA) $(INDEX_MANS) style.css $(PREFIX)
1.319 kristaps 322: $(INSTALL_DATA) mandoc.h.html man.h.html mdoc.h.html $(PREFIX)
323: $(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots
324: $(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots
325: $(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots/mdocml-$(VERSION).tar.gz
326: $(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots/mdocml-$(VERSION).md5
327:
1.362 kristaps 328: libmandoc.a: $(COMPAT_OBJS) $(LIBMANDOC_OBJS)
329: $(AR) rs $@ $(COMPAT_OBJS) $(LIBMANDOC_OBJS)
1.319 kristaps 330:
331: mandoc: $(MANDOC_OBJS) libmandoc.a
1.368 kristaps 332: $(CC) $(LDFLAGS) -o $@ $(MANDOC_OBJS) libmandoc.a
1.325 kristaps 333:
1.355 kristaps 334: mandocdb: $(MANDOCDB_OBJS) libmandoc.a
1.368 kristaps 335: $(CC) $(LDFLAGS) -o $@ $(MANDOCDB_OBJS) libmandoc.a $(DBLIB)
1.326 kristaps 336:
1.343 kristaps 337: preconv: $(PRECONV_OBJS)
1.368 kristaps 338: $(CC) $(LDFLAGS) -o $@ $(PRECONV_OBJS)
1.343 kristaps 339:
1.396 kristaps 340: manpage: $(MANPAGE_OBJS) libmandoc.a
341: $(CC) $(LDFLAGS) -o $@ $(MANPAGE_OBJS) libmandoc.a $(DBLIB)
1.383 kristaps 342:
1.372 kristaps 343: apropos: $(APROPOS_OBJS) libmandoc.a
1.373 kristaps 344: $(CC) $(LDFLAGS) -o $@ $(APROPOS_OBJS) libmandoc.a $(DBLIB)
1.372 kristaps 345:
1.369 kristaps 346: demandoc: $(DEMANDOC_OBJS) libmandoc.a
347: $(CC) $(LDFLAGS) -o $@ $(DEMANDOC_OBJS) libmandoc.a
348:
1.319 kristaps 349: mdocml.md5: mdocml.tar.gz
350: md5 mdocml.tar.gz >$@
351:
352: mdocml.tar.gz: $(SRCS)
353: mkdir -p .dist/mdocml-$(VERSION)/
1.353 kristaps 354: $(INSTALL_SOURCE) $(SRCS) .dist/mdocml-$(VERSION)
1.319 kristaps 355: ( cd .dist/ && tar zcf ../$@ ./ )
1.60 kristaps 356: rm -rf .dist/
1.362 kristaps 357:
1.319 kristaps 358: index.html: $(INDEX_OBJS)
1.148 kristaps 359:
1.319 kristaps 360: config.h: config.h.pre config.h.post
361: rm -f config.log
362: ( cat config.h.pre; \
363: echo; \
1.404 schwarze 364: echo '#define VERSION "$(VERSION)"'; \
1.403 schwarze 365: if $(CC) $(CFLAGS) -Werror -Wno-unused -o test-ohash test-ohash.c >> config.log 2>&1; then \
1.397 kristaps 366: echo '#define HAVE_OHASH'; \
367: rm test-ohash; \
368: fi; \
1.403 schwarze 369: if $(CC) $(CFLAGS) -Werror -Wno-unused -o test-fgetln test-fgetln.c >> config.log 2>&1; then \
1.390 kristaps 370: echo '#define HAVE_FGETLN'; \
371: rm test-fgetln; \
372: fi; \
1.403 schwarze 373: if $(CC) $(CFLAGS) -Werror -Wno-unused -o test-strptime test-strptime.c >> config.log 2>&1; then \
1.362 kristaps 374: echo '#define HAVE_STRPTIME'; \
375: rm test-strptime; \
376: fi; \
1.403 schwarze 377: if $(CC) $(CFLAGS) -Werror -Wno-unused -o test-getsubopt test-getsubopt.c >> config.log 2>&1; then \
1.362 kristaps 378: echo '#define HAVE_GETSUBOPT'; \
379: rm test-getsubopt; \
380: fi; \
1.403 schwarze 381: if $(CC) $(CFLAGS) -Werror -Wno-unused -o test-strlcat test-strlcat.c >> config.log 2>&1; then \
1.319 kristaps 382: echo '#define HAVE_STRLCAT'; \
383: rm test-strlcat; \
1.347 kristaps 384: fi; \
1.403 schwarze 385: if $(CC) $(CFLAGS) -Werror -Wno-unused -o test-mmap test-mmap.c >> config.log 2>&1; then \
1.347 kristaps 386: echo '#define HAVE_MMAP'; \
387: rm test-mmap; \
1.319 kristaps 388: fi; \
1.403 schwarze 389: if $(CC) $(CFLAGS) -Werror -Wno-unused -o test-strlcpy test-strlcpy.c >> config.log 2>&1; then \
1.319 kristaps 390: echo '#define HAVE_STRLCPY'; \
391: rm test-strlcpy; \
1.406 ! schwarze 392: fi; \
! 393: if $(CC) $(CFLAGS) -Werror -Wno-unused -o test-strcasestr test-strcasestr.c >> config.log 2>&1; then \
! 394: echo '#define HAVE_STRCASESTR'; \
! 395: rm test-strcasestr; \
! 396: fi; \
! 397: if $(CC) $(CFLAGS) -Werror -Wno-unused -o test-strsep test-strsep.c >> config.log 2>&1; then \
! 398: echo '#define HAVE_STRSEP'; \
! 399: rm test-strsep; \
1.319 kristaps 400: fi; \
401: echo; \
402: cat config.h.post \
403: ) > $@
1.60 kristaps 404:
1.319 kristaps 405: .h.h.html:
406: highlight -I $< >$@
1.168 kristaps 407:
1.356 schwarze 408: .1.1.html .3.3.html .7.7.html .8.8.html:
1.319 kristaps 409: ./mandoc -Thtml -Wall,stop -Ostyle=style.css,man=%N.%S.html,includes=%I.html $< >$@
1.212 kristaps 410:
1.319 kristaps 411: .sgml.html:
412: validate --warn $<
413: sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< >$@
CVSweb