1 #Copyright (C) 1989, 1990, 1991 Free Software Foundation, Inc.
2 # Written by James Clark (jjc@jclark.uucp)
4 #This file is part of groff.
6 #groff is free software; you can redistribute it and/or modify it under
7 #the terms of the GNU General Public License as published by the Free
8 #Software Foundation; either version 1, or (at your option) any later
11 #groff is distributed in the hope that it will be useful, but WITHOUT ANY
12 #WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 #FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 #You should have received a copy of the GNU General Public License along
17 #with groff; see the file LICENSE. If not, write to the Free Software
18 #Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
20 # Define PAGE to be letter if your PostScript printer uses 8.5x11 paper (USA)
21 # and define it to be A4, if it uses A4 paper (rest of the world).
25 # BINDIR says where to install executables.
28 GROFFLIBDIR=/usr/local/lib/groff
30 # FONTDIR says where to install dev*/*.
31 FONTDIR=$(GROFFLIBDIR)/font
33 # FONTPATH says where to look for dev*/*.
34 FONTPATH=.:$(FONTDIR):/usr/local/lib/font:/usr/lib/font
36 # MACRODIR says where to install macros.
37 MACRODIR=$(GROFFLIBDIR)/tmac
39 # MACROPATH says where to look for macro files.
40 MACROPATH=.:$(MACRODIR):/usr/lib/tmac
42 # DEVICE is the default device.
45 # PSPRINT is the command to use for printing a PostScript file.
46 # It must be a simple command, not a pipeline.
49 # DVIPRINT is the command to use for printing a TeX dvi file.
50 # It must be a simple command, not a pipeline.
53 # HYPHENFILE is the file containing the hyphenation patterns.
54 HYPHENFILE=$(GROFFLIBDIR)/hyphen
56 # MANROOT is the root of the man page directory tree.
57 MANROOT=/usr/local/man
59 # MAN1EXT is the man section for user commands.
61 MAN1DIR=$(MANROOT)/man$(MAN1EXT)
63 # MAN5EXT is the man section for file formats.
65 MAN5DIR=$(MANROOT)/man$(MAN5EXT)
67 # MAN7EXT is the man section for macros.
69 MAN7DIR=$(MANROOT)/man$(MAN7EXT)
71 # The groff ms macros will be available as -m$(TMAC_S).
72 # If you use `TMAC_S=s', you can use the Unix ms macros by using
73 # groff -ms -M/usr/lib/tmac.
76 # Include -DBROKEN_SPOOLER in CPPDEFINES if you have a PostScript
77 # spooler or previewer that is unable to cope with anything after
78 # %%EndProlog and before the first page (old versions of TranScript
79 # have this problem) or gets confused by included documents (the Sun
80 # pageview previewer has this problem), or if you are going to be
81 # sharing PostScript documents with others who might be running such a
82 # spooler or previewer.
83 # Include -DCFRONT_ANSI_BUG if you are using AT&T C++ 2.0 with an ANSI C
85 # Include -DHAVE_VFORK if you have vfork().
86 # Include -DHAVE_SYS_SIGLIST if you have sys_siglist[].
87 # Include -DHAVE_UNION_WAIT if wait() is declared by osfcn.h to take
88 # an argument of type union wait * (Sun C++ does this). Don't include
89 # it if you're using the libg++ header files.
90 CPPDEFINES=-DBROKEN_SPOOLER -DHAVE_VFORK -DHAVE_SYS_SIGLIST # -DHAVE_UNION_WAIT -DCFRONT_ANSI_BUG
92 # Uncomment the next line if you don't have fmod in your math library.
93 # I believe this is needed on Ultrix and BSD 4.3.
96 # Uncomment the next line if you don't have strtol in your C library.
97 # I believe this is needed on BSD 4.3.
100 # Additional flags needed to compile lib/malloc.c
103 # Use this with System V
105 # Use this with SunOS 4.1
106 # MALLOCFLAGS=-DBSD -DSUNOS_LOCALTIME_BUG
108 # Comment this out if the GNU malloc gives you problems, or if you would
109 # prefer to use the system malloc.
113 # Comment the next line out if groff.c gives problems.
116 # CC is the C++ compiler
118 # I'm told that -fno-inline is needed on a 68030-based Apollo
121 # OLDCC is the C compiler.
127 WARNING_FLAGS=#-Wall -Wcast-qual -Wwrite-strings
129 # Use this to pass additional flags on the command line.
132 # CFLAGS are passed to sub makes
133 CFLAGS=$(PROFILE_FLAG) $(DEBUG_FLAG) $(OPTIMIZE_FLAG) $(WARNING_FLAGS) \
134 $(CPPDEFINES) $(XCFLAGS)
137 # OLDCFLAGS are passed to sub makes
138 OLDCFLAGS=$(DEBUG_FLAG) $(PROFILE_FLAG) $(OPTIMIZE_FLAG) $(XOLDCFLAGS)
141 LDFLAGS=$(PROFILE_FLAG) $(DEBUG_FLAG) $(XLDFLAGS)
142 # Libraries needed for linking C++ programs.
144 # Libraries needed for linking C++ programs that use libm.a.
149 # Define RANLIB to be empty if you don't have ranlib.
152 # YACC can be either yacc or bison -y
156 ETAGS=/usr/local/bin/etags
157 # Flag to make etags treat *.[ch] files as C++
162 SUBDIRS=lib troff pic tbl eqn etc driver ps tty dvi macros man
164 # SUBFLAGS says what flags to pass to sub makes
165 SUBFLAGS="CC=$(CC)" "CFLAGS=$(CFLAGS)" "LDFLAGS=$(LDFLAGS)" \
166 "OLDCC=$(OLDCC)" "OLDCFLAGS=$(OLDCFLAGS)" \
167 "YACC=$(YACC)" "YACCFLAGS=$(YACCFLAGS)" \
168 "DEVICE=$(DEVICE)" "FONTPATH=$(FONTPATH)" "MACROPATH=$(MACROPATH)" \
169 "MALLOCFLAGS=$(MALLOCFLAGS)" "MALLOC=$(MALLOC)" \
170 "FMOD=$(FMOD)" "STRTOL=$(STRTOL)" \
171 "AR=$(AR)" "RANLIB=$(RANLIB)" "LIBS=$(LIBS)" "MLIBS=$(MLIBS)" \
172 "FONTDIR=$(FONTDIR)" "BINDIR=$(BINDIR)" "PAGE=$(PAGE)" \
173 "MACRODIR=$(MACRODIR)" "HYPHENFILE=$(HYPHENFILE)" \
174 "TMAC_S=$(TMAC_S)" "MAN1EXT=$(MAN1EXT)" "MAN1DIR=$(MAN1DIR)" \
175 "MAN5EXT=$(MAN5EXT)" "MAN5DIR=$(MAN5DIR)" \
176 "MAN7EXT=$(MAN7EXT)" "MAN7DIR=$(MAN7DIR)"
178 all: $(SUBDIRS) $(GROFF) shgroff
182 echo Making all in $@; \
183 $(MAKE) $(SUBFLAGS) all
185 troff pic tbl eqn etc ps tty dvi: lib
189 @for dir in $(SUBDIRS); do \
190 echo Making TAGS in $$dir; \
191 (cd $$dir; $(MAKE) "ETAGSFLAGS=$(ETAGSFLAGS)" "ETAGS=$(ETAGS)" TAGS); \
196 -rm -f groff *.o core
198 clean: topclean FORCE
199 @for dir in $(SUBDIRS) doc; do \
200 echo Making clean in $$dir; \
201 (cd $$dir; $(MAKE) clean); done
203 distclean: topclean FORCE
204 @for dir in $(SUBDIRS) doc; do \
205 echo Making distclean in $$dir; \
206 (cd $$dir; $(MAKE) distclean); done
208 # You really don't want to use this target.
209 realclean: topclean FORCE
210 @for dir in $(SUBDIRS) doc; do \
211 echo Making realclean in $$dir; \
212 (cd $$dir; $(MAKE) realclean); done
214 install.nobin: FORCE shgroff
215 -[ -d $(BINDIR) ] || mkdir $(BINDIR)
216 -[ -d $(GROFFLIBDIR) ] || mkdir $(GROFFLIBDIR)
217 -[ -d $(MANROOT) ] || mkdir $(MANROOT)
218 @for dir in $(SUBDIRS); do \
219 echo Making install.nobin in $$dir; \
220 (cd $$dir; $(MAKE) $(SUBFLAGS) install.nobin); done
221 if [ -z "$(GROFF)" ] ; then cp shgroff $(BINDIR)/groff ; fi
223 install.bin: FORCE $(GROFF)
224 -[ -d $(BINDIR) ] || mkdir $(BINDIR)
225 @for dir in $(SUBDIRS); do \
226 echo Making install.bin in $$dir; \
227 (cd $$dir; $(MAKE) $(SUBFLAGS) install.bin); done
228 if [ -n "$(GROFF)" ] ; then cp groff $(BINDIR)/groff ; fi
230 install: install.bin install.nobin
233 -[ -d $(GROFFLIBDIR) ] || mkdir $(GROFFLIBDIR)
234 -[ -d $(MACRODIR) ] || mkdir $(MACRODIR)
235 sed -f macros/fixmacros.sed -e 's;/usr/lib/tmac;$(MACRODIR);' \
236 /usr/lib/macros/mmt >$(MACRODIR)/tmac.m
237 sed -f macros/fixmacros.sed /usr/lib/tmac/sys.name \
238 >$(MACRODIR)/sys.name
239 patch -s $(MACRODIR)/tmac.m macros/mm.diff
242 @echo Making $@ from groff.sh
244 @sed -e "s;@BINDIR@;$(BINDIR);" \
245 -e "s;@DEVICE@;$(DEVICE);" \
246 -e "s;@PROG_PREFIX@;$(PROG_PREFIX);" \
247 -e "s;@FONTDIR@;$(FONTDIR);" \
248 -e "s;@PSPRINT@;$(PSPRINT);" \
249 -e "s;@DVIPRINT@;$(DVIPRINT);" \
250 groff.sh >$@ || rm -f $@
253 groff: groff.o lib/libgroff.a
254 $(CC) $(LDFLAGS) -o $@ groff.o lib/libgroff.a $(LIBS)
258 groff.o: groff.c stringify
259 $(CC) -c -Ilib $(CFLAGS) -DDEVICE=\"$(DEVICE)\" \
260 "-DPSPRINT=`$(SHELL) stringify $(PSPRINT)`" \
261 "-DDVIPRINT=`$(SHELL) stringify $(DVIPRINT)`" \
264 groff.o: lib/lib.h lib/errarg.h lib/error.h lib/stringclass.h lib/font.h
266 bindist: all VERSION Makefile.bd README.bd FORCE
267 -[ -d bindist ] || mkdir bindist
269 for dir in $(SUBDIRS); do \
270 (cd $$dir; $(MAKE) "BINDIR=$$topdir/bindist" install.bin); done
271 cp README.bd bindist/README
273 if [ "$(GROFF)" ] ; then cp groff bindist/groff ; fi
274 @echo Making bindist/Makefile
275 @sed -e "s;@GROFFLIBDIR@;$(GROFFLIBDIR);" \
276 -e "s;@FONTDIR@;$(FONTDIR);" \
277 -e "s;@FONTPATH@;$(FONTPATH);" \
278 -e "s;@MACRODIR@;$(MACRODIR);" \
279 -e "s;@MACROPATH@;$(MACROPATH);" \
280 -e "s;@HYPHENFILE@;$(HYPHENFILE);" \
281 -e "s;@DEVICE@;$(DEVICE);" \
282 -e "s;@GROFF@;$(GROFF);" \
283 Makefile.bd >bindist/Makefile