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