home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
unix
/
volume24
/
psroff3.0
/
part07
/
Makefile
next >
Wrap
Makefile
|
1991-10-09
|
13KB
|
438 lines
# Copyright 1985, 1986, 1987, 1988, 1989, 1990, 1991 Chris Lewis
# All Rights Reserved
#
# See the LICENSE file for a full description of the restrictions
# under which this software is provided.
#
# This makefile requires System V compatible "make". *Not* V7
# vanilla BSD or Ultrix or Sun. Most modern systems will have
# a copy of the SV one somewhere (eg: .../s5bin/make).
#
# Function: Upper level makefile; configuration options.
#
#
#ident "@(#)Makefile: 2.16 Copyright 91/04/02 17:02:22 Chris Lewis"
# Use s5make on Ultrix!
MAKE = make
# Only uncomment the following braindamage if your MAKE doesn't
# understand "include".
#MAKE = sed -e '/include/r ../makeincl' -e '/include/d' Makefile | make -f - $(MAKEFLAGS)
# Set to where you want the user-interfaces to go. /usr/lbin
# is also common. /usr/bin if you don't have a specific place
# for non-standard programs.
BINDIR = /usr/local/bin
# Testing type (default postscript (ps)):
# Use lj for laserjet.
TTYPE = ps
# Libraries for Troff2 internals, created if it doesn't exist.
# This *must* be a directory all by itself with no other stuff
# in it. This should be suitable for everybody except networked
# systems where you may want to put this on a common area (one
# per platform type (eg: Sun 3 vs. Sun 4)
LIBDIR = /usr/lib/troff2
# Directory for Laserjet fonts. Don't change this unless you
# really have to.
LJF = $(LIBDIR)/lib/lj
# nroff/troff macro directory for tmac.t2. Change this only
# if you insist on keeping /usr/lib/tmac "virginal".
T2DIR = /usr/lib/tmac
# Where your real macros are - leave this alone unless your UNIX
# is really wierd.
RTMACDIR = /usr/lib/tmac
# upper level man directory, with subdirectories man1, man2 etc.
# Could be /usr/man/mann, /usr/man/manl, /usr/man/man1, /usr/man/l_man/man1
MANDIR = /usr/man/mann
# Desired extension for man page. Often the last letter of MANDIR.
# or 1L, or simply 1.
MANEXT = n
# Change this at your peril - your troff *must* support -F!
# (font width files (ft??) are placed under FONTDIR/<width>/ft??)
# (see lib/psrofflib.S). Will NOT clash with anything already there.
FONTDIR = /usr/lib/font
# Set this to -lc_s if you have 386/ix style shared libraries and you
# wish to use them. Don't know about any other system's shared libraries.
LIBFLAGS =
# Bourne shell. *All* Bourne shells with the exception of extremely
# braindamaged ones (such as Ultrix or vanilla BSD) will work fine.
# Ultrix/Dynix may need the ... s5bin/sh one. Korn or bash
# *should* work just fine, but I've never tested 'em.
#
# This is also here for make, but if you have SHELL defined in your
# *own* environment, you can't trust this to work anyways.
#
SHELL = /bin/sh
# Try "make testbug" If make stops, uncomment IGNORESH and
# try "make testbug" again. If it still stops, complain to your
# vendor - your shell is BADLY broken.
#IGNORESH = set +e ;
# How to ensure that shell scripts use the *right* shell.
# "#! /bin/sh" may work for you (BSDish). ": /bin/sh" may work
# for you (Xenix or System V).
#
# Frankly, none of this crap is necessary on a sane O/S.
# (Even Xenix gets this right for crying out loud! But *noooo*
# Not Ultrix or Sun or Dynix BSD universe....)
#
# ": /usr/bin/sh5" works for Ultrix. "#! /bin/sh" for pure BSD.
# Do not use $(SHELL) in this line because if your environment has
# SHELL defined, it may *override* the above SHELL definition.
#
# System V/Xenix usually:
STARTSHELL = : /bin/sh
# #! something (tr wierdness is to get "#" into it)
STARTSHELL = `echo 'X! /bin/sh' | tr X '\043'`
# Whether you need "cc -c"'d font width tables for troff.
# Don't set this non-null unless nothing else works.
# I know of no machine needing it. See TROUBLE file.
COMPILE =
# Compile flags needed to compile things on your machine.
# Usually just -O. May need gcc stuff.
#
CCFLAGS = -O
# If you're using gcc or something else, change this:
CC = cc
# Do not comment any of the following out. If you aren't going
# to use TeX PK fonts with HP Laserjet output, just NEVER execute
# makebuildljfonts.
#
# If you have Rick Richardson's sfp2pk, set it's full path here:
# Only of interest for LJ/buildfonts. If you don't have sfp2pk,
# leave this alone, the code won't try to run it.
SFP2PK = /usr4/public/bin/sfp2pk
# If you have TeX fonts onboard, list the directories that
# contain them. Only of interest for LJ/buildfonts.
# You can always set this to "/", it'll just take a long time, but
# it will find ALL PK's on your system.
PKFONTS = /usr/lib/font/devjet /usr5/texfonts/fonts
# Where you want to build fonts, set this to the name of the
# directory where you want to make them. Caution: this could be
# enormous... (5000+ blocks)
NEWFONTS = /tmp/newfonts
# If you are going to be working with ditroff, set this to the
# path to the makedev (DWB) or mkfont (PD via comp.sources.unix) program.
# If this doesn't point at an executable program, nothing will happen.
# A make install in the widths directory will go through the psrofflib
# file, looking for each configuration requiring ditroff, and install
# the needed widths in the proper directory. This will NOT overwrite
# files not created by this process.
MAKEDEV = /u/clewis/src/mkfont/mkfont
# Dinna touch from here on
.SUFFIXES: .S .S~
.S~:
@rm -f $@
$(GET) -p $(GFLAGS) $< | ./sedscript > $@
@chmod 444 $@
.S~.S:
@rm -f $@
$(GET) -p $(GFLAGS) $< > $@
@chmod 444 $@
.S:
rm -f $@
./sedscript < $@.S > $@
@chmod 444 $@
# Main stuff:
MAIN = troff2.o opt.o utils.o t2conf.o cattab.o debug.o
# Drivers:
BACKENDS = lj.o pk.o pkc.o ps.o dt.o dit.o
DEFINES = '-DLIBDIR="$(LIBDIR)/lib"' '-DFONTDIR="$(FONTDIR)"'\
'-DLJF="$(LJF)"' $(CCFLAGS)
# Creation of sedscript for parameterization.
SEDSCRIPT = "sed -e 's;%%LIBDIR%%;$(LIBDIR);g' \
-e 's;%%LJF%%;$(LJF);g' \
-e 's;%%STARTSHELL%%;'\"$(STARTSHELL)\"';g' \
-e 's;%%COMPILE%%;$(COMPILE);g' \
-e 's;%%FONTDIR%%;$(FONTDIR);g' \
-e 's;%%MANDIR%%;$(MANDIR);g' \
-e 's;%%MANEXT%%;$(MANEXT);g' \
-e 's;%%CCFLAGS%%;$(CCFLAGS);' \
-e 's;%%CC%%;$(CC);' \
-e 's;%%LIBFLAGS%%;$(LIBFLAGS);' \
-e 's;%%SFP2PK%%;$(SFP2PK);' \
-e 's;%%PKFONTS%%;$(PKFONTS);' \
-e 's;%%NEWFONTS%%;$(NEWFONTS);' \
-e 's;%%T2DIR%%;$(T2DIR);' \
-e 's;%%MAKEDEV%%;$(MAKEDEV);' \
-e 's^%%IGNORESH%%^$(IGNORESH)^' \
-e 's;%%RTMACDIR%%;$(RTMACDIR);g'"
CFLAGS = $(DEFINES)
all: troff2ps subst.done makeincl psroff README TROUBLE LASERFONTS \
MISC DITROFF INSTALL LICENSE LJIII submakes
subst.done: sedscript
rm -f psroff makeincl
touch subst.done
submakes:
cd adapters ; $(MAKE) all
cd lib ; $(MAKE) all
cd man ; $(MAKE) all
cd utils ; $(MAKE) all
cd widths ; $(MAKE) all
cd tests ; $(MAKE) all
psroff: psroff.S sedscript
@echo "Extracting $@ with variable substitutions"
@rm -f $(@) ; ./sedscript < $@.S > T ; chmod 555 T ; mv T $@
makeincl: makeincl.S sedscript
@echo "Extracting $@ with variable substitutions"
@rm -f $(@) ; ./sedscript < $@.S > T ; chmod 555 T ; mv T $@
audit: audit.S sedscript
@echo "Extracting $@ with variable substitutions"
@rm -f $(@) ; ./sedscript < $@.S > T ; chmod 555 T ; mv T $@
unpackljfonts:
@ $(IGNORESH) find . -name '*.UU' -print | \
while read i ; \
do \
ft=`echo $$i | sed -e 's/.UU//'` ; \
if [ -s $$ft ] ; \
then \
echo "Removing $$i" ; \
rm -f $$i ; \
else \
rm -f $$ft ; \
echo "uudecoding $$i -> $$ft" ; \
uudecode < $$i ; \
if [ ! -s $$ft ] ; \
then \
echo "Whoops - uudecode failed on $$i - bad path?" ; \
exit 1 ; \
else \
rm $$i ; \
fi ; \
fi ; \
done
buildljfonts: unpackljfonts
make troff2ps makeincl
cd lib ; make lj.fonts lj.lib
cd utils ; make buildfonts
installljfonts:
test -d $(LIBDIR) || mkdir $(LIBDIR)
test -d $(LIBDIR)/lib || mkdir $(LIBDIR)/lib
test -d $(LIBDIR)/lib/lj || mkdir $(LIBDIR)/lib/lj
$(IGNORESH) files=`echo fonts.lj/*.pk` ; \
if [ "$$files" != 'fonts.lj/*.pk' ] ; \
then \
cp fonts.lj/*.pk $(LJF) ; \
chmod 644 $(LJF)/* ; \
fi
$(IGNORESH) files=`echo fonts.lj/*.sfp` ; \
if [ "$$files" != 'fonts.lj/*.sfp' ] ; \
then \
cp fonts.lj/*.sfp $(LJF) ; \
chmod 644 $(LJF)/* ; \
fi
@echo "don't panic if the next line dies"
$(IGNORESH) test -z "$(PKFONTS)" -o ! -d "$(NEWFONTS)" \
|| cp $(NEWFONTS)/* $(LJF)
register:
make troff2ps makeincl
cd lib ; make lj.fonts lj.lib
cd widths ; make ljwidths widths
@echo "Now su to root and type 'make installwidths'"
installwidths: makeincl
cd widths; $(MAKE) installwidths
install: makeincl
test -d $(BINDIR) || mkdir $(BINDIR)
test -d $(MANDIR) || echo "No MANDIR directory. Have you got MANDIR right?"
test -d $(LIBDIR) || mkdir $(LIBDIR)
test -d $(LIBDIR)/adapters || mkdir $(LIBDIR)/adapters
test -d $(LIBDIR)/lib || mkdir $(LIBDIR)/lib
test -d $(RTMACDIR) || mkdir $(RTMACDIR)
test -d $(FONTDIR) || mkdir $(FONTDIR)
rm -f $(BINDIR)/psroff.old
-cp $(BINDIR)/psroff $(BINDIR)/psroff.old
cp psroff $(BINDIR)/psroff
rm -f $(LIBDIR)/troff2ps.old
-cp $(LIBDIR)/troff2ps $(LIBDIR)/troff2ps.old
cp troff2ps $(LIBDIR)/troff2ps
chmod 755 $(LIBDIR)/troff2ps $(BINDIR)/psroff
cd lib ; $(MAKE) install
cd adapters ; $(MAKE) install
cd man ; $(MAKE) install
cd utils ; $(MAKE) install
cd widths; $(MAKE) install
troff2ps: $(MAIN) $(BACKENDS)
$(CC) $(CFLAGS) -o troff2ps $(MAIN) $(BACKENDS) $(LIBFLAGS)
# The following is commented out because make has a bug in that
# even if you don't want to make lint, it insists on making
# the .c's from the SCCS files. Dumb stupid....
#lint: $(MAIN:.o=.c) $(BACKENDS:.o=.c)
# lint -p $(CFLAGS) $(MAIN:.o=.c) $(BACKENDS:.o=.c) > output.lint
# Drivers include dependencies - add to this list if you're adding
# drivers.
dit.o: defs.h
t2conf.o: defs.h ps.h lj.h dt.h
ps.o: defs.h ps.h
dt.o: defs.h dt.h
lj.o: defs.h lj.h pkc.h pk.h
pk.o: defs.h pk.h pkc.h
pkc.o: defs.h pk.h pkc.h
cattab.o: defs.h pk.h
debug.o: defs.h pk.h
troff2.o utils.o opt.o: defs.h
sedscript: Makefile defs.h
rm -f sedscript
echo $(SEDSCRIPT) \
`sed -n -e \
'/T2VERSION/s/^.*\(R[0-9]* PL.*\)".*/-e "s;%%T2VERSION%%;\1;"/p' \
defs.h` > T
chmod 755 T
mv T sedscript
clean: makeincl
rm -f core *.o troff2ps psroff diagnostics audit
rm -fr mon.out output.lint TEST* DITTEST AUDITP AUDITP.c
rm -fr FONTS
cd adapters ; $(MAKE) clean
cd man ; $(MAKE) clean
cd utils ; $(MAKE) clean
cd lib ; $(MAKE) clean
cd widths ; $(MAKE) clean
cd tests ; $(MAKE) clean
rm -f sedscript makeincl subst.done */subst.done
# Yes, this is a little wierd, but in this way I can figure
# out what you are...
TEST: Makefile defs.h tests/testtab.m tests/exttab.m makeincl
cd lib ; make
rm -f TEST1 TEST2
PATH=.:$(LIBDIR):$$PATH \
troff2ps -V | sed -e 's/^.*- \(.*\)/.ds 2v "\1/' > TEST1
echo ".ds pt \"($(TTYPE))" >> TEST1
echo ".ds 2d \"`date`" >> TEST1
echo ".sp" > TEST2
echo ".ps 10" >> TEST2
echo ".vs 12p" >> TEST2
echo ".ad 1" >> TEST2
echo "DEFS.H DEFINITIONS:" >> TEST2
sed -n -e '/Edit no more/q' \
-e '/T2VERSION/d' \
-e '/LIBDIR/d' \
-e 's/[ ]*\/\*.*//' \
-e '/^.define[ ]*\([^ ]*\)[ ]*\(.*\)$$/s//define \1=\2;/' \
-e 's/=;/;/' \
-e 's/^define //p' \
-e '/^.undef[ ]*\([^ ]*\).*/s//!\1;/p' \
defs.h >> TEST2
#echo ".br" >> TEST2
echo "MAKEFILE DEFINITIONS:" >> TEST2
echo "LIBDIR = $(LIBDIR);" >> TEST2
echo "LJF = $(LJF);" >> TEST2
echo "STARTSHELL = $(STARTSHELL); " >> TEST2
echo "SHELL = $(SHELL); " >> TEST2
echo "COMPILE = $(COMPILE);" >> TEST2
echo "FONTDIR = $(FONTDIR);" >> TEST2
echo "MANDIR = $(MANDIR);" >> TEST2
echo "CCFLAGS = $(CCFLAGS);" >> TEST2
echo "CC = $(CC);" >> TEST2
echo "LIBFLAGS = $(LIBFLAGS);" >> TEST2
echo "RTMACDIR = $(RTMACDIR);" >> TEST2
echo "PKFONTS = $(PKFONTS);" >> TEST2
echo "NEWFONTS = $(NEWFONTS);" >> TEST2
echo "IGNORESH = $(IGNORESH);" >> TEST2
echo "SFP2PK = $(SFP2PK)." >> TEST2
echo "TTYPE = $(TTYPE)." >> TEST2
@echo "Don't worry if the uname/grep fails"
-grep '^trofftype' lib/psrofflib >> TEST2
echo "Uname results:" >> TEST2
-uname -a >> TEST2
cat TEST1 tests/testtab.m TEST2 > TEST
rm -f TEST1 TEST2
test: TEST
tbl TEST | PATH=:.:$(LIBDIR):$$PATH psroff -T$(TTYPE) $(TFLAGS)
DITTEST: TEST
echo ".bp" >> TEST2
echo ".sp |.3i" >> TEST2
cat TEST TEST2 tests/exttab.m > DITTEST
dittest: DITTEST
eqn DITTEST | tbl | PATH=:.:$(LIBDIR):$$PATH psroff -T$(TTYPE) $(TFLAGS)
check: audit sedscript makeincl
cd lib ; $(MAKE)
./audit
checkinstall: audit sedscript makeincl
cd lib ; $(MAKE)
./audit install
# This is how I build a release - don't even try running this...!
buildrelease: clean unpackljfonts
$(IGNORESH) t=`find . -name 'p.*' -print`; \
if [ -n "$$t" ] ; \
then \
echo "files still out: $$t" ; \
exit 1 ; \
fi
make buildfinal
buildfinal:
make clean
t/cleantree
t/mkmanifest
t/mkkits
t/cleantree
# Impossible file, we hope....
WF = /cowsnovskibumsteinpastafazoola/bdkdkdk
testbug:
@ $(IGNORESH) if [ -r $(WF) ] ; \
then \
echo "Bizarre - are you sure you have $(WF)?" ; \
else \
echo "IGNORESH set correctly" ; \
fi
fixperms:
find $(LIBDIR) -type f -exec chmod +r '{}' ';'
find $(LIBDIR) $(FONTDIR) -type d -exec chmod +rx '{}' ';'