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 CFLAGS += -g -DHAVE_CONFIG_H -DVERSION="\"$(VERSION)\""
17 CFLAGS += -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings
19 BINDIR = $(PREFIX)/bin
20 INCLUDEDIR = $(PREFIX)/include/mandoc
21 LIBDIR = $(PREFIX)/lib/mandoc
22 MANDIR = $(PREFIX)/man
23 EXAMPLEDIR = $(PREFIX)/share/examples/mandoc
25 INSTALL_PROGRAM = $(INSTALL) -m 0755
26 INSTALL_DATA = $(INSTALL) -m 0444
27 INSTALL_LIB = $(INSTALL) -m 0644
28 INSTALL_MAN = $(INSTALL_DATA)
109 LIBMAN_OBJS = man.o \
113 LIBMAN_LNS = man.ln \
118 LIBMDOC_OBJS = arch.o \
129 LIBMDOC_LNS = arch.ln \
141 LIBROFF_OBJS = eqn.o \
147 LIBROFF_LNS = eqn.ln \
154 LIBMANDOC_OBJS = $(LIBMAN_OBJS) \
159 LIBMANDOC_LNS = $(LIBMAN_LNS) \
165 arch.o arch.ln: arch.in
168 msec.o msec.ln: msec.in
172 $(LIBMAN_OBJS) $(LIBMAN_LNS): libman.h
173 $(LIBMDOC_OBJS) $(LIBMDOC_LNS): libmdoc.h
174 $(LIBROFF_OBJS) $(LIBROFF_LNS): libroff.h
175 $(LIBMANDOC_OBJS) $(LIBMANDOC_LNS): mandoc.h mdoc.h man.h libmandoc.h config.h
177 MANDOC_HTML_OBJS = html.o \
181 MANDOC_HTML_LNS = html.ln \
186 MANDOC_TERM_OBJS = man_term.o \
192 MANDOC_TERM_LNS = man_term.ln \
199 MANDOC_OBJS = $(MANDOC_HTML_OBJS) \
200 $(MANDOC_TERM_OBJS) \
205 MANDOC_LNS = $(MANDOC_HTML_LNS) \
212 chars.o chars.ln: chars.in
214 $(MANDOC_HTML_OBJS) $(MANDOC_HTML_LNS): html.h
215 $(MANDOC_TERM_OBJS) $(MANDOC_TERM_LNS): term.h
216 $(MANDOC_OBJS) $(MANDOC_LNS): main.h mandoc.h mdoc.h man.h config.h out.h
218 compat.o compat.ln: config.h
220 MANDOCDB_OBJS = mandoc-db.o
221 MANDOCDB_LNS = mandoc-db.ln
223 $(MANDOCDB_OBJS) $(MANDOCDB_LNS): mandoc.h mdoc.h man.h config.h
225 INDEX_MANS = mandoc.1.html \
246 mandoc_char.7.xhtml \
266 $(INDEX_MANS): mandoc
268 INDEX_OBJS = $(INDEX_MANS) \
277 lint: llib-llibmandoc.ln llib-lmandoc.ln
280 rm -f libmandoc.a $(LIBMANDOC_OBJS)
281 rm -f llib-llibmandoc.ln $(LIBMANDOC_LNS)
282 rm -f mandoc-db $(MANDOCDB_OBJS)
283 rm -f llib-lmandoc-db.ln $(MANDOCDB_LNS)
284 rm -f mandoc $(MANDOC_OBJS)
285 rm -f llib-lmandoc.ln $(MANDOC_LNS)
286 rm -f config.h config.log compat.o compat.ln
288 rm -f index.html $(INDEX_OBJS)
291 mkdir -p $(DESTDIR)$(BINDIR)
292 mkdir -p $(DESTDIR)$(EXAMPLEDIR)
293 mkdir -p $(DESTDIR)$(LIBDIR)
294 mkdir -p $(DESTDIR)$(MANDIR)/man1
295 mkdir -p $(DESTDIR)$(MANDIR)/man3
296 mkdir -p $(DESTDIR)$(MANDIR)/man7
297 $(INSTALL_PROGRAM) mandoc $(DESTDIR)$(BINDIR)
298 $(INSTALL_LIB) libmandoc.a $(DESTDIR)$(LIBDIR)
299 $(INSTALL_MAN) mandoc.1 $(DESTDIR)$(MANDIR)/man1
300 $(INSTALL_MAN) mandoc.3 $(DESTDIR)$(MANDIR)/man3
301 $(INSTALL_MAN) man.7 mdoc.7 roff.7 eqn.7 tbl.7 mandoc_char.7 $(DESTDIR)$(MANDIR)/man7
302 $(INSTALL_DATA) example.style.css $(DESTDIR)$(EXAMPLEDIR)
305 mkdir -p $(PREFIX)/snapshots
306 $(INSTALL_DATA) index.html external.png index.css $(PREFIX)
307 $(INSTALL_DATA) $(INDEX_MANS) style.css $(PREFIX)
308 $(INSTALL_DATA) mandoc.h.html man.h.html mdoc.h.html $(PREFIX)
309 $(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots
310 $(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots
311 $(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots/mdocml-$(VERSION).tar.gz
312 $(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots/mdocml-$(VERSION).md5
314 libmandoc.a: compat.o $(LIBMANDOC_OBJS)
315 $(AR) rs $@ compat.o $(LIBMANDOC_OBJS)
317 llib-llibmandoc.ln: compat.ln $(LIBMANDOC_LNS)
318 $(LINT) $(LINTFLAGS) -Clibmandoc compat.ln $(LIBMANDOC_LNS)
320 mandoc: $(MANDOC_OBJS) libmandoc.a
321 $(CC) -o $@ $(MANDOC_OBJS) libmandoc.a
323 # You'll need -ldb for Linux.
324 mandoc-db: $(MANDOCDB_OBJS) libmandoc.a
325 $(CC) -o $@ $(MANDOCDB_OBJS) libmandoc.a
327 llib-lmandoc.ln: $(MANDOC_LNS)
328 $(LINT) $(LINTFLAGS) -Cmandoc $(MANDOC_LNS)
330 llib-lmandoc-db.ln: $(MANDOCDB_LNS)
331 $(LINT) $(LINTFLAGS) -Cmandoc-db $(MANDOCDB_LNS)
333 mdocml.md5: mdocml.tar.gz
334 md5 mdocml.tar.gz >$@
336 mdocml.tar.gz: $(SRCS)
337 mkdir -p .dist/mdocml-$(VERSION)/
338 $(INSTALL) -m 0444 $(SRCS) .dist/mdocml-$(VERSION)
339 ( cd .dist/ && tar zcf ../$@ ./ )
342 index.html: $(INDEX_OBJS)
344 config.h: config.h.pre config.h.post
346 ( cat config.h.pre; \
348 if $(CC) $(CFLAGS) -Werror -o test-strlcat test-strlcat.c >> config.log 2>&1; then \
349 echo '#define HAVE_STRLCAT'; \
352 if $(CC) $(CFLAGS) -Werror -o test-strlcpy test-strlcpy.c >> config.log 2>&1; then \
353 echo '#define HAVE_STRLCPY'; \
363 .1.1.txt .3.3.txt .7.7.txt:
364 ./mandoc -Tascii -Wall,stop $< | col -b >$@
366 .1.1.html .3.3.html .7.7.html:
367 ./mandoc -Thtml -Wall,stop -Ostyle=style.css,man=%N.%S.html,includes=%I.html $< >$@
369 .1.1.ps .3.3.ps .7.7.ps:
370 ./mandoc -Tps -Wall,stop $< >$@
372 .1.1.xhtml .3.3.xhtml .7.7.xhtml:
373 ./mandoc -Txhtml -Wall,stop -Ostyle=style.css,man=%N.%S.xhtml,includes=%I.html $< >$@
375 .1.1.pdf .3.3.pdf .7.7.pdf:
376 ./mandoc -Tpdf -Wall,stop $< >$@
380 sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< >$@