1 .PHONY: clean install installwww
2 .SUFFIXES: .sgml .html .md5 .h .h.html
4 .SUFFIXES: .1.txt .3.txt .7.txt .8.txt
5 .SUFFIXES: .1.pdf .3.pdf .7.pdf .8.pdf
6 .SUFFIXES: .1.ps .3.ps .7.ps .8.ps
7 .SUFFIXES: .1.html .3.html .7.html .8.html
8 .SUFFIXES: .1.xhtml .3.xhtml .7.xhtml .8.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.
22 CFLAGS += -g -DHAVE_CONFIG_H -DVERSION="\"$(VERSION)\""
23 CFLAGS += -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings
25 BINDIR = $(PREFIX)/bin
26 INCLUDEDIR = $(PREFIX)/include/mandoc
27 LIBDIR = $(PREFIX)/lib/mandoc
28 MANDIR = $(PREFIX)/man
29 EXAMPLEDIR = $(PREFIX)/share/examples/mandoc
31 INSTALL_PROGRAM = $(INSTALL) -m 0755
32 INSTALL_DATA = $(INSTALL) -m 0444
33 INSTALL_LIB = $(INSTALL) -m 0644
34 INSTALL_SOURCE = $(INSTALL) -m 0644
35 INSTALL_MAN = $(INSTALL_DATA)
37 # Linux needs -ldb to compile mandocdb.
127 LIBMAN_OBJS = man.o \
131 LIBMAN_LNS = man.ln \
136 LIBMDOC_OBJS = arch.o \
147 LIBMDOC_LNS = arch.ln \
159 LIBROFF_OBJS = eqn.o \
165 LIBROFF_LNS = eqn.ln \
172 LIBMANDOC_OBJS = $(LIBMAN_OBJS) \
178 LIBMANDOC_LNS = $(LIBMAN_LNS) \
185 COMPAT_OBJS = compat_getsubopt.o \
188 COMPAT_LNS = compat_getsubopt.ln \
192 arch.o arch.ln: arch.in
194 chars.o chars.ln: chars.in
196 msec.o msec.ln: msec.in
197 roff.o roff.ln: predefs.in
201 $(LIBMAN_OBJS) $(LIBMAN_LNS): libman.h
202 $(LIBMDOC_OBJS) $(LIBMDOC_LNS): libmdoc.h
203 $(LIBROFF_OBJS) $(LIBROFF_LNS): libroff.h
204 $(LIBMANDOC_OBJS) $(LIBMANDOC_LNS): mandoc.h mdoc.h man.h libmandoc.h config.h
206 $(COMPAT_OBJS) $(COMPAT_LNS): config.h
208 MANDOC_HTML_OBJS = eqn_html.o \
213 MANDOC_HTML_LNS = eqn_html.ln \
219 MANDOC_TERM_OBJS = eqn_term.o \
226 MANDOC_TERM_LNS = eqn_term.ln \
234 MANDOC_OBJS = $(MANDOC_HTML_OBJS) \
235 $(MANDOC_TERM_OBJS) \
239 MANDOC_LNS = $(MANDOC_HTML_LNS) \
245 $(MANDOC_HTML_OBJS) $(MANDOC_HTML_LNS): html.h
246 $(MANDOC_TERM_OBJS) $(MANDOC_TERM_LNS): term.h
247 $(MANDOC_OBJS) $(MANDOC_LNS): main.h mandoc.h mdoc.h man.h config.h out.h
249 MANDOCDB_OBJS = mandocdb.o
250 MANDOCDB_LNS = mandocdb.ln
252 $(MANDOCDB_OBJS) $(MANDOCDB_LNS): mandoc.h mdoc.h man.h config.h
254 PRECONV_OBJS = preconv.o
255 PRECONV_LNS = preconv.ln
257 $(PRECONV_OBJS) $(PRECONV_LNS): config.h
259 INDEX_MANS = mandoc.1.html \
280 mandoc_char.7.xhtml \
310 $(INDEX_MANS): mandoc
312 INDEX_OBJS = $(INDEX_MANS) \
321 lint: llib-llibmandoc.ln llib-lmandoc.ln llib-lpreconv.ln
324 rm -f libmandoc.a $(LIBMANDOC_OBJS)
325 rm -f llib-llibmandoc.ln $(LIBMANDOC_LNS)
326 rm -f mandocdb $(MANDOCDB_OBJS)
327 rm -f llib-lmandocdb.ln $(MANDOCDB_LNS)
328 rm -f preconv $(PRECONV_OBJS)
329 rm -f llib-lpreconv.ln $(PRECONV_LNS)
330 rm -f mandoc $(MANDOC_OBJS)
331 rm -f llib-lmandoc.ln $(MANDOC_LNS)
332 rm -f config.h config.log $(COMPAT_OBJS) $(COMPAT_LNS)
333 rm -f mdocml.tar.gz mdocml.zip
334 rm -f index.html $(INDEX_OBJS)
337 mkdir -p $(DESTDIR)$(BINDIR)
338 mkdir -p $(DESTDIR)$(EXAMPLEDIR)
339 mkdir -p $(DESTDIR)$(LIBDIR)
340 mkdir -p $(DESTDIR)$(INCLUDEDIR)
341 mkdir -p $(DESTDIR)$(MANDIR)/man1
342 mkdir -p $(DESTDIR)$(MANDIR)/man3
343 mkdir -p $(DESTDIR)$(MANDIR)/man7
344 mkdir -p $(DESTDIR)$(MANDIR)/man8
345 $(INSTALL_PROGRAM) mandoc preconv $(DESTDIR)$(BINDIR)
346 $(INSTALL_LIB) libmandoc.a $(DESTDIR)$(LIBDIR)
347 $(INSTALL_LIB) man.h mdoc.h mandoc.h $(DESTDIR)$(INCLUDEDIR)
348 $(INSTALL_MAN) mandoc.1 preconv.1 $(DESTDIR)$(MANDIR)/man1
349 $(INSTALL_MAN) mandoc.3 $(DESTDIR)$(MANDIR)/man3
350 $(INSTALL_MAN) man.7 mdoc.7 roff.7 eqn.7 tbl.7 mandoc_char.7 $(DESTDIR)$(MANDIR)/man7
351 $(INSTALL_DATA) example.style.css $(DESTDIR)$(EXAMPLEDIR)
354 mkdir -p $(PREFIX)/snapshots
355 $(INSTALL_DATA) index.html external.png index.css $(PREFIX)
356 $(INSTALL_DATA) $(INDEX_MANS) style.css $(PREFIX)
357 $(INSTALL_DATA) mandoc.h.html man.h.html mdoc.h.html $(PREFIX)
358 $(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots
359 $(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots
360 $(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots/mdocml-$(VERSION).tar.gz
361 $(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots/mdocml-$(VERSION).md5
363 libmandoc.a: $(COMPAT_OBJS) $(LIBMANDOC_OBJS)
364 $(AR) rs $@ $(COMPAT_OBJS) $(LIBMANDOC_OBJS)
366 llib-llibmandoc.ln: $(COMPAT_LNS) $(LIBMANDOC_LNS)
367 $(LINT) $(LINTFLAGS) -Clibmandoc $(COMPAT_LNS) $(LIBMANDOC_LNS)
369 mandoc: $(MANDOC_OBJS) libmandoc.a
370 $(CC) -o $@ $(MANDOC_OBJS) libmandoc.a
372 llib-lmandoc.ln: $(MANDOC_LNS)
373 $(LINT) $(LINTFLAGS) -Cmandoc $(MANDOC_LNS)
375 mandocdb: $(MANDOCDB_OBJS) libmandoc.a
376 $(CC) -o $@ $(MANDOCDB_OBJS) libmandoc.a $(DBLIB)
378 llib-lmandocdb.ln: $(MANDOCDB_LNS)
379 $(LINT) $(LINTFLAGS) -Cmandocdb $(MANDOCDB_LNS)
381 preconv: $(PRECONV_OBJS)
382 $(CC) -o $@ $(PRECONV_OBJS)
384 llib-lpreconv.ln: $(PRECONV_LNS)
385 $(LINT) $(LINTFLAGS) -Cpreconv $(PRECONV_LNS)
387 mdocml.md5: mdocml.tar.gz
388 md5 mdocml.tar.gz >$@
390 mdocml.tar.gz: $(SRCS)
391 mkdir -p .dist/mdocml-$(VERSION)/
392 $(INSTALL_SOURCE) $(SRCS) .dist/mdocml-$(VERSION)
393 ( cd .dist/ && tar zcf ../$@ ./ )
397 mkdir -p .win32/mdocml-$(VERSION)/
398 $(INSTALL_SOURCE) $(SRCS) .win32
399 cp .win32/Makefile .win32/Makefile.old
400 grep -v DUSE_WCHAR .win32/Makefile.old >.win32/Makefile
401 ( cd .win32; CC=i586-mingw32msvc-cc AR=i586-mingw32msvc-ar CFLAGS='-DOSNAME=\"Windows\"' make; \
402 make install PREFIX=mdocml-$(VERSION) ; \
403 zip -r ../$@ mdocml-$(VERSION) )
406 index.html: $(INDEX_OBJS)
408 config.h: config.h.pre config.h.post
410 ( cat config.h.pre; \
412 if $(CC) $(CFLAGS) -Werror -o test-strptime test-strptime.c >> config.log 2>&1; then \
413 echo '#define HAVE_STRPTIME'; \
416 if $(CC) $(CFLAGS) -Werror -o test-getsubopt test-getsubopt.c >> config.log 2>&1; then \
417 echo '#define HAVE_GETSUBOPT'; \
420 if $(CC) $(CFLAGS) -Werror -o test-strlcat test-strlcat.c >> config.log 2>&1; then \
421 echo '#define HAVE_STRLCAT'; \
424 if $(CC) $(CFLAGS) -Werror -o test-mmap test-mmap.c >> config.log 2>&1; then \
425 echo '#define HAVE_MMAP'; \
428 if $(CC) $(CFLAGS) -Werror -o test-strlcpy test-strlcpy.c >> config.log 2>&1; then \
429 echo '#define HAVE_STRLCPY'; \
439 .1.1.txt .3.3.txt .7.7.txt .8.8.txt:
440 ./mandoc -Tascii -Wall,stop $< | col -b >$@
442 .1.1.html .3.3.html .7.7.html .8.8.html:
443 ./mandoc -Thtml -Wall,stop -Ostyle=style.css,man=%N.%S.html,includes=%I.html $< >$@
445 .1.1.ps .3.3.ps .7.7.ps .8.8.ps:
446 ./mandoc -Tps -Wall,stop $< >$@
448 .1.1.xhtml .3.3.xhtml .7.7.xhtml .8.8.xhtml:
449 ./mandoc -Txhtml -Wall,stop -Ostyle=style.css,man=%N.%S.xhtml,includes=%I.html $< >$@
451 .1.1.pdf .3.3.pdf .7.7.pdf .8.8.pdf:
452 ./mandoc -Tpdf -Wall,stop $< >$@
456 sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< >$@