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