1# $OpenBSD: Makefile,v 1.120 2022/07/04 15:45:27 schwarze Exp $
2
3.include <bsd.own.mk>
4
5CFLAGS  += -W -Wall -Wstrict-prototypes -Wno-unused-parameter
6DPADD	+= ${LIBUTIL}
7LDADD	+= -lutil -lz
8
9SRCS=	mandoc_aux.c mandoc_ohash.c mandoc.c mandoc_msg.c mandoc_xr.c \
10	arch.c chars.c msec.c preconv.c read.c tag.c
11SRCS+=	roff.c roff_escape.c roff_validate.c
12SRCS+=	tbl.c tbl_opts.c tbl_layout.c tbl_data.c eqn.c
13SRCS+=	mdoc.c mdoc_argv.c mdoc_macro.c mdoc_state.c mdoc_validate.c \
14	att.c st.c
15SRCS+=	man_macro.c man.c man_validate.c
16SRCS+=	main.c out.c tree.c
17SRCS+=	term.c term_ascii.c term_ps.c term_tab.c term_tag.c
18SRCS+=	roff_term.c mdoc_term.c man_term.c eqn_term.c tbl_term.c
19SRCS+=	mdoc_man.c
20SRCS+=	html.c roff_html.c mdoc_html.c man_html.c eqn_html.c tbl_html.c
21SRCS+=	mdoc_markdown.c
22SRCS+=	dbm_map.c dbm.c dba_write.c dba_array.c dba.c dba_read.c
23SRCS+=	manpath.c mandocdb.c mansearch.c
24
25PROG=	mandoc
26
27LINKS =	${BINDIR}/mandoc ${BINDIR}/apropos \
28	${BINDIR}/mandoc ${BINDIR}/help \
29	${BINDIR}/mandoc ${BINDIR}/man \
30	${BINDIR}/mandoc ${BINDIR}/whatis \
31	${BINDIR}/mandoc /usr/sbin/makewhatis \
32	${BINDIR}/mandoc /usr/libexec/makewhatis
33
34MAN =	apropos.1 man.1 mandoc.1 man.conf.5 makewhatis.8
35
36CLEANFILES += man.cgi cgi.o
37
38afterinstall:
39	install -o ${BINOWN} -g ${BINGRP} -m 444 \
40	    ${.CURDIR}/mandoc.css ${DESTDIR}/usr/share/misc
41
42
43# ----------------------------------------------------------------------
44# Variables and targets to build and install man.cgi(8),
45# not used during make build and make release.
46
47# To configure, run:	cp cgi.h.example cgi.h; vi cgi.h
48# To build, run:	make man.cgi
49# To install, run:	sudo make installcgi
50# After that, read:	man man.cgi.8
51
52LIBMDOC_OBJS =	mdoc_argv.o mdoc_macro.o mdoc_state.o \
53		mdoc_validate.o mdoc.o att.o st.o
54LIBMAN_OBJS =	man.o man_macro.o man_validate.o
55LIBROFF_OBJS =	roff.o roff_escape.o roff_validate.o eqn.o \
56		tbl.o tbl_data.o tbl_layout.o tbl_opts.o
57LIBMANDOC_OBJS = ${LIBMDOC_OBJS} ${LIBMAN_OBJS} ${LIBROFF_OBJS} \
58		arch.o mandoc.o mandoc_aux.o mandoc_msg.o mandoc_ohash.o \
59		mandoc_xr.o chars.o msec.o preconv.o read.o tag.o
60HTML_OBJS =	html.o roff_html.o mdoc_html.o man_html.o \
61		tbl_html.o eqn_html.o out.o
62CGI_OBJS =	${LIBMANDOC_OBJS} ${HTML_OBJS} \
63		dbm_map.o dbm.o mansearch.o cgi.o
64
65cgi.o: cgi.h main.h manconf.h mandoc.h mandoc_aux.h mandoc_parse.h \
66	mansearch.h man.h mdoc.h roff.h
67
68man.cgi: ${CGI_OBJS}
69	${CC} ${LDFLAGS} ${STATIC} -o ${.TARGET} ${CGI_OBJS} ${LDADD}
70
71installcgi: man.cgi
72	${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}/var/www/cgi-bin
73	${INSTALL} ${INSTALL_COPY} ${INSTALL_STRIP} \
74	    -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
75	    man.cgi ${DESTDIR}/var/www/cgi-bin/man.cgi
76	${INSTALL} ${INSTALL_COPY} -o root -g wheel -m 644 \
77	    ${.CURDIR}/mandoc.css ${DESTDIR}/var/www/htdocs/
78
79.include <bsd.prog.mk>
80