1 .PHONY
: clean install installwww
2 .SUFFIXES
: .sgml .html .md5 .h .h.html
4 .SUFFIXES
: .1.html
.3.html
.7.html
.8.html
6 # Specify this if you want to hard-code the operating system to appear
7 # in the lower-left hand corner of -mdoc manuals.
9 # CFLAGS += -DOSNAME="\"OpenBSD 5.4\""
12 VDATE
= 31 December
2013
14 # IFF your system supports multi-byte functions (setlocale(), wcwidth(),
15 # putwchar()) AND has __STDC_ISO_10646__ (that is, wchar_t is simply a
16 # UCS-4 value) should you define USE_WCHAR. If you define it and your
17 # system DOESN'T support this, -Tlocale will produce garbage.
18 # If you don't define it, -Tlocale is a synonym for -Tacsii.
22 # If your system has manpath(1), uncomment this. This is most any
23 # system that's not OpenBSD or NetBSD. If uncommented, apropos(1),
24 # mandocdb(8), and man.cgi will popen(3) manpath(1) to get the MANPATH
26 #CFLAGS += -DUSE_MANPATH
28 # If your system does not support static binaries, comment this,
29 # for example on Mac OS X.
31 # Linux requires -pthread to statically link with libdb.
34 CFLAGS
+= -g
-DHAVE_CONFIG_H
35 CFLAGS
+= -W
-Wall
-Wstrict-prototypes
-Wno-unused-parameter
-Wwrite-strings
38 HTDOCDIR
= $(WWWPREFIX
)/htdocs
39 CGIBINDIR
= $(WWWPREFIX
)/cgi-bin
40 BINDIR
= $(PREFIX
)/bin
41 INCLUDEDIR
= $(PREFIX
)/include/mandoc
42 LIBDIR
= $(PREFIX
)/lib
/mandoc
43 MANDIR
= $(PREFIX
)/man
44 EXAMPLEDIR
= $(PREFIX
)/share
/examples
/mandoc
46 INSTALL_PROGRAM
= $(INSTALL
) -m
0755
47 INSTALL_DATA
= $(INSTALL
) -m
0444
48 INSTALL_LIB
= $(INSTALL
) -m
0644
49 INSTALL_SOURCE
= $(INSTALL
) -m
0644
50 INSTALL_MAN
= $(INSTALL_DATA
)
52 # Non-BSD systems (Linux, etc.) need -ldb to compile mandocdb and
54 # However, if you don't have -ldb at all (or it's not native), then
55 # comment out apropos and mandocdb.
58 DBBIN
= apropos mandocdb man.cgi catman whatis
59 DBLN
= llib-lapropos.ln llib-lmandocdb.ln llib-lman.cgi.ln llib-lcatman.ln
61 all: mandoc preconv demandoc
$(DBBIN
)
173 LIBMAN_OBJS
= man.o \
178 LIBMDOC_OBJS
= arch.o \
189 LIBROFF_OBJS
= eqn.o \
196 LIBMANDOC_OBJS
= $(LIBMAN_OBJS
) \
204 COMPAT_OBJS
= compat_fgetln.o \
218 $(LIBMAN_OBJS
): libman.h
219 $(LIBMDOC_OBJS
): libmdoc.h
220 $(LIBROFF_OBJS
): libroff.h
221 $(LIBMANDOC_OBJS
): mandoc.h mdoc.h man.h libmandoc.h config.h
222 $(COMPAT_OBJS
): config.h
224 MANDOC_HTML_OBJS
= eqn_html.o \
229 $(MANDOC_HTML_OBJS
): html.h
231 MANDOC_MAN_OBJS
= mdoc_man.o
233 MANDOC_TERM_OBJS
= eqn_term.o \
240 $(MANDOC_TERM_OBJS
): term.h
242 MANDOC_OBJS
= $(MANDOC_HTML_OBJS
) \
244 $(MANDOC_TERM_OBJS
) \
248 $(MANDOC_OBJS
): main.h mandoc.h mdoc.h man.h config.h out.h
250 MANDOCDB_OBJS
= mandocdb.o manpath.o
251 $(MANDOCDB_OBJS
): mandocdb.h mandoc.h mdoc.h man.h config.h manpath.h
253 PRECONV_OBJS
= preconv.o
254 $(PRECONV_OBJS
): config.h
256 APROPOS_OBJS
= apropos.o apropos_db.o manpath.o
257 $(APROPOS_OBJS
): config.h mandoc.h apropos_db.h manpath.h mandocdb.h
259 CGI_OBJS
= $(MANDOC_HTML_OBJS
) \
261 $(MANDOC_TERM_OBJS
) \
267 $(CGI_OBJS
): main.h mdoc.h man.h out.h config.h mandoc.h apropos_db.h manpath.h mandocdb.h
269 CATMAN_OBJS
= catman.o manpath.o
270 $(CATMAN_OBJS
): config.h mandoc.h manpath.h mandocdb.h
272 DEMANDOC_OBJS
= demandoc.o
273 $(DEMANDOC_OBJS
): config.h
275 INDEX_MANS
= apropos
.1.html \
292 $(INDEX_MANS
): mandoc
294 INDEX_OBJS
= $(INDEX_MANS
) \
304 rm -f libmandoc.a
$(LIBMANDOC_OBJS
)
305 rm -f mandocdb
$(MANDOCDB_OBJS
)
306 rm -f preconv
$(PRECONV_OBJS
)
307 rm -f apropos whatis
$(APROPOS_OBJS
)
308 rm -f man.cgi
$(CGI_OBJS
)
309 rm -f catman
$(CATMAN_OBJS
)
310 rm -f demandoc
$(DEMANDOC_OBJS
)
311 rm -f mandoc
$(MANDOC_OBJS
)
312 rm -f config.log
$(COMPAT_OBJS
)
314 rm -f index.html
$(INDEX_OBJS
)
318 mkdir
-p
$(DESTDIR
)$(BINDIR
)
319 mkdir
-p
$(DESTDIR
)$(EXAMPLEDIR
)
320 mkdir
-p
$(DESTDIR
)$(LIBDIR
)
321 mkdir
-p
$(DESTDIR
)$(INCLUDEDIR
)
322 mkdir
-p
$(DESTDIR
)$(MANDIR
)/man1
323 mkdir
-p
$(DESTDIR
)$(MANDIR
)/man3
324 mkdir
-p
$(DESTDIR
)$(MANDIR
)/man7
325 $(INSTALL_PROGRAM
) mandoc preconv demandoc
$(DESTDIR
)$(BINDIR
)
326 $(INSTALL_LIB
) libmandoc.a
$(DESTDIR
)$(LIBDIR
)
327 $(INSTALL_LIB
) man.h mdoc.h mandoc.h
$(DESTDIR
)$(INCLUDEDIR
)
328 $(INSTALL_MAN
) mandoc
.1 preconv
.1 demandoc
.1 $(DESTDIR
)$(MANDIR
)/man1
329 $(INSTALL_MAN
) mandoc
.3 tbl
.3 $(DESTDIR
)$(MANDIR
)/man3
330 $(INSTALL_MAN
) man
.7 mdoc
.7 roff
.7 eqn
.7 tbl
.7 mandoc_char
.7 $(DESTDIR
)$(MANDIR
)/man7
331 $(INSTALL_DATA
) example.style.css
$(DESTDIR
)$(EXAMPLEDIR
)
334 mkdir
-p
$(DESTDIR
)$(CGIBINDIR
)
335 mkdir
-p
$(DESTDIR
)$(HTDOCDIR
)
336 $(INSTALL_PROGRAM
) man.cgi
$(DESTDIR
)$(CGIBINDIR
)
337 $(INSTALL_DATA
) example.style.css
$(DESTDIR
)$(HTDOCDIR
)/man.css
338 $(INSTALL_DATA
) man-cgi.css
$(DESTDIR
)$(HTDOCDIR
)
341 mkdir
-p
$(PREFIX
)/snapshots
342 mkdir
-p
$(PREFIX
)/binaries
343 $(INSTALL_DATA
) index.html external.png index.css
$(PREFIX
)
344 $(INSTALL_DATA
) $(INDEX_MANS
) style.css
$(PREFIX
)
345 $(INSTALL_DATA
) mandoc.h.html man.h.html mdoc.h.html
$(PREFIX
)
346 $(INSTALL_DATA
) mdocml.
tar.gz
$(PREFIX
)/snapshots
347 $(INSTALL_DATA
) mdocml.md5
$(PREFIX
)/snapshots
348 $(INSTALL_DATA
) mdocml.
tar.gz
$(PREFIX
)/snapshots
/mdocml-
$(VERSION
).
tar.gz
349 $(INSTALL_DATA
) mdocml.md5
$(PREFIX
)/snapshots
/mdocml-
$(VERSION
).md5
351 libmandoc.a
: $(COMPAT_OBJS
) $(LIBMANDOC_OBJS
)
352 $(AR
) rs
$@
$(COMPAT_OBJS
) $(LIBMANDOC_OBJS
)
354 mandoc
: $(MANDOC_OBJS
) libmandoc.a
355 $(CC
) $(LDFLAGS
) -o
$@
$(MANDOC_OBJS
) libmandoc.a
357 mandocdb
: $(MANDOCDB_OBJS
) libmandoc.a
358 $(CC
) $(LDFLAGS
) -o
$@
$(MANDOCDB_OBJS
) libmandoc.a
$(DBLIB
)
360 preconv
: $(PRECONV_OBJS
)
361 $(CC
) $(LDFLAGS
) -o
$@
$(PRECONV_OBJS
)
366 apropos
: $(APROPOS_OBJS
) libmandoc.a
367 $(CC
) $(LDFLAGS
) -o
$@
$(APROPOS_OBJS
) libmandoc.a
$(DBLIB
)
369 catman
: $(CATMAN_OBJS
) libmandoc.a
370 $(CC
) $(LDFLAGS
) -o
$@
$(CATMAN_OBJS
) libmandoc.a
$(DBLIB
)
372 man.cgi
: $(CGI_OBJS
) libmandoc.a
373 $(CC
) $(LDFLAGS
) $(STATIC
) -o
$@
$(CGI_OBJS
) libmandoc.a
$(DBLIB
)
375 demandoc
: $(DEMANDOC_OBJS
) libmandoc.a
376 $(CC
) $(LDFLAGS
) -o
$@
$(DEMANDOC_OBJS
) libmandoc.a
378 mdocml.md5
: mdocml.
tar.gz
379 md5 mdocml.
tar.gz
>$@
381 mdocml.
tar.gz
: $(SRCS
)
382 mkdir
-p .
dist/mdocml-
$(VERSION
)/
383 $(INSTALL_SOURCE
) $(SRCS
) .
dist/mdocml-
$(VERSION
)
384 ( cd .
dist/ && tar zcf ..
/$@ .
/ )
387 index.html
: $(INDEX_OBJS
)
389 config.h
: config.h.pre config.h.post
391 ( cat config.h.pre
; \
393 echo
'#define VERSION "$(VERSION)"'; \
394 if
$(CC
) $(CFLAGS
) -Werror
-Wno-unused
-o test-fgetln test-fgetln.c
>> config.log
2>&1; then \
395 echo
'#define HAVE_FGETLN'; \
398 if
$(CC
) $(CFLAGS
) -Werror
-Wno-unused
-o test-strptime test-strptime.c
>> config.log
2>&1; then \
399 echo
'#define HAVE_STRPTIME'; \
402 if
$(CC
) $(CFLAGS
) -Werror
-Wno-unused
-o test-getsubopt test-getsubopt.c
>> config.log
2>&1; then \
403 echo
'#define HAVE_GETSUBOPT'; \
406 if
$(CC
) $(CFLAGS
) -Werror
-Wno-unused
-o test-strlcat test-strlcat.c
>> config.log
2>&1; then \
407 echo
'#define HAVE_STRLCAT'; \
410 if
$(CC
) $(CFLAGS
) -Werror
-Wno-unused
-o test-mmap test-mmap.c
>> config.log
2>&1; then \
411 echo
'#define HAVE_MMAP'; \
414 if
$(CC
) $(CFLAGS
) -Werror
-Wno-unused
-o test-strlcpy test-strlcpy.c
>> config.log
2>&1; then \
415 echo
'#define HAVE_STRLCPY'; \
418 if
$(CC
) $(CFLAGS
) -Werror
-Wno-unused
-o test-betoh64 test-betoh64.c
>> config.log
2>&1; then \
419 echo
'#define HAVE_BETOH64'; \
429 .1.1.html
.3.3.html
.7.7.html
.8.8.html
:
430 .
/mandoc
-Thtml
-Wall
,stop
-Ostyle
=style.css
,man
=%N.
%S.html
,includes
=%I.html
$< >$@
434 sed
-e
"s!@VERSION@!$(VERSION)!" -e
"s!@VDATE@!$(VDATE)!" $< >$@