1 .PHONY: clean install installwww
2 .SUFFIXES: .sgml .html .md5 .h .h.html
4 .SUFFIXES: .1.txt .3.txt .7.txt
5 .SUFFIXES: .1.pdf .3.pdf .7.pdf
6 .SUFFIXES: .1.ps .3.ps .7.ps
7 .SUFFIXES: .1.html .3.html .7.html
8 .SUFFIXES: .1.xhtml .3.xhtml .7.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)
119 LIBMAN_OBJS = man.o \
123 LIBMAN_LNS = man.ln \
128 LIBMDOC_OBJS = arch.o \
139 LIBMDOC_LNS = arch.ln \
151 LIBROFF_OBJS = eqn.o \
157 LIBROFF_LNS = eqn.ln \
164 LIBMANDOC_OBJS = $(LIBMAN_OBJS) \
170 LIBMANDOC_LNS = $(LIBMAN_LNS) \
177 arch.o arch.ln: arch.in
179 chars.o chars.ln: chars.in
181 msec.o msec.ln: msec.in
182 roff.o roff.ln: predefs.in
186 $(LIBMAN_OBJS) $(LIBMAN_LNS): libman.h
187 $(LIBMDOC_OBJS) $(LIBMDOC_LNS): libmdoc.h
188 $(LIBROFF_OBJS) $(LIBROFF_LNS): libroff.h
189 $(LIBMANDOC_OBJS) $(LIBMANDOC_LNS): mandoc.h mdoc.h man.h libmandoc.h config.h
191 MANDOC_HTML_OBJS = html.o \
195 MANDOC_HTML_LNS = html.ln \
200 MANDOC_TERM_OBJS = man_term.o \
206 MANDOC_TERM_LNS = man_term.ln \
213 MANDOC_OBJS = $(MANDOC_HTML_OBJS) \
214 $(MANDOC_TERM_OBJS) \
218 MANDOC_LNS = $(MANDOC_HTML_LNS) \
224 $(MANDOC_HTML_OBJS) $(MANDOC_HTML_LNS): html.h
225 $(MANDOC_TERM_OBJS) $(MANDOC_TERM_LNS): term.h
226 $(MANDOC_OBJS) $(MANDOC_LNS): main.h mandoc.h mdoc.h man.h config.h out.h
228 compat.o compat.ln: config.h
230 MANDOCDB_OBJS = mandocdb.o
231 MANDOCDB_LNS = mandocdb.ln
233 $(MANDOCDB_OBJS) $(MANDOCDB_LNS): mandoc.h mdoc.h man.h config.h
235 PRECONV_OBJS = preconv.o
236 PRECONV_LNS = preconv.ln
238 $(PRECONV_OBJS) $(PRECONV_LNS): config.h
240 INDEX_MANS = mandocdb.1.html \
266 mandoc_char.7.xhtml \
291 $(INDEX_MANS): mandoc
293 INDEX_OBJS = $(INDEX_MANS) \
302 lint: llib-llibmandoc.ln llib-lmandoc.ln llib-lpreconv.ln
305 rm -f libmandoc.a $(LIBMANDOC_OBJS)
306 rm -f llib-llibmandoc.ln $(LIBMANDOC_LNS)
307 rm -f mandocdb $(MANDOCDB_OBJS)
308 rm -f llib-lmandocdb.ln $(MANDOCDB_LNS)
309 rm -f preconv $(PRECONV_OBJS)
310 rm -f llib-lpreconv.ln $(PRECONV_LNS)
311 rm -f mandoc $(MANDOC_OBJS)
312 rm -f llib-lmandoc.ln $(MANDOC_LNS)
313 rm -f config.h config.log compat.o compat.ln
315 rm -f index.html $(INDEX_OBJS)
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 $(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 $(DESTDIR)$(MANDIR)/man1
329 $(INSTALL_MAN) mandoc.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)
334 mkdir -p $(PREFIX)/snapshots
335 $(INSTALL_DATA) index.html external.png index.css $(PREFIX)
336 $(INSTALL_DATA) $(INDEX_MANS) style.css $(PREFIX)
337 $(INSTALL_DATA) mandoc.h.html man.h.html mdoc.h.html $(PREFIX)
338 $(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots
339 $(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots
340 $(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots/mdocml-$(VERSION).tar.gz
341 $(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots/mdocml-$(VERSION).md5
343 libmandoc.a: compat.o $(LIBMANDOC_OBJS)
344 $(AR) rs $@ compat.o $(LIBMANDOC_OBJS)
346 llib-llibmandoc.ln: compat.ln $(LIBMANDOC_LNS)
347 $(LINT) $(LINTFLAGS) -Clibmandoc compat.ln $(LIBMANDOC_LNS)
349 mandoc: $(MANDOC_OBJS) libmandoc.a
350 $(CC) -o $@ $(MANDOC_OBJS) libmandoc.a
352 llib-lmandoc.ln: $(MANDOC_LNS)
353 $(LINT) $(LINTFLAGS) -Cmandoc $(MANDOC_LNS)
355 # You'll need -ldb for Linux.
356 mandocdb: $(MANDOCDB_OBJS) libmandoc.a
357 $(CC) -o $@ $(MANDOCDB_OBJS) libmandoc.a
359 llib-lmandocdb.ln: $(MANDOCDB_LNS)
360 $(LINT) $(LINTFLAGS) -Cmandocdb $(MANDOCDB_LNS)
362 preconv: $(PRECONV_OBJS)
363 $(CC) -o $@ $(PRECONV_OBJS)
365 llib-lpreconv.ln: $(PRECONV_LNS)
366 $(LINT) $(LINTFLAGS) -Cpreconv $(PRECONV_LNS)
368 mdocml.md5: mdocml.tar.gz
369 md5 mdocml.tar.gz >$@
371 mdocml.tar.gz: $(SRCS)
372 mkdir -p .dist/mdocml-$(VERSION)/
373 $(INSTALL_SOURCE) $(SRCS) .dist/mdocml-$(VERSION)
374 ( cd .dist/ && tar zcf ../$@ ./ )
377 index.html: $(INDEX_OBJS)
379 config.h: config.h.pre config.h.post
381 ( cat config.h.pre; \
383 if $(CC) $(CFLAGS) -Werror -o test-strlcat test-strlcat.c >> config.log 2>&1; then \
384 echo '#define HAVE_STRLCAT'; \
387 if $(CC) $(CFLAGS) -Werror -o test-mmap test-mmap.c >> config.log 2>&1; then \
388 echo '#define HAVE_MMAP'; \
391 if $(CC) $(CFLAGS) -Werror -o test-strlcpy test-strlcpy.c >> config.log 2>&1; then \
392 echo '#define HAVE_STRLCPY'; \
402 .1.1.txt .3.3.txt .7.7.txt:
403 ./mandoc -Tascii -Wall,stop $< | col -b >$@
405 .1.1.html .3.3.html .7.7.html:
406 ./mandoc -Thtml -Wall,stop -Ostyle=style.css,man=%N.%S.html,includes=%I.html $< >$@
408 .1.1.ps .3.3.ps .7.7.ps:
409 ./mandoc -Tps -Wall,stop $< >$@
411 .1.1.xhtml .3.3.xhtml .7.7.xhtml:
412 ./mandoc -Txhtml -Wall,stop -Ostyle=style.css,man=%N.%S.xhtml,includes=%I.html $< >$@
414 .1.1.pdf .3.3.pdf .7.7.pdf:
415 ./mandoc -Tpdf -Wall,stop $< >$@
419 sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< >$@