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 # If your system doesn't support multi-byte functions (specifically
17 # setlocale(), wcwidth(), putwchar()), then remove -DUSE_WCHAR. You'll
18 # still be able to use -Tlocale, but it becomes a synonym for -Tascii.
19 CFLAGS += -g -DUSE_WCHAR -DHAVE_CONFIG_H -DVERSION="\"$(VERSION)\""
20 CFLAGS += -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings
22 BINDIR = $(PREFIX)/bin
23 INCLUDEDIR = $(PREFIX)/include/mandoc
24 LIBDIR = $(PREFIX)/lib/mandoc
25 MANDIR = $(PREFIX)/man
26 EXAMPLEDIR = $(PREFIX)/share/examples/mandoc
28 INSTALL_PROGRAM = $(INSTALL) -m 0755
29 INSTALL_DATA = $(INSTALL) -m 0444
30 INSTALL_LIB = $(INSTALL) -m 0644
31 INSTALL_MAN = $(INSTALL_DATA)
112 LIBMAN_OBJS = man.o \
116 LIBMAN_LNS = man.ln \
121 LIBMDOC_OBJS = arch.o \
132 LIBMDOC_LNS = arch.ln \
144 LIBROFF_OBJS = eqn.o \
150 LIBROFF_LNS = eqn.ln \
157 LIBMANDOC_OBJS = $(LIBMAN_OBJS) \
163 LIBMANDOC_LNS = $(LIBMAN_LNS) \
170 arch.o arch.ln: arch.in
172 chars.o chars.ln: chars.in
174 msec.o msec.ln: msec.in
178 $(LIBMAN_OBJS) $(LIBMAN_LNS): libman.h
179 $(LIBMDOC_OBJS) $(LIBMDOC_LNS): libmdoc.h
180 $(LIBROFF_OBJS) $(LIBROFF_LNS): libroff.h
181 $(LIBMANDOC_OBJS) $(LIBMANDOC_LNS): mandoc.h mdoc.h man.h libmandoc.h config.h
183 MANDOC_HTML_OBJS = html.o \
187 MANDOC_HTML_LNS = html.ln \
192 MANDOC_TERM_OBJS = man_term.o \
198 MANDOC_TERM_LNS = man_term.ln \
205 MANDOC_OBJS = $(MANDOC_HTML_OBJS) \
206 $(MANDOC_TERM_OBJS) \
210 MANDOC_LNS = $(MANDOC_HTML_LNS) \
216 $(MANDOC_HTML_OBJS) $(MANDOC_HTML_LNS): html.h
217 $(MANDOC_TERM_OBJS) $(MANDOC_TERM_LNS): term.h
218 $(MANDOC_OBJS) $(MANDOC_LNS): main.h mandoc.h mdoc.h man.h config.h out.h
220 compat.o compat.ln: config.h
222 MAKEWHATIS_OBJS = makewhatis.o
223 MAKEWHATIS_LNS = makewhatis.ln
225 $(MAKEWHATIS_OBJS) $(MAKEWHATIS_LNS): mandoc.h mdoc.h man.h config.h
227 INDEX_MANS = makewhatis.1.html \
253 mandoc_char.7.xhtml \
273 $(INDEX_MANS): mandoc
275 INDEX_OBJS = $(INDEX_MANS) \
284 lint: llib-llibmandoc.ln llib-lmandoc.ln
287 rm -f libmandoc.a $(LIBMANDOC_OBJS)
288 rm -f llib-llibmandoc.ln $(LIBMANDOC_LNS)
289 rm -f makewhatis $(MAKEWHATIS_OBJS)
290 rm -f llib-lmakewhatis.ln $(MAKEWHATIS_LNS)
291 rm -f mandoc $(MANDOC_OBJS)
292 rm -f llib-lmandoc.ln $(MANDOC_LNS)
293 rm -f config.h config.log compat.o compat.ln
295 rm -f index.html $(INDEX_OBJS)
298 mkdir -p $(DESTDIR)$(BINDIR)
299 mkdir -p $(DESTDIR)$(EXAMPLEDIR)
300 mkdir -p $(DESTDIR)$(LIBDIR)
301 mkdir -p $(DESTDIR)$(INCLUDEDIR)
302 mkdir -p $(DESTDIR)$(MANDIR)/man1
303 mkdir -p $(DESTDIR)$(MANDIR)/man3
304 mkdir -p $(DESTDIR)$(MANDIR)/man7
305 $(INSTALL_PROGRAM) mandoc $(DESTDIR)$(BINDIR)
306 $(INSTALL_LIB) libmandoc.a $(DESTDIR)$(LIBDIR)
307 $(INSTALL_LIB) mandoc.h $(DESTDIR)$(INCLUDEDIR)
308 $(INSTALL_MAN) mandoc.1 $(DESTDIR)$(MANDIR)/man1
309 $(INSTALL_MAN) mandoc.3 $(DESTDIR)$(MANDIR)/man3
310 $(INSTALL_MAN) man.7 mdoc.7 roff.7 eqn.7 tbl.7 mandoc_char.7 $(DESTDIR)$(MANDIR)/man7
311 $(INSTALL_DATA) example.style.css $(DESTDIR)$(EXAMPLEDIR)
314 mkdir -p $(PREFIX)/snapshots
315 $(INSTALL_DATA) index.html external.png index.css $(PREFIX)
316 $(INSTALL_DATA) $(INDEX_MANS) style.css $(PREFIX)
317 $(INSTALL_DATA) mandoc.h.html man.h.html mdoc.h.html $(PREFIX)
318 $(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots
319 $(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots
320 $(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots/mdocml-$(VERSION).tar.gz
321 $(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots/mdocml-$(VERSION).md5
323 libmandoc.a: compat.o $(LIBMANDOC_OBJS)
324 $(AR) rs $@ compat.o $(LIBMANDOC_OBJS)
326 llib-llibmandoc.ln: compat.ln $(LIBMANDOC_LNS)
327 $(LINT) $(LINTFLAGS) -Clibmandoc compat.ln $(LIBMANDOC_LNS)
329 mandoc: $(MANDOC_OBJS) libmandoc.a
330 $(CC) -o $@ $(MANDOC_OBJS) libmandoc.a
332 # You'll need -ldb for Linux.
333 makewhatis: $(MAKEWHATIS_OBJS) libmandoc.a
334 $(CC) -o $@ $(MAKEWHATIS_OBJS) libmandoc.a
336 llib-lmandoc.ln: $(MANDOC_LNS)
337 $(LINT) $(LINTFLAGS) -Cmandoc $(MANDOC_LNS)
339 llib-lmakewhatis.ln: $(MAKEWHATIS_LNS)
340 $(LINT) $(LINTFLAGS) -Cmakewhatis $(MAKEWHATIS_LNS)
342 mdocml.md5: mdocml.tar.gz
343 md5 mdocml.tar.gz >$@
345 mdocml.tar.gz: $(SRCS)
346 mkdir -p .dist/mdocml-$(VERSION)/
347 $(INSTALL) -m 0444 $(SRCS) .dist/mdocml-$(VERSION)
348 ( cd .dist/ && tar zcf ../$@ ./ )
351 index.html: $(INDEX_OBJS)
353 config.h: config.h.pre config.h.post
355 ( cat config.h.pre; \
357 if $(CC) $(CFLAGS) -Werror -o test-strlcat test-strlcat.c >> config.log 2>&1; then \
358 echo '#define HAVE_STRLCAT'; \
361 if $(CC) $(CFLAGS) -Werror -o test-strlcpy test-strlcpy.c >> config.log 2>&1; then \
362 echo '#define HAVE_STRLCPY'; \
372 .1.1.txt .3.3.txt .7.7.txt:
373 ./mandoc -Tascii -Wall,stop $< | col -b >$@
375 .1.1.html .3.3.html .7.7.html:
376 ./mandoc -Thtml -Wall,stop -Ostyle=style.css,man=%N.%S.html,includes=%I.html $< >$@
378 .1.1.ps .3.3.ps .7.7.ps:
379 ./mandoc -Tps -Wall,stop $< >$@
381 .1.1.xhtml .3.3.xhtml .7.7.xhtml:
382 ./mandoc -Txhtml -Wall,stop -Ostyle=style.css,man=%N.%S.xhtml,includes=%I.html $< >$@
384 .1.1.pdf .3.3.pdf .7.7.pdf:
385 ./mandoc -Tpdf -Wall,stop $< >$@
389 sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< >$@