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.
13 # CFLAGS += -DOSNAME="\"OpenBSD 4.5\""
18 # IFF your system supports multi-byte functions (setlocale(), wcwidth(),
19 # putwchar()) AND has __STDC_ISO_10646__ (that is, wchar_t is simply a
20 # UCS-4 value) should you define USE_WCHAR. If you define it and your
21 # system DOESN'T support this, -Tlocale will produce garbage.
22 # If you don't define it, -Tlocale is a synonym for -Tacsii.
26 # If your system has manpath(1), uncomment this. This is most any
27 # system that's not OpenBSD or NetBSD. If uncommented, apropos(1),
28 # mandocdb(8), and man.cgi will popen(3) manpath(1) to get the MANPATH
30 #CFLAGS += -DUSE_MANPATH
32 # If your system supports static binaries only, uncomment this. This
33 # appears only to be BSD UNIX systems (Mac OS X has no support and Linux
34 # requires -pthreads for static libdb).
37 CFLAGS
+= -g
-DHAVE_CONFIG_H
-DVERSION
="\"$(VERSION)\""
38 CFLAGS
+= -W
-Wall
-Wstrict-prototypes
-Wno-unused-parameter
-Wwrite-strings
41 HTDOCDIR
= $(WWWPREFIX
)/htdocs
42 CGIBINDIR
= $(WWWPREFIX
)/cgi-bin
43 BINDIR
= $(PREFIX
)/bin
44 INCLUDEDIR
= $(PREFIX
)/include/mandoc
45 LIBDIR
= $(PREFIX
)/lib
/mandoc
46 MANDIR
= $(PREFIX
)/man
47 EXAMPLEDIR
= $(PREFIX
)/share
/examples
/mandoc
49 INSTALL_PROGRAM
= $(INSTALL
) -m
0755
50 INSTALL_DATA
= $(INSTALL
) -m
0444
51 INSTALL_LIB
= $(INSTALL
) -m
0644
52 INSTALL_SOURCE
= $(INSTALL
) -m
0644
53 INSTALL_MAN
= $(INSTALL_DATA
)
55 # Non-BSD systems (Linux, etc.) need -ldb to compile mandocdb and
57 # However, if you don't have -ldb at all (or it's not native), then
58 # comment out apropos and mandocdb.
61 DBBIN
= apropos mandocdb man.cgi catman whatis
62 DBLN
= llib-lapropos.ln llib-lmandocdb.ln llib-lman.cgi.ln llib-lcatman.ln
64 all: mandoc preconv demandoc
$(DBBIN
)
172 LIBMAN_OBJS
= man.o \
176 LIBMAN_LNS
= man.ln \
181 LIBMDOC_OBJS
= arch.o \
191 LIBMDOC_LNS
= arch.ln \
202 LIBROFF_OBJS
= eqn.o \
208 LIBROFF_LNS
= eqn.ln \
215 LIBMANDOC_OBJS
= $(LIBMAN_OBJS
) \
222 LIBMANDOC_LNS
= $(LIBMAN_LNS
) \
230 COMPAT_OBJS
= compat_fgetln.o \
234 COMPAT_LNS
= compat_fgetln.ln \
235 compat_getsubopt.ln \
239 arch.o arch.ln
: arch.in
241 chars.o chars.ln
: chars.in
243 msec.o msec.ln
: msec.in
244 roff.o roff.ln
: predefs.in
248 $(LIBMAN_OBJS
) $(LIBMAN_LNS
): libman.h
249 $(LIBMDOC_OBJS
) $(LIBMDOC_LNS
): libmdoc.h
250 $(LIBROFF_OBJS
) $(LIBROFF_LNS
): libroff.h
251 $(LIBMANDOC_OBJS
) $(LIBMANDOC_LNS
): mandoc.h mdoc.h man.h libmandoc.h config.h
253 $(COMPAT_OBJS
) $(COMPAT_LNS
): config.h
255 MANDOC_HTML_OBJS
= eqn_html.o \
260 MANDOC_HTML_LNS
= eqn_html.ln \
266 MANDOC_MAN_OBJS
= mdoc_man.o
267 MANDOC_MAN_LNS
= mdoc_man.ln
269 MANDOC_TERM_OBJS
= eqn_term.o \
276 MANDOC_TERM_LNS
= eqn_term.ln \
284 MANDOC_OBJS
= $(MANDOC_HTML_OBJS
) \
286 $(MANDOC_TERM_OBJS
) \
290 MANDOC_LNS
= $(MANDOC_HTML_LNS
) \
297 $(MANDOC_HTML_OBJS
) $(MANDOC_HTML_LNS
): html.h
298 $(MANDOC_TERM_OBJS
) $(MANDOC_TERM_LNS
): term.h
299 $(MANDOC_OBJS
) $(MANDOC_LNS
): main.h mandoc.h mdoc.h man.h config.h out.h
301 MANDOCDB_OBJS
= mandocdb.o manpath.o
302 MANDOCDB_LNS
= mandocdb.ln manpath.ln
304 $(MANDOCDB_OBJS
) $(MANDOCDB_LNS
): mandocdb.h mandoc.h mdoc.h man.h config.h manpath.h
306 PRECONV_OBJS
= preconv.o
307 PRECONV_LNS
= preconv.ln
309 $(PRECONV_OBJS
) $(PRECONV_LNS
): config.h
311 APROPOS_OBJS
= apropos.o apropos_db.o manpath.o
312 APROPOS_LNS
= apropos.ln apropos_db.ln manpath.ln
314 $(APROPOS_OBJS
) $(APROPOS_LNS
): config.h mandoc.h apropos_db.h manpath.h mandocdb.h
316 CGI_OBJS
= $(MANDOC_HTML_OBJS
) \
318 $(MANDOC_TERM_OBJS
) \
325 CGI_LNS
= $(MANDOC_HTML_LNS
) \
334 $(CGI_OBJS
) $(CGI_LNS
): main.h mdoc.h man.h out.h config.h mandoc.h apropos_db.h manpath.h mandocdb.h
336 CATMAN_OBJS
= catman.o manpath.o
337 CATMAN_LNS
= catman.ln manpath.ln
339 $(CATMAN_OBJS
) $(CATMAN_LNS
): config.h mandoc.h manpath.h mandocdb.h
341 DEMANDOC_OBJS
= demandoc.o
342 DEMANDOC_LNS
= demandoc.ln
344 $(DEMANDOC_OBJS
) $(DEMANDOC_LNS
): config.h
346 INDEX_MANS
= apropos
.1.html \
392 mandoc_char
.7.xhtml \
422 $(INDEX_MANS
): mandoc
424 INDEX_OBJS
= $(INDEX_MANS
) \
433 lint
: llib-lmandoc.ln llib-lpreconv.ln llib-ldemandoc.ln
$(DBLN
)
436 rm -f libmandoc.a
$(LIBMANDOC_OBJS
)
437 rm -f llib-llibmandoc.ln
$(LIBMANDOC_LNS
)
438 rm -f mandocdb
$(MANDOCDB_OBJS
)
439 rm -f llib-lmandocdb.ln
$(MANDOCDB_LNS
)
440 rm -f preconv
$(PRECONV_OBJS
)
441 rm -f llib-lpreconv.ln
$(PRECONV_LNS
)
442 rm -f apropos whatis
$(APROPOS_OBJS
)
443 rm -f llib-lapropos.ln
$(APROPOS_LNS
)
444 rm -f man.cgi
$(CGI_OBJS
)
445 rm -f llib-lman.cgi.ln
$(CGI_LNS
)
446 rm -f catman
$(CATMAN_OBJS
)
447 rm -f llib-lcatman.ln
$(CATMAN_LNS
)
448 rm -f demandoc
$(DEMANDOC_OBJS
)
449 rm -f llib-ldemandoc.ln
$(DEMANDOC_LNS
)
450 rm -f mandoc
$(MANDOC_OBJS
)
451 rm -f llib-lmandoc.ln
$(MANDOC_LNS
)
452 rm -f config.h config.log
$(COMPAT_OBJS
) $(COMPAT_LNS
)
453 rm -f mdocml.
tar.gz mdocml-win32.zip mdocml-win64.zip mdocml-macosx.zip
454 rm -f index.html
$(INDEX_OBJS
)
455 rm -rf test-fgetln.dSYM
456 rm -rf test-strlcpy.dSYM
457 rm -rf test-strlcat.dSYM
458 rm -rf test-strptime.dSYM
459 rm -rf test-mmap.dSYM
460 rm -rf test-getsubopt.dSYM
467 mkdir
-p
$(DESTDIR
)$(BINDIR
)
468 mkdir
-p
$(DESTDIR
)$(EXAMPLEDIR
)
469 mkdir
-p
$(DESTDIR
)$(LIBDIR
)
470 mkdir
-p
$(DESTDIR
)$(INCLUDEDIR
)
471 mkdir
-p
$(DESTDIR
)$(MANDIR
)/man1
472 mkdir
-p
$(DESTDIR
)$(MANDIR
)/man3
473 mkdir
-p
$(DESTDIR
)$(MANDIR
)/man7
474 $(INSTALL_PROGRAM
) mandoc preconv demandoc
$(DESTDIR
)$(BINDIR
)
475 $(INSTALL_LIB
) libmandoc.a
$(DESTDIR
)$(LIBDIR
)
476 $(INSTALL_LIB
) man.h mdoc.h mandoc.h
$(DESTDIR
)$(INCLUDEDIR
)
477 $(INSTALL_MAN
) mandoc
.1 preconv
.1 demandoc
.1 $(DESTDIR
)$(MANDIR
)/man1
478 $(INSTALL_MAN
) mandoc
.3 $(DESTDIR
)$(MANDIR
)/man3
479 $(INSTALL_MAN
) man
.7 mdoc
.7 roff
.7 eqn
.7 tbl
.7 mandoc_char
.7 $(DESTDIR
)$(MANDIR
)/man7
480 $(INSTALL_DATA
) example.style.css
$(DESTDIR
)$(EXAMPLEDIR
)
483 mkdir
-p
$(DESTDIR
)$(CGIBINDIR
)
484 mkdir
-p
$(DESTDIR
)$(HTDOCDIR
)
485 $(INSTALL_PROGRAM
) man.cgi
$(DESTDIR
)$(CGIBINDIR
)
486 $(INSTALL_DATA
) example.style.css
$(DESTDIR
)$(HTDOCDIR
)/man.css
487 $(INSTALL_DATA
) man-cgi.css
$(DESTDIR
)$(HTDOCDIR
)
490 mkdir
-p
$(PREFIX
)/snapshots
491 mkdir
-p
$(PREFIX
)/binaries
492 $(INSTALL_DATA
) index.html external.png index.css
$(PREFIX
)
493 $(INSTALL_DATA
) $(INDEX_MANS
) style.css
$(PREFIX
)
494 $(INSTALL_DATA
) mandoc.h.html man.h.html mdoc.h.html
$(PREFIX
)
495 $(INSTALL_DATA
) mdocml.
tar.gz
$(PREFIX
)/snapshots
496 $(INSTALL_DATA
) mdocml.md5
$(PREFIX
)/snapshots
497 $(INSTALL_DATA
) mdocml.
tar.gz
$(PREFIX
)/snapshots
/mdocml-
$(VERSION
).
tar.gz
498 $(INSTALL_DATA
) mdocml.md5
$(PREFIX
)/snapshots
/mdocml-
$(VERSION
).md5
500 libmandoc.a
: $(COMPAT_OBJS
) $(LIBMANDOC_OBJS
)
501 $(AR
) rs
$@
$(COMPAT_OBJS
) $(LIBMANDOC_OBJS
)
503 llib-llibmandoc.ln
: $(COMPAT_LNS
) $(LIBMANDOC_LNS
)
504 $(LINT
) $(LINTFLAGS
) -Clibmandoc
$(COMPAT_LNS
) $(LIBMANDOC_LNS
)
506 mandoc
: $(MANDOC_OBJS
) libmandoc.a
507 $(CC
) $(LDFLAGS
) -o
$@
$(MANDOC_OBJS
) libmandoc.a
509 llib-lmandoc.ln
: $(MANDOC_LNS
) llib-llibmandoc.ln
510 $(LINT
) $(LINTFLAGS
) -Cmandoc
$(MANDOC_LNS
) llib-llibmandoc.ln
512 mandocdb
: $(MANDOCDB_OBJS
) libmandoc.a
513 $(CC
) $(LDFLAGS
) -o
$@
$(MANDOCDB_OBJS
) libmandoc.a
$(DBLIB
)
515 llib-lmandocdb.ln
: $(MANDOCDB_LNS
) llib-llibmandoc.ln
516 $(LINT
) $(LINTFLAGS
) -Cmandocdb
$(MANDOCDB_LNS
) llib-llibmandoc.ln
518 preconv
: $(PRECONV_OBJS
)
519 $(CC
) $(LDFLAGS
) -o
$@
$(PRECONV_OBJS
)
521 llib-lpreconv.ln
: $(PRECONV_LNS
) llib-llibmandoc.ln
522 $(LINT
) $(LINTFLAGS
) -Cpreconv
$(PRECONV_LNS
) llib-llibmandoc.ln
527 apropos
: $(APROPOS_OBJS
) libmandoc.a
528 $(CC
) $(LDFLAGS
) -o
$@
$(APROPOS_OBJS
) libmandoc.a
$(DBLIB
)
530 llib-lapropos.ln
: $(APROPOS_LNS
) llib-llibmandoc.ln
531 $(LINT
) $(LINTFLAGS
) -Capropos
$(APROPOS_LNS
) llib-llibmandoc.ln
533 catman
: $(CATMAN_OBJS
) libmandoc.a
534 $(CC
) $(LDFLAGS
) -o
$@
$(CATMAN_OBJS
) libmandoc.a
$(DBLIB
)
536 llib-lcatman.ln
: $(CATMAN_LNS
) llib-llibmandoc.ln
537 $(LINT
) $(LINTFLAGS
) -Ccatman
$(CATMAN_LNS
) llib-llibmandoc.ln
539 man.cgi
: $(CGI_OBJS
) libmandoc.a
540 $(CC
) $(LDFLAGS
) $(STATIC
) -o
$@
$(CGI_OBJS
) libmandoc.a
$(DBLIB
)
542 llib-lman.cgi.ln
: $(CGI_LNS
) llib-llibmandoc.ln
543 $(LINT
) $(LINTFLAGS
) -Cman.cgi
$(CGI_LNS
) llib-llibmandoc.ln
545 demandoc
: $(DEMANDOC_OBJS
) libmandoc.a
546 $(CC
) $(LDFLAGS
) -o
$@
$(DEMANDOC_OBJS
) libmandoc.a
548 llib-ldemandoc.ln
: $(DEMANDOC_LNS
) llib-llibmandoc.ln
549 $(LINT
) $(LINTFLAGS
) -Cdemandoc
$(DEMANDOC_LNS
) llib-llibmandoc.ln
551 mdocml.md5
: mdocml.
tar.gz
552 md5 mdocml.
tar.gz
>$@
554 mdocml.
tar.gz
: $(SRCS
)
555 mkdir
-p .
dist/mdocml-
$(VERSION
)/
556 $(INSTALL_SOURCE
) $(SRCS
) .
dist/mdocml-
$(VERSION
)
557 ( cd .
dist/ && tar zcf ..
/$@ .
/ )
560 mdocml-win32.zip
: $(SRCS
)
561 mkdir
-p .win32
/mdocml-
$(VERSION
)/
562 $(INSTALL_SOURCE
) $(SRCS
) .win32
563 cp .win32
/Makefile .win32
/Makefile.old
564 egrep
-v
-e DUSE_WCHAR
-e ^DBBIN .win32
/Makefile.old
>.win32
/Makefile
566 CC
=i686-w64-mingw32-gcc AR
=i686-w64-mingw32-ar CFLAGS
='-DOSNAME=\"Windows\"' make
; \
567 make
install PREFIX
=mdocml-
$(VERSION
) ; \
568 zip
-r ..
/$@ mdocml-
$(VERSION
) )
571 mdocml-win64.zip
: $(SRCS
)
572 mkdir
-p .win64
/mdocml-
$(VERSION
)/
573 $(INSTALL_SOURCE
) $(SRCS
) .win64
574 cp .win64
/Makefile .win64
/Makefile.old
575 egrep
-v
-e DUSE_WCHAR
-e ^DBBIN .win64
/Makefile.old
>.win64
/Makefile
577 CC
=x86_64-w64-mingw32-gcc AR
=x86_64-w64-mingw32-ar CFLAGS
='-DOSNAME=\"Windows\"' make
; \
578 make
install PREFIX
=mdocml-
$(VERSION
) ; \
579 zip
-r ..
/$@ mdocml-
$(VERSION
) )
582 mdocml-macosx.zip
: $(SRCS
)
583 mkdir
-p .macosx
/mdocml-
$(VERSION
)/
584 $(INSTALL_SOURCE
) $(SRCS
) .macosx
586 CFLAGS
="-arch i386 -arch x86_64 -arch ppc" LDFLAGS
="-arch i386 -arch x86_64 -arch ppc" make
; \
587 make
install PREFIX
=mdocml-
$(VERSION
) ; \
588 zip
-r ..
/$@ mdocml-
$(VERSION
) )
591 index.html
: $(INDEX_OBJS
)
593 config.h
: config.h.pre config.h.post
595 ( cat config.h.pre
; \
597 if
$(CC
) $(CFLAGS
) -Werror
-o test-fgetln test-fgetln.c
>> config.log
2>&1; then \
598 echo
'#define HAVE_FGETLN'; \
601 if
$(CC
) $(CFLAGS
) -Werror
-o test-strptime test-strptime.c
>> config.log
2>&1; then \
602 echo
'#define HAVE_STRPTIME'; \
605 if
$(CC
) $(CFLAGS
) -Werror
-o test-getsubopt test-getsubopt.c
>> config.log
2>&1; then \
606 echo
'#define HAVE_GETSUBOPT'; \
609 if
$(CC
) $(CFLAGS
) -Werror
-o test-strlcat test-strlcat.c
>> config.log
2>&1; then \
610 echo
'#define HAVE_STRLCAT'; \
613 if
$(CC
) $(CFLAGS
) -Werror
-o test-mmap test-mmap.c
>> config.log
2>&1; then \
614 echo
'#define HAVE_MMAP'; \
617 if
$(CC
) $(CFLAGS
) -Werror
-o test-strlcpy test-strlcpy.c
>> config.log
2>&1; then \
618 echo
'#define HAVE_STRLCPY'; \
628 .1.1.txt
.3.3.txt
.7.7.txt
.8.8.txt
:
629 .
/mandoc
-Tascii
-Wall
,stop
$< | col
-b
>$@
631 .1.1.html
.3.3.html
.7.7.html
.8.8.html
:
632 .
/mandoc
-Thtml
-Wall
,stop
-Ostyle
=style.css
,man
=%N.
%S.html
,includes
=%I.html
$< >$@
634 .1.1.ps
.3.3.ps
.7.7.ps
.8.8.ps
:
635 .
/mandoc
-Tps
-Wall
,stop
$< >$@
637 .1.1.xhtml
.3.3.xhtml
.7.7.xhtml
.8.8.xhtml
:
638 .
/mandoc
-Txhtml
-Wall
,stop
-Ostyle
=style.css
,man
=%N.
%S.xhtml
,includes
=%I.html
$< >$@
640 .1.1.pdf
.3.3.pdf
.7.7.pdf
.8.8.pdf
:
641 .
/mandoc
-Tpdf
-Wall
,stop
$< >$@
645 sed
-e
"s!@VERSION@!$(VERSION)!" -e
"s!@VDATE@!$(VDATE)!" $< >$@