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_MAN = $(INSTALL_DATA)
114 LIBMAN_OBJS = man.o \
118 LIBMAN_LNS = man.ln \
123 LIBMDOC_OBJS = arch.o \
134 LIBMDOC_LNS = arch.ln \
146 LIBROFF_OBJS = eqn.o \
152 LIBROFF_LNS = eqn.ln \
159 LIBMANDOC_OBJS = $(LIBMAN_OBJS) \
165 LIBMANDOC_LNS = $(LIBMAN_LNS) \
172 arch.o arch.ln: arch.in
174 chars.o chars.ln: chars.in
176 msec.o msec.ln: msec.in
180 $(LIBMAN_OBJS) $(LIBMAN_LNS): libman.h
181 $(LIBMDOC_OBJS) $(LIBMDOC_LNS): libmdoc.h
182 $(LIBROFF_OBJS) $(LIBROFF_LNS): libroff.h
183 $(LIBMANDOC_OBJS) $(LIBMANDOC_LNS): mandoc.h mdoc.h man.h libmandoc.h config.h
185 MANDOC_HTML_OBJS = html.o \
189 MANDOC_HTML_LNS = html.ln \
194 MANDOC_TERM_OBJS = man_term.o \
200 MANDOC_TERM_LNS = man_term.ln \
207 MANDOC_OBJS = $(MANDOC_HTML_OBJS) \
208 $(MANDOC_TERM_OBJS) \
212 MANDOC_LNS = $(MANDOC_HTML_LNS) \
218 $(MANDOC_HTML_OBJS) $(MANDOC_HTML_LNS): html.h
219 $(MANDOC_TERM_OBJS) $(MANDOC_TERM_LNS): term.h
220 $(MANDOC_OBJS) $(MANDOC_LNS): main.h mandoc.h mdoc.h man.h config.h out.h
222 compat.o compat.ln: config.h
224 MAKEWHATIS_OBJS = makewhatis.o
225 MAKEWHATIS_LNS = makewhatis.ln
227 $(MAKEWHATIS_OBJS) $(MAKEWHATIS_LNS): mandoc.h mdoc.h man.h config.h
229 INDEX_MANS = makewhatis.1.html \
255 mandoc_char.7.xhtml \
275 $(INDEX_MANS): mandoc
277 INDEX_OBJS = $(INDEX_MANS) \
286 lint: llib-llibmandoc.ln llib-lmandoc.ln
289 rm -f libmandoc.a $(LIBMANDOC_OBJS)
290 rm -f llib-llibmandoc.ln $(LIBMANDOC_LNS)
291 rm -f makewhatis $(MAKEWHATIS_OBJS)
292 rm -f llib-lmakewhatis.ln $(MAKEWHATIS_LNS)
293 rm -f mandoc $(MANDOC_OBJS)
294 rm -f llib-lmandoc.ln $(MANDOC_LNS)
295 rm -f config.h config.log compat.o compat.ln
297 rm -f index.html $(INDEX_OBJS)
300 mkdir -p $(DESTDIR)$(BINDIR)
301 mkdir -p $(DESTDIR)$(EXAMPLEDIR)
302 mkdir -p $(DESTDIR)$(LIBDIR)
303 mkdir -p $(DESTDIR)$(INCLUDEDIR)
304 mkdir -p $(DESTDIR)$(MANDIR)/man1
305 mkdir -p $(DESTDIR)$(MANDIR)/man3
306 mkdir -p $(DESTDIR)$(MANDIR)/man7
307 $(INSTALL_PROGRAM) mandoc $(DESTDIR)$(BINDIR)
308 $(INSTALL_LIB) libmandoc.a $(DESTDIR)$(LIBDIR)
309 $(INSTALL_LIB) mandoc.h $(DESTDIR)$(INCLUDEDIR)
310 $(INSTALL_MAN) mandoc.1 $(DESTDIR)$(MANDIR)/man1
311 $(INSTALL_MAN) mandoc.3 $(DESTDIR)$(MANDIR)/man3
312 $(INSTALL_MAN) man.7 mdoc.7 roff.7 eqn.7 tbl.7 mandoc_char.7 $(DESTDIR)$(MANDIR)/man7
313 $(INSTALL_DATA) example.style.css $(DESTDIR)$(EXAMPLEDIR)
316 mkdir -p $(PREFIX)/snapshots
317 $(INSTALL_DATA) index.html external.png index.css $(PREFIX)
318 $(INSTALL_DATA) $(INDEX_MANS) style.css $(PREFIX)
319 $(INSTALL_DATA) mandoc.h.html man.h.html mdoc.h.html $(PREFIX)
320 $(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots
321 $(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots
322 $(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots/mdocml-$(VERSION).tar.gz
323 $(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots/mdocml-$(VERSION).md5
325 libmandoc.a: compat.o $(LIBMANDOC_OBJS)
326 $(AR) rs $@ compat.o $(LIBMANDOC_OBJS)
328 llib-llibmandoc.ln: compat.ln $(LIBMANDOC_LNS)
329 $(LINT) $(LINTFLAGS) -Clibmandoc compat.ln $(LIBMANDOC_LNS)
331 mandoc: $(MANDOC_OBJS) libmandoc.a
332 $(CC) -o $@ $(MANDOC_OBJS) libmandoc.a
334 # You'll need -ldb for Linux.
335 makewhatis: $(MAKEWHATIS_OBJS) libmandoc.a
336 $(CC) -o $@ $(MAKEWHATIS_OBJS) libmandoc.a
338 llib-lmandoc.ln: $(MANDOC_LNS)
339 $(LINT) $(LINTFLAGS) -Cmandoc $(MANDOC_LNS)
341 llib-lmakewhatis.ln: $(MAKEWHATIS_LNS)
342 $(LINT) $(LINTFLAGS) -Cmakewhatis $(MAKEWHATIS_LNS)
344 mdocml.md5: mdocml.tar.gz
345 md5 mdocml.tar.gz >$@
347 mdocml.tar.gz: $(SRCS)
348 mkdir -p .dist/mdocml-$(VERSION)/
349 $(INSTALL) -m 0444 $(SRCS) .dist/mdocml-$(VERSION)
350 ( cd .dist/ && tar zcf ../$@ ./ )
353 index.html: $(INDEX_OBJS)
355 config.h: config.h.pre config.h.post
357 ( cat config.h.pre; \
359 if $(CC) $(CFLAGS) -Werror -o test-strlcat test-strlcat.c >> config.log 2>&1; then \
360 echo '#define HAVE_STRLCAT'; \
363 if $(CC) $(CFLAGS) -Werror -o test-strlcpy test-strlcpy.c >> config.log 2>&1; then \
364 echo '#define HAVE_STRLCPY'; \
374 .1.1.txt .3.3.txt .7.7.txt:
375 ./mandoc -Tascii -Wall,stop $< | col -b >$@
377 .1.1.html .3.3.html .7.7.html:
378 ./mandoc -Thtml -Wall,stop -Ostyle=style.css,man=%N.%S.html,includes=%I.html $< >$@
380 .1.1.ps .3.3.ps .7.7.ps:
381 ./mandoc -Tps -Wall,stop $< >$@
383 .1.1.xhtml .3.3.xhtml .7.7.xhtml:
384 ./mandoc -Txhtml -Wall,stop -Ostyle=style.css,man=%N.%S.xhtml,includes=%I.html $< >$@
386 .1.1.pdf .3.3.pdf .7.7.pdf:
387 ./mandoc -Tpdf -Wall,stop $< >$@
391 sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< >$@