1 .PHONY: clean install installwww
2 .SUFFIXES: .sgml .html .md5 .h .h.html
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
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\""
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
24 BINDIR = $(PREFIX)/bin
25 INCLUDEDIR = $(PREFIX)/include/mandoc
26 LIBDIR = $(PREFIX)/lib/mandoc
27 MANDIR = $(PREFIX)/man
28 EXAMPLEDIR = $(PREFIX)/share/examples/mandoc
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)
36 # Linux needs -ldb to compile mandocdb.
124 LIBMAN_OBJS = man.o \
128 LIBMAN_LNS = man.ln \
133 LIBMDOC_OBJS = arch.o \
144 LIBMDOC_LNS = arch.ln \
156 LIBROFF_OBJS = eqn.o \
162 LIBROFF_LNS = eqn.ln \
169 LIBMANDOC_OBJS = $(LIBMAN_OBJS) \
175 LIBMANDOC_LNS = $(LIBMAN_LNS) \
182 arch.o arch.ln: arch.in
184 chars.o chars.ln: chars.in
186 msec.o msec.ln: msec.in
187 roff.o roff.ln: predefs.in
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
196 MANDOC_HTML_OBJS = eqn_html.o \
201 MANDOC_HTML_LNS = eqn_html.ln \
207 MANDOC_TERM_OBJS = eqn_term.o \
214 MANDOC_TERM_LNS = eqn_term.ln \
222 MANDOC_OBJS = $(MANDOC_HTML_OBJS) \
223 $(MANDOC_TERM_OBJS) \
227 MANDOC_LNS = $(MANDOC_HTML_LNS) \
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
237 compat.o compat.ln: config.h
239 MANDOCDB_OBJS = mandocdb.o
240 MANDOCDB_LNS = mandocdb.ln
242 $(MANDOCDB_OBJS) $(MANDOCDB_LNS): mandoc.h mdoc.h man.h config.h
244 PRECONV_OBJS = preconv.o
245 PRECONV_LNS = preconv.ln
247 $(PRECONV_OBJS) $(PRECONV_LNS): config.h
249 INDEX_MANS = mandoc.1.html \
270 mandoc_char.7.xhtml \
300 $(INDEX_MANS): mandoc
302 INDEX_OBJS = $(INDEX_MANS) \
311 lint: llib-llibmandoc.ln llib-lmandoc.ln llib-lpreconv.ln
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
324 rm -f index.html $(INDEX_OBJS)
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)
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
353 libmandoc.a: compat.o $(LIBMANDOC_OBJS)
354 $(AR) rs $@ compat.o $(LIBMANDOC_OBJS)
356 llib-llibmandoc.ln: compat.ln $(LIBMANDOC_LNS)
357 $(LINT) $(LINTFLAGS) -Clibmandoc compat.ln $(LIBMANDOC_LNS)
359 mandoc: $(MANDOC_OBJS) libmandoc.a
360 $(CC) -o $@ $(MANDOC_OBJS) libmandoc.a
362 llib-lmandoc.ln: $(MANDOC_LNS)
363 $(LINT) $(LINTFLAGS) -Cmandoc $(MANDOC_LNS)
365 mandocdb: $(MANDOCDB_OBJS) libmandoc.a
366 $(CC) -o $@ $(MANDOCDB_OBJS) libmandoc.a $(DBLIB)
368 llib-lmandocdb.ln: $(MANDOCDB_LNS)
369 $(LINT) $(LINTFLAGS) -Cmandocdb $(MANDOCDB_LNS)
371 preconv: $(PRECONV_OBJS)
372 $(CC) -o $@ $(PRECONV_OBJS)
374 llib-lpreconv.ln: $(PRECONV_LNS)
375 $(LINT) $(LINTFLAGS) -Cpreconv $(PRECONV_LNS)
377 mdocml.md5: mdocml.tar.gz
378 md5 mdocml.tar.gz >$@
380 mdocml.tar.gz: $(SRCS)
381 mkdir -p .dist/mdocml-$(VERSION)/
382 $(INSTALL_SOURCE) $(SRCS) .dist/mdocml-$(VERSION)
383 ( cd .dist/ && tar zcf ../$@ ./ )
386 index.html: $(INDEX_OBJS)
388 config.h: config.h.pre config.h.post
390 ( cat config.h.pre; \
392 if $(CC) $(CFLAGS) -Werror -o test-strlcat test-strlcat.c >> config.log 2>&1; then \
393 echo '#define HAVE_STRLCAT'; \
396 if $(CC) $(CFLAGS) -Werror -o test-mmap test-mmap.c >> config.log 2>&1; then \
397 echo '#define HAVE_MMAP'; \
400 if $(CC) $(CFLAGS) -Werror -o test-strlcpy test-strlcpy.c >> config.log 2>&1; then \
401 echo '#define HAVE_STRLCPY'; \
411 .1.1.txt .3.3.txt .7.7.txt .8.8.txt:
412 ./mandoc -Tascii -Wall,stop $< | col -b >$@
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 $< >$@
417 .1.1.ps .3.3.ps .7.7.ps .8.8.ps:
418 ./mandoc -Tps -Wall,stop $< >$@
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 $< >$@
423 .1.1.pdf .3.3.pdf .7.7.pdf .8.8.pdf:
424 ./mandoc -Tpdf -Wall,stop $< >$@
428 sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< >$@