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