# Makefile for Ease Translator (et).
#
#	$Header: Makefile,v 2.0 88/06/15 14:47:35 root Exp $
#
#	$Log:	Makefile,v $
# Revision 2.0  88/06/15  14:47:35  root
# Baseline release for net posting. ADR.
# 
#
#	James S. Schoner, Purdue University Computing Center,
#			  West Lafayette, Indiana  47907
#
#	Copyright (c) 1985 by Purdue Research Foundation
#
#	All rights reserved.
#

INCLUDE =

DEST = /usr/local/bin

OWNER = root
GROUP = staff
MODE = 755

DEFS =
CFLAGS = -O ${DEFS} ${INCLUDE}

LP = lpr
LPFLAGS = -J"Ease Source"

HDR = symtab.h
SRC = main.c emitcf.c errors.c idman.c strops.c symtab.c fixstrings.c
LST = Makefile lexan.l parser.y ${HDR} ${SRC}
DEP = parser.c lexan.c ${SRC}
OBJ = parser.o lexan.o main.o emitcf.o errors.o idman.o strops.o symtab.o \
	fixstrings.o

CFILES= $(SRC) $(DEP)

et: ${OBJ}
	cc ${CFLAGS} -o et ${OBJ} -ll

clean: FRC
	rm -f et *.o lexan.c parser.c y.output yacc.acts yacc.tmp \
	      lexdefs.h y.tab.h errs Makefile.bak

depend:
	${CC} -M ${CFLAGS} ${CFILES} | \
	sed -e ':loop' \
	    -e 's/\.\.\/[^ /]*\/\.\./../' \
	    -e 't loop' | \
	awk ' { if ($$1 != prev) { print rec; rec = $$0; prev = $$1; } \
		else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
		       else rec = rec " " $$2 } } ; \
	      END { print rec } ' > makedep
	echo '/^# DO NOT DELETE THIS LINE/+1,$$d' >eddep
	echo '$$r makedep' >>eddep
	echo 'w' >>eddep
	cp Makefile Makefile.bak
	ex - Makefile < eddep
	rm eddep makedep

install: et FRC
	install -c -m ${MODE} -o ${OWNER} -g ${GROUP} -s et ${DEST}

lint:   ${DEP} symtab.h FRC
	lint -hxn ${DEP}

print:  ${LST} FRC
	@pr -f ${LST} | ${LP} ${LPFLAGS}

spotless: clean FRC
	rcsclean ${LST}

y.tab.h parser.c: parser.y
	@rm -f parser.c
	yacc -d parser.y
	mv y.tab.c parser.c

# the following dummy rule is because of the results of 'make depend'
./lexdefs.h:	lexdefs.h

lexdefs.h:	y.tab.h
	-(cmp -s y.tab.h lexdefs.h || cp y.tab.h lexdefs.h)

lexan.c: lexan.l

${HDR} ${SRC} lexan.l parser.y:
	co $@

FRC:

# DO NOT DELETE THIS LINE -- make depend uses it

main.o: main.c ./fixstrings.h /usr/include/stdio.h
emitcf.o: emitcf.c /usr/include/stdio.h ./symtab.h ./fixstrings.h
errors.o: errors.c /usr/include/stdio.h ./fixstrings.h
idman.o: idman.c /usr/include/stdio.h ./symtab.h ./fixstrings.h
strops.o: strops.c ./fixstrings.h /usr/include/stdio.h /usr/include/strings.h
strops.o: ./symtab.h
symtab.o: symtab.c ./fixstrings.h /usr/include/stdio.h /usr/include/ctype.h
symtab.o: ./symtab.h
fixstrings.o: fixstrings.c /usr/include/strings.h
parser.o: parser.c ./fixstrings.h /usr/include/stdio.h ./symtab.h
lexan.o: lexan.c /usr/include/stdio.h ./fixstrings.h ./symtab.h ./lexdefs.h
main.o: main.c ./fixstrings.h /usr/include/stdio.h
emitcf.o: emitcf.c /usr/include/stdio.h ./symtab.h ./fixstrings.h
errors.o: errors.c /usr/include/stdio.h ./fixstrings.h
idman.o: idman.c /usr/include/stdio.h ./symtab.h ./fixstrings.h
strops.o: strops.c ./fixstrings.h /usr/include/stdio.h /usr/include/strings.h
strops.o: ./symtab.h
symtab.o: symtab.c ./fixstrings.h /usr/include/stdio.h /usr/include/ctype.h
symtab.o: ./symtab.h
fixstrings.o: fixstrings.c /usr/include/strings.h
