2.9BSD/usr/contrib/newcsh/src/Ovmakefile

#
#	makefile	4.1	10/9/80
#
# C Shell with process control
# PDP11 overlay (nonseparate I/D) Makefile
#
CC=	cc -V
CFLAGS=	-O -I/usr/src/ucb/libndir
XSTR=	/usr/ucb/xstr
ED=	-ed
AS=	as -V
RM=	-rm
CXREF=	/usr/ucb/cref
VGRIND=	csh /usr/ucb/vgrind
CTAGS=	/usr/ucb/ctags
LIBES=	-lovjobs

# uncomment next line to use smaller local routines instead of stdio routines
PW=	getpwent.o getpwnam.o getpwuid.o

# strings.o must be last in OBJS since it can change when previous files compile
OBJS=	sh.o sh.dol.o sh.err.o sh.exec.o sh.exp.o sh.func.o sh.glob.o \
	sh.hist.o sh.lex.o sh.misc.o sh.parse.o sh.print.o sh.sem.o sh.set.o \
	sh.proc.o sh.dir.o sh.time.o alloc.o sh.init.o printf.o tenex.o \
	ovdoprnt.o ${PW} strings.o

all: csh

cp: csh
	-strip csh
	cp csh ${DESTDIR}/bin/csh
	-rm csh *.o

cmp: csh
	cmp csh ${DESTDIR}/bin/csh
	rm *.o


csh: ${OBJS} sh.local.h
	ld -n -X -o csh /lib/crt0.o \
	-Z sh.dol.o sh.exec.o sh.exp.o sh.func.o \
	   sh.glob.o sh.print.o sh.time.o \
	-Z alloc.o sh.err.o sh.hist.o sh.lex.o sh.misc.o \
	   sh.parse.o sh.sem.o sh.set.o \
	-Z sh.proc.o sh.dir.o tenex.o -lovtermcap /usr/src/ucb/libndir/libovndir.a \
	-L sh.o sh.init.o printf.o ovdoprnt.o ${PW} \
	   strings.o ${LIBES} -lovc
	size csh

# Special massaging of C files for sharing of strings
.c.o:
	${CC} -E ${CFLAGS} $*.c | ${XSTR} -c -
	${CC} -c ${CFLAGS} x.c 
	mv x.o $*.o

# strings.o and sh.init.o are specially processed to be shared
strings.o: strings
	${XSTR}
	${CC} -S xs.c
# to undo comment out next line.
	${ED} - <:rofix xs.s
	${AS} -u -o strings.o xs.s
	${RM} xs.s

sh.init.o:
	${CC} -E ${CFLAGS} sh.init.c | ${XSTR} -c -
	${CC} ${CFLAGS} -S x.c
# to undo comment out next line.
	${ED} - <:rofix x.s
	${AS} -u -o sh.init.o x.s
	${RM} x.s
	
csh.prof: ${OBJS} sh.prof.o sh.local.h mcrt0.o
	rm -f csh.prof
	ld -X mcrt0.o ${OBJS} -o csh.prof ${LIBES} -lc

sh.o.prof:
	cp sh.c sh.prof.c
	cc -c ${CFLAGS} -DPROF sh.prof.c

lint:
	lint ${CFLAGS} sh*.c

print:
	@pr READ_ME
	@pr makefile makefile.*
	@(size -l a.out; size *.o) | pr -h SIZES
	@ls -l | pr 
	@pr sh*.h sh*.c alloc.c

vprint:
	@pr -l132 makefile 
	@(size -l a.out; size *.o) | pr -l84 -h SIZES
	@ls -l | pr -l132
	@pr -l132 sh*.h [a-rt-z]*.h sh*.c alloc.c

vgrind:
	@cp /dev/null index
	@for i in *.h; do vgrind -t -h "C Shell" $$i >/crp/bill/csh/$$i.t; done
	@for i in *.c; do vgrind -t -h "C Shell" $$i >/crp/bill/csh/$$i.t; done
	@vgrind -t -x -h Index index >/crp/bill/csh/index.t

clean:
	${RM} -f a.out strings x.c xs.c
	${RM} -f *.o sh.prof.c

tags:	/tmp
	${CTAGS} sh*.c