1# $NetBSD: Makefile.inc,v 1.3 2016/03/16 23:52:04 wiz Exp $
2
3# $FreeBSD: src/gnu/usr.bin/groff/Makefile.inc,v 2.7 2003/05/01 13:22:18 ru Exp $
4
5BINDIR?=	/usr/bin
6ECHO=		echo
7# date of groff tarball; embedded as last-change date into man pages
8# we can not use mdate.sh since after checkout from some of the used
9# version control systems, it might be today's date and MKREPRO won't
10# work.
11MDATE=		September 4, 2005
12
13# Define `page' to be letter if your PostScript printer uses 8.5x11
14# paper (USA) and define it to be A4, if it uses A4 paper (rest of the
15# world).
16PAGE=letter
17
18# Normally the Postscript driver, grops, produces output that conforms
19# to version 3.0 of the Adobe Document Structuring Conventions.
20# Unfortunately some spoolers and previewers can't handle such output.
21# The BROKEN_SPOOLER_FLAGS variable tells grops what it should do to
22# make its output acceptable to such programs.  This variable controls
23# only the default behaviour of grops; the behaviour can be changed at
24# runtime by the grops -b option (and so by groff -P-b).
25#
26# Use a value of 0 if your spoolers and previewers are able to handle
27# conforming PostScript correctly.
28#
29# Add 1 if no %%{Begin,End}DocumentSetup comments should be generated;
30# this is needed for early versions of TranScript that get confused by
31# anything between the %%EndProlog line and the first %%Page: comment.
32#
33# Add 2 if lines in included files beginning with %! should be
34# stripped out; this is needed for the OpenWindows 2.0 pageview previewer.
35#
36# Add 4 if %%Page, %%Trailer and %%EndProlog comments should be
37# stripped out of included files; this is needed for spoolers that
38# don't understand the %%{Begin,End}Document comments. I suspect this
39# includes early versions of TranScript.
40#
41# Add 8 if the first line of the PostScript output should be %!PS-Adobe-2.0
42# rather than %!PS-Adobe-3.0; this is needed when using Sun's Newsprint
43# with a printer that requires page reversal.
44#
45BROKEN_SPOOLER_FLAGS=0
46
47# DEVICE is the default device.
48DEVICE=ps
49
50# PSPRINT is the command to use for printing a PostScript file,
51# for example `lpr'.
52PSPRINT=lpr
53
54# DVIPRINT is the command to use for printing a TeX dvi file,
55# for example `lpr -d'.
56DVIPRINT=lpr -d
57########################################################################
58# Don't touch...
59
60g=
61tmac_s_prefix=
62tmac_m_prefix=
63tmac_an_prefix=
64fontdir=/usr/share/groff_font
65localfontdir=$(fontdir)
66legacyfontdir=$(fontdir)
67tmacdir=/usr/share/tmac
68systemtmacdir=/usr/share/tmac
69localtmacdir=/usr/share/tmac
70docdir=/usr/src/contrib/groff/doc
71exampledir=XXX
72htmldocdir=XXX
73pdfdocdir=XXX
74indexext=.i
75common_words_file=/usr/share/dict/eign
76indexdir=/usr/share/dict/papers
77indexname=Ind
78
79########################################################################
80# Libraries
81.include <bsd.own.mk>
82
83DIST=		${NETBSDSRCDIR}/external/gpl2/groff
84GROFF_DIST=	${DIST}/dist
85
86PROGDPLIBS+= bib ${DIST}/lib/libbib
87.if !defined(NOLIBDRIVER)
88PROGDPLIBS+= driver ${DIST}/lib/libdriver
89.endif
90PROGDPLIBS+= groff ${DIST}/lib/libgroff
91
92CPPFLAGS+=	-DHAVE_CONFIG_H
93CPPFLAGS+=	-I${DIST}/include -I${GROFF_DIST}/src/include
94CXXFLAGS+=	-fno-rtti -fno-exceptions
95
96CWARNFLAGS.clang+=	-Wno-unused-value
97
98
99.ifdef GROFFYSRCS
100YFLAGS+=	-d
101SRCS+=		${GROFFYSRCS:.y=.cpp}
102DPSRCS+=	${GROFFYSRCS:.y=.cpp}
103CLEANFILES+=	${GROFFYSRCS:.y=.cpp} ${GROFFYSRCS:.y=_tab.h}
104.endif
105
106.y.cpp:
107	${_MKTARGET_YACC}
108	${YACC.y} -o ${.TARGET} ${.IMPSRC}
109	mv -f ${.PREFIX}.h ${.PREFIX}_tab.h
110
111
112.SUFFIXES: .man .1 .2 .3 .4 .5 .6 .7 .8
113
114version != cat $(GROFF_DIST)/VERSION
115revision != ${TOOL_SED} -e 's/^0$$//' -e 's/^[1-9].*$$/.&/' $(GROFF_DIST)/REVISION
116
117.man.8 .man.7 .man.6 .man.5 .man.4 .man.3 .man.2 .man.1:
118	${_MKTARGET_CREATE}
119	rm -f $@
120	${TOOL_SED} -e "s;@BINDIR@;${BINDIR};g" \
121	-e "s;@FONTDIR@;$(fontdir);g" \
122	-e "s;@LOCALFONTDIR@;$(localfontdir);g" \
123	-e "s;@LEGACYFONTDIR@;$(legacyfontdir);g" \
124	-e "s;@MACRODIR@;$(tmacdir);g" \
125	-e "s;@SYSTEMMACRODIR@;$(systemtmacdir);g" \
126	-e "s;@LOCALMACRODIR@;$(localtmacdir);g" \
127	-e "s;@DOCDIR@;$(docdir);g" \
128	-e "s;@EXAMPLEDIR@;$(exampledir);g" \
129	-e "s;@HTMLDOCDIR@;$(htmldocdir);g" \
130	-e "s;@PDFDOCDIR@;$(pdfdocdir);g" \
131	-e "s;@DEVICE@;$(DEVICE);g" \
132	-e "s;@DEFAULT_INDEX@;$(indexdir)/$(indexname);g" \
133	-e "s;@DEFAULT_INDEX_NAME@;$(indexname);g" \
134	-e "s;@INDEX_SUFFIX@;$(indexext);g" \
135	-e "s;@COMMON_WORDS_FILE@;$(common_words_file);g" \
136	-e "s;@MAN1EXT@;1;g" \
137	-e "s;@MAN5EXT@;5;g" \
138	-e "s;@MAN7EXT@;7;g" \
139	-e "s;@TMAC_S_PREFIX@;$(tmac_s_prefix);g" \
140	-e "s;@TMAC_M_PREFIX@;$(tmac_m_prefix);g" \
141	-e "s;@TMAC_AN_PREFIX@;$(tmac_an_prefix);g" \
142	-e "s;@TMAC_MDIR@;$(tmacdir)/mm;g" \
143	-e "s;@BROKEN_SPOOLER_FLAGS@;$(BROKEN_SPOOLER_FLAGS);g" \
144	-e "s;@VERSION@;$(version)$(revision);g" \
145	-e "s;@MDATE@;${MDATE};g" \
146	-e "s;@g@;$(g);g" \
147	-e "s;@G@;`echo $(g) | LC_ALL=C tr [a-z] [A-Z]`;g" \
148	$< >$@
149
150.SUFFIXES: .sh .pl
151
152.sh .pl:
153	${_MKTARGET_CREATE}
154	rm -f $@
155	${TOOL_SED} -e "s|@BINDIR@|${BINDIR}|g" \
156	     -e "s;@FONTDIR@;$(fontdir);g" \
157	     -e 's|@GROFF_BIN_PATH_SETUP@|GROFF_RUNTIME="$${GROFF_BIN_PATH=/usr/bin}:"|g' \
158	     -e "s|@SEP@|:|" \
159	     -e "s|@VERSION@|$(version)$(revision)|" \
160	     -e "s|@g@|$(g)|g" \
161	     ${.IMPSRC} >${.TARGET}
162
163DIST_SUBDIR?=	${.CURDIR:T}
164DIST_DIR=	${GROFF_DIST}/${DIST_SUBDIR}
165.PATH: ${DIST_DIR}
166