- rm -f $(CLEAN)
-
-regress: mdocml $(SUCCESS) $(FAIL)
- @for f in $(SUCCESS) ; do \
- echo "./mdocml $$f" ; \
- ./mdocml $$f || exit 1 ; \
- done
-
-llib-llibmdoc.ln: macro.ln mdoc.ln hash.ln strings.ln xstd.ln argv.ln validate.ln action.ln
- $(LINT) $(LINTFLAGS) -Clibmdoc mdoc.ln macro.ln hash.ln strings.ln xstd.ln argv.ln validate.ln action.ln
-
-llib-lmdocml.ln: mdocml.ln tree.ln llib-llibmdoc.ln
- $(LINT) $(LINTFLAGS) -Cmdocml mdocml.ln tree.ln llib-llibmdoc.ln
-
-macro.ln: macro.c private.h
-
-macro.o: macro.c private.h
-
-strings.ln: strings.c private.h
-
-strings.o: strings.c private.h
-
-tree.ln: tree.c mdoc.h
-
-tree.o: tree.c mdoc.h
-
-hash.ln: hash.c private.h
-
-hash.o: hash.c private.h
-
-mdoc.ln: mdoc.c private.h
-
-mdoc.o: mdoc.c private.h
-
-mdocml.ln: mdocml.c mdoc.h
-
-mdocml.o: mdocml.c mdoc.h
-
-xstd.ln: xstd.c private.h
-
-xstd.o: xstd.c private.h
-
-argv.ln: argv.c private.h
-
-argv.o: argv.c private.h
-
-validate.ln: validate.c private.h
-
-validate.o: validate.c private.h
-
-action.ln: action.c private.h
-
-action.o: action.c private.h
-
-private.h: mdoc.h
-
-libmdoc.a: macro.o mdoc.o hash.o strings.o xstd.o argv.o validate.o action.o
- $(AR) rs $@ macro.o mdoc.o hash.o strings.o xstd.o argv.o validate.o action.o
-
+ rm -f libmandoc.a $(LIBMANDOC_OBJS)
+ rm -f llib-llibmandoc.ln $(LIBMANDOC_LNS)
+ rm -f makewhatis $(MAKEWHATIS_OBJS)
+ rm -f llib-lmakewhatis.ln $(MAKEWHATIS_LNS)
+ rm -f preconv $(PRECONV_OBJS)
+ rm -f llib-lpreconv.ln $(PRECONV_LNS)
+ rm -f mandoc $(MANDOC_OBJS)
+ rm -f llib-lmandoc.ln $(MANDOC_LNS)
+ rm -f config.h config.log compat.o compat.ln
+ rm -f mdocml.tar.gz
+ rm -f index.html $(INDEX_OBJS)
+
+install: all
+ mkdir -p $(DESTDIR)$(BINDIR)
+ mkdir -p $(DESTDIR)$(EXAMPLEDIR)
+ mkdir -p $(DESTDIR)$(LIBDIR)
+ mkdir -p $(DESTDIR)$(INCLUDEDIR)
+ mkdir -p $(DESTDIR)$(MANDIR)/man1
+ mkdir -p $(DESTDIR)$(MANDIR)/man3
+ mkdir -p $(DESTDIR)$(MANDIR)/man7
+ $(INSTALL_PROGRAM) mandoc $(DESTDIR)$(BINDIR)
+ $(INSTALL_LIB) libmandoc.a $(DESTDIR)$(LIBDIR)
+ $(INSTALL_LIB) mandoc.h $(DESTDIR)$(INCLUDEDIR)
+ $(INSTALL_MAN) mandoc.1 $(DESTDIR)$(MANDIR)/man1
+ $(INSTALL_MAN) mandoc.3 $(DESTDIR)$(MANDIR)/man3
+ $(INSTALL_MAN) man.7 mdoc.7 roff.7 eqn.7 tbl.7 mandoc_char.7 $(DESTDIR)$(MANDIR)/man7
+ $(INSTALL_DATA) example.style.css $(DESTDIR)$(EXAMPLEDIR)
+
+installwww: www
+ mkdir -p $(PREFIX)/snapshots
+ $(INSTALL_DATA) index.html external.png index.css $(PREFIX)
+ $(INSTALL_DATA) $(INDEX_MANS) style.css $(PREFIX)
+ $(INSTALL_DATA) mandoc.h.html man.h.html mdoc.h.html $(PREFIX)
+ $(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots
+ $(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots
+ $(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots/mdocml-$(VERSION).tar.gz
+ $(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots/mdocml-$(VERSION).md5
+
+libmandoc.a: compat.o $(LIBMANDOC_OBJS)
+ $(AR) rs $@ compat.o $(LIBMANDOC_OBJS)
+
+llib-llibmandoc.ln: compat.ln $(LIBMANDOC_LNS)
+ $(LINT) $(LINTFLAGS) -Clibmandoc compat.ln $(LIBMANDOC_LNS)
+
+mandoc: $(MANDOC_OBJS) libmandoc.a
+ $(CC) -o $@ $(MANDOC_OBJS) libmandoc.a
+
+llib-lmandoc.ln: $(MANDOC_LNS)
+ $(LINT) $(LINTFLAGS) -Cmandoc $(MANDOC_LNS)
+
+# You'll need -ldb for Linux.
+makewhatis: $(MAKEWHATIS_OBJS) libmandoc.a
+ $(CC) -o $@ $(MAKEWHATIS_OBJS) libmandoc.a
+
+llib-lmakewhatis.ln: $(MAKEWHATIS_LNS)
+ $(LINT) $(LINTFLAGS) -Cmakewhatis $(MAKEWHATIS_LNS)
+
+preconv: $(PRECONV_OBJS)
+ $(CC) -o $@ $(PRECONV_OBJS)
+
+llib-lpreconv.ln: $(PRECONV_LNS)
+ $(LINT) $(LINTFLAGS) -Cpreconv $(PRECONV_LNS)
+
+mdocml.md5: mdocml.tar.gz
+ md5 mdocml.tar.gz >$@
+
+mdocml.tar.gz: $(SRCS)
+ mkdir -p .dist/mdocml-$(VERSION)/
+ $(INSTALL) -m 0444 $(SRCS) .dist/mdocml-$(VERSION)
+ ( cd .dist/ && tar zcf ../$@ ./ )
+ rm -rf .dist/
+
+index.html: $(INDEX_OBJS)
+
+config.h: config.h.pre config.h.post
+ rm -f config.log
+ ( cat config.h.pre; \
+ echo; \
+ if $(CC) $(CFLAGS) -Werror -o test-strlcat test-strlcat.c >> config.log 2>&1; then \
+ echo '#define HAVE_STRLCAT'; \
+ rm test-strlcat; \
+ fi; \
+ if $(CC) $(CFLAGS) -Werror -o test-strlcpy test-strlcpy.c >> config.log 2>&1; then \
+ echo '#define HAVE_STRLCPY'; \
+ rm test-strlcpy; \
+ fi; \
+ echo; \
+ cat config.h.post \
+ ) > $@
+
+.h.h.html:
+ highlight -I $< >$@
+
+.1.1.txt .3.3.txt .7.7.txt:
+ ./mandoc -Tascii -Wall,stop $< | col -b >$@
+
+.1.1.html .3.3.html .7.7.html:
+ ./mandoc -Thtml -Wall,stop -Ostyle=style.css,man=%N.%S.html,includes=%I.html $< >$@
+
+.1.1.ps .3.3.ps .7.7.ps:
+ ./mandoc -Tps -Wall,stop $< >$@
+
+.1.1.xhtml .3.3.xhtml .7.7.xhtml:
+ ./mandoc -Txhtml -Wall,stop -Ostyle=style.css,man=%N.%S.xhtml,includes=%I.html $< >$@
+
+.1.1.pdf .3.3.pdf .7.7.pdf:
+ ./mandoc -Tpdf -Wall,stop $< >$@
+
+.sgml.html:
+ validate --warn $<
+ sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< >$@