175020Sru# $FreeBSD$
275020Sru
375592SruBINDIR?=	/usr/bin
475592SruSHELL=		/bin/sh
518138Spst
675592Sru# Define `page' to be letter if your PostScript printer uses 8.5x11
775592Sru# paper (USA) and define it to be A4, if it uses A4 paper (rest of the
875592Sru# world).
975592SruPAGE=letter
1075592Sru
1175592Sru# Normally the Postscript driver, grops, produces output that conforms
1275592Sru# to version 3.0 of the Adobe Document Structuring Conventions.
1375592Sru# Unfortunately some spoolers and previewers can't handle such output.
1475592Sru# The BROKEN_SPOOLER_FLAGS variable tells grops what it should do to
1575592Sru# make its output acceptable to such programs.  This variable controls
1675592Sru# only the default behaviour of grops; the behaviour can be changed at
1775592Sru# runtime by the grops -b option (and so by groff -P-b).
1875592Sru# Use a value of 0 if your spoolers and previewers are able to handle
1975592Sru# conforming PostScript correctly.
2075592Sru# Add 1 if no %%{Begin,End}DocumentSetup comments should be generated;
2175592Sru# this is needed for early versions of TranScript that get confused by
2275592Sru# anything between the %%EndProlog line and the first %%Page: comment.
2375592Sru# Add 2 if lines in included files beginning with %! should be
2475592Sru# stripped out; this is needed for the OpenWindows 2.0 pageview previewer.
2575592Sru# Add 4 if %%Page, %%Trailer and %%EndProlog comments should be
2675592Sru# stripped out of included files; this is needed for spoolers that
2775592Sru# don't understand the %%{Begin,End}Document comments. I suspect this
2875592Sru# includes early versions of TranScript.
2975592Sru# Add 8 if the first line of the PostScript output should be %!PS-Adobe-2.0
3075592Sru# rather than %!PS-Adobe-3.0; this is needed when using Sun's Newsprint
3175592Sru# with a printer that requires page reversal.
3275592SruBROKEN_SPOOLER_FLAGS=7
3375592Sru
3475592Sru# DEVICE is the default device.
3575592SruDEVICE=ps
3675592Sru
3775592Sru# PSPRINT is the command to use for printing a PostScript file,
3875592Sru# for example `lpr'.
3975592SruPSPRINT=lpr
4075592Sru
4175592Sru# DVIPRINT is the command to use for printing a TeX dvi file,
4275592Sru# for example `lpr -d'.
4375592SruDVIPRINT=lpr -d
4475592Sru########################################################################
4575592Sru# Don't touch...
4675592Sru
4775592Srug=
4875592Srutmac_s_prefix=
4975592Srutmac_m_prefix=
5075592Srutmac_an_prefix=
5175592Srufontdir=/usr/share/groff_font
52104869Srulocalfontdir=$(fontdir)
53104869Srulegacyfontdir=$(fontdir)
5475592Srutmacdir=/usr/share/tmac
5575592Srusystemtmacdir=/usr/share/tmac
5675592Srulocaltmacdir=/usr/share/tmac
57104869Srudocdir=/usr/src/contrib/groff/doc
58104869Sruexampledir=XXX
59104869Sruhtmldocdir=XXX
60151504Srupdfdocdir=XXX
6175592Sruindexext=.i
6275592Srucommon_words_file=/usr/share/dict/eign
6375592Sruindexdir=/usr/share/dict/papers
6475592Sruindexname=Ind
6575592Sru
6675592Sru########################################################################
6775592Sru# Libraries
6875592Sru
6975592SruLIBGROFF=	${.OBJDIR}/${TOPREL}/src/libs/libgroff/libgroff.a
7075592SruLIBDRIVER=	${.OBJDIR}/${TOPREL}/src/libs/libdriver/libdriver.a
7175592SruLIBBIB=		${.OBJDIR}/${TOPREL}/src/libs/libbib/libbib.a
7275592Sru
73104869SruCFLAGS+=	-DHAVE_CONFIG_H
7475592SruCFLAGS+=	-I${GROFF_DIST}/src/include -I${.CURDIR}/${TOPREL}/src/include
7575592SruCXXFLAGS+=	-fno-rtti -fno-exceptions
7675592Sru
7775592Sru.y.o:
7875592Sru	$(YACC) $(YFLAGS) $(.IMPSRC)
79114412Sru	mv -f y.tab.c $(.PREFIX).cpp
8075592Sru	mv -f y.tab.h $(.PREFIX)_tab.h
81114412Sru	${CXX} ${CXXFLAGS} -c $(.PREFIX).cpp -o ${.TARGET}
8275592Sru
83114412Sru.y.cpp:
8475592Sru	$(YACC) $(YFLAGS) $(.IMPSRC)
85114412Sru	mv -f y.tab.c $(.PREFIX).cpp
8675592Sru	mv -f y.tab.h $(.PREFIX)_tab.h
8775592Sru
8875592Sru.SUFFIXES: .man .1 .2 .3 .4 .5 .6 .7 .8
8975592Sru
9075592Sruversion=`cat $(GROFF_DIST)/VERSION`
9175592Srurevision=`sed -e 's/^0$$//' -e 's/^[1-9].*$$/.&/' $(GROFF_DIST)/REVISION`
9275592Sru
9375592Sru.man.8 .man.7 .man.6 .man.5 .man.4 .man.3 .man.2 .man.1:
9475592Sru	@${ECHO} Making $@ from $<
9575592Sru	@-rm -f $@
9675592Sru	@sed -e "s;@BINDIR@;${BINDIR};g" \
9775592Sru	-e "s;@FONTDIR@;$(fontdir);g" \
98104869Sru	-e "s;@LOCALFONTDIR@;$(localfontdir);g" \
99104869Sru	-e "s;@LEGACYFONTDIR@;$(legacyfontdir);g" \
10075592Sru	-e "s;@MACRODIR@;$(tmacdir);g" \
10175592Sru	-e "s;@SYSTEMMACRODIR@;$(systemtmacdir);g" \
10275592Sru	-e "s;@LOCALMACRODIR@;$(localtmacdir);g" \
103104869Sru	-e "s;@DOCDIR@;$(docdir);g" \
104104869Sru	-e "s;@EXAMPLEDIR@;$(exampledir);g" \
105104869Sru	-e "s;@HTMLDOCDIR@;$(htmldocdir);g" \
106151504Sru	-e "s;@PDFDOCDIR@;$(pdfdocdir);g" \
10775592Sru	-e "s;@DEVICE@;$(DEVICE);g" \
10875592Sru	-e "s;@DEFAULT_INDEX@;$(indexdir)/$(indexname);g" \
10975592Sru	-e "s;@DEFAULT_INDEX_NAME@;$(indexname);g" \
11075592Sru	-e "s;@INDEX_SUFFIX@;$(indexext);g" \
11175592Sru	-e "s;@COMMON_WORDS_FILE@;$(common_words_file);g" \
11275592Sru	-e "s;@MAN1EXT@;1;g" \
11375592Sru	-e "s;@MAN5EXT@;5;g" \
11475592Sru	-e "s;@MAN7EXT@;7;g" \
11575592Sru	-e "s;@TMAC_S_PREFIX@;$(tmac_s_prefix);g" \
11675592Sru	-e "s;@TMAC_M_PREFIX@;$(tmac_m_prefix);g" \
11775592Sru	-e "s;@TMAC_AN_PREFIX@;$(tmac_an_prefix);g" \
11875592Sru	-e "s;@TMAC_MDIR@;$(tmacdir)/mm;g" \
11975592Sru	-e "s;@BROKEN_SPOOLER_FLAGS@;$(BROKEN_SPOOLER_FLAGS);g" \
12075592Sru	-e "s;@VERSION@;$(version)$(revision);g" \
12175592Sru	-e "s;@MDATE@;`$(SHELL) ${GROFF_DIST}/mdate.sh $<`;g" \
12275592Sru	-e "s;@g@;$(g);g" \
123118449Sache	-e "s;@G@;`echo $(g) | LC_ALL=C tr a-z A-Z`;g" \
12475592Sru	$< >$@
12575592Sru
12675592Sru.SUFFIXES: .sh .pl
12775592Sru
12875592Sru.sh .pl:
12975592Sru	@${ECHO} Making ${.TARGET} from ${.IMPSRC}
13075592Sru	@sed -e "s|@BINDIR@|${BINDIR}|g" \
131151504Sru	     -e 's|@GROFF_BIN_PATH_SETUP@|GROFF_RUNTIME="$${GROFF_BIN_PATH=${BINDIR}}:"|g' \
132114412Sru	     -e "s;@FONTDIR@;$(fontdir);g" \
133114412Sru	     -e "s|@SEP@|:|g" \
13475592Sru	     -e "s|@VERSION@|$(version)$(revision)|" \
13575592Sru	     -e "s|@g@|$(g)|g" \
13675592Sru	     ${.IMPSRC} >${.TARGET}
13775592Sru
13875592SruTOPREL?=	..
13975592SruGROFF_DIST=	${.CURDIR}/${TOPREL}/../../../contrib/groff
14075592SruDIST_SUBDIR?=	${.CURDIR:T}
14175592SruDIST_DIR=	${GROFF_DIST}/${DIST_SUBDIR}
14218189Sphk.PATH: ${DIST_DIR}
143