[BACK]Return to Makefile CVS log [TXT][DIR] Up to [local] / src / usr.bin / mandoc

File: [local] / src / usr.bin / mandoc / Makefile (download)

Revision 1.118, Fri Mar 13 00:31:04 2020 UTC (4 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.117: +9 -9 lines

Split tagging into a validation part including prioritization
in tag.{h,c} and {mdoc,man}_validate.c
and into a formatting part including command line argument checking
in term_tag.{h,c}, html.c, and {mdoc|man}_{term|html}.c.

Immediate functional benefits include:
* Improved prioritization of automatic tags for .Em and .Sy.
* Avoiding bogus automatic tags when .Em, .Fn, or .Sy are explicitly tagged.
* Explicit tagging of .Er and .Fl now works in HTML output.
* Automatic tagging of .IP and .TP now works in HTML output.
But mainly, this patch provides clean earth to build further improvements on.

Technical changes:
* Main program: Write a tag file for ASCII and UTF-8 output only.
* All formatters: There is no more need to delay writing the tags.
* mdoc(7)+man(7) formatters: No more need for elaborate syntax tree inspection.
* HTML formatter: If available, use the "string" attribute as the tag.
* HTML formatter: New function to write permalinks, to reduce code duplication.

Style cleanup in the vicinity while here:
* mdoc(7) terminal formatter: To set up bold font for children,
defer to termp_bold_pre() rather than calling term_fontpush() manually.
* mdoc(7) terminal formatter: Garbage collect some duplicate functions.
* mdoc(7) HTML formatter: Unify <code> handling, delete redundant functions.
* Where possible, use switch statements rather than if cascades.
* Get rid of some more Yoda notation.

The necessity for such changes was first discussed with kn@, but i didn't
bother him with a request to review the resulting -673/+782 line patch.

# $OpenBSD: Makefile,v 1.118 2020/03/13 00:31:04 schwarze Exp $

.include <bsd.own.mk>

CFLAGS  += -W -Wall -Wstrict-prototypes -Wno-unused-parameter
DPADD	+= ${LIBUTIL}
LDADD	+= -lutil -lz

SRCS=	mandoc_aux.c mandoc_ohash.c mandoc.c mandoc_msg.c mandoc_xr.c \
	arch.c chars.c msec.c preconv.c read.c tag.c
SRCS+=	roff.c roff_validate.c tbl.c tbl_opts.c tbl_layout.c tbl_data.c eqn.c
SRCS+=	mdoc.c mdoc_argv.c mdoc_macro.c mdoc_state.c mdoc_validate.c \
	att.c st.c
SRCS+=	man_macro.c man.c man_validate.c
SRCS+=	main.c out.c tree.c
SRCS+=	term.c term_ascii.c term_ps.c term_tab.c term_tag.c
SRCS+=	roff_term.c mdoc_term.c man_term.c eqn_term.c tbl_term.c
SRCS+=	mdoc_man.c
SRCS+=	html.c roff_html.c mdoc_html.c man_html.c eqn_html.c tbl_html.c
SRCS+=	mdoc_markdown.c
SRCS+=	dbm_map.c dbm.c dba_write.c dba_array.c dba.c dba_read.c
SRCS+=	manpath.c mandocdb.c mansearch.c

PROG=	mandoc

LINKS =	${BINDIR}/mandoc ${BINDIR}/apropos \
	${BINDIR}/mandoc ${BINDIR}/help \
	${BINDIR}/mandoc ${BINDIR}/man \
	${BINDIR}/mandoc ${BINDIR}/whatis \
	${BINDIR}/mandoc /usr/sbin/makewhatis \
	${BINDIR}/mandoc /usr/libexec/makewhatis

MAN =	apropos.1 man.1 mandoc.1 man.conf.5 makewhatis.8

CLEANFILES += man.cgi cgi.o

afterinstall:
	install -o ${BINOWN} -g ${BINGRP} -m 444 \
	    ${.CURDIR}/mandoc.css ${DESTDIR}/usr/share/misc


# ----------------------------------------------------------------------
# Variables and targets to build and install man.cgi(8),
# not used during make build and make release.

# To configure, run:	cp cgi.h.example cgi.h; vi cgi.h
# To build, run:	make man.cgi
# To install, run:	sudo make installcgi
# After that, read:	man man.cgi.8

LIBMDOC_OBJS =	mdoc_argv.o mdoc_macro.o mdoc_state.o \
		mdoc_validate.o mdoc.o att.o st.o
LIBMAN_OBJS =	man.o man_macro.o man_validate.o
LIBROFF_OBJS =	roff.o roff_validate.o eqn.o \
		tbl.o tbl_data.o tbl_layout.o tbl_opts.o
LIBMANDOC_OBJS = ${LIBMDOC_OBJS} ${LIBMAN_OBJS} ${LIBROFF_OBJS} \
		arch.o mandoc.o mandoc_aux.o mandoc_msg.o mandoc_ohash.o \
		mandoc_xr.o chars.o msec.o preconv.o read.o tag.o
HTML_OBJS =	html.o roff_html.o mdoc_html.o man_html.o \
		tbl_html.o eqn_html.o out.o
CGI_OBJS =	${LIBMANDOC_OBJS} ${HTML_OBJS} \
		dbm_map.o dbm.o mansearch.o cgi.o

cgi.o: cgi.h main.h manconf.h mandoc.h mandoc_aux.h mandoc_parse.h \
	mansearch.h man.h mdoc.h roff.h

man.cgi: ${CGI_OBJS}
	${CC} ${LDFLAGS} ${STATIC} -o ${.TARGET} ${CGI_OBJS} ${LDADD}

installcgi: man.cgi
	${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}/var/www/cgi-bin
	${INSTALL} ${INSTALL_COPY} ${INSTALL_STRIP} \
	    -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
	    man.cgi ${DESTDIR}/var/www/cgi-bin/man.cgi
	${INSTALL} ${INSTALL_COPY} -o root -g wheel -m 644 \
	    ${.CURDIR}/mandoc.css ${DESTDIR}/var/www/htdocs/

.include <bsd.prog.mk>