# @(#)makefile 1.5 of 7/6/84 11:16:50

TOOLS=../tools
YACC=$(TOOLS)/yacc/yacc
YFLAGS=-d
CC=cc
CFLAGS=
LDFLAGS=
STRIP=strip

ROOT=
LIBDIR=$(ROOT)/usr/lib
OWN=bin
GRP=bin

HDRS =	0.h align.h iorec.h parser.h pc.h tree.h yystype.h

SRCS =	call.c clas.c const.c conv.c cset.c error.c \
	fdec.c fend.c fhdr.c forop.c hash.c \
	lab.c lookup.c lval.c main.c nl.c p2put.c \
	pccaseop.c pcfunc.c pclval.c pcproc.c put.c \
	rec.c rval.c sdb_info.c stat.c stkval.c \
	tmps.c tprint.c tree.c type.c utilities.c var.c \
	yyget.c yylex.c yypanic.c yyrecover.c pas.y

OBJS =	call.o clas.o const.o conv.o cset.o error.o \
	fdec.o fend.o fhdr.o forop.o hash.o \
	lab.o lookup.o lval.o main.o nl.o p2put.o \
	pccaseop.o pcfunc.o pclval.o pcproc.o put.o \
	rec.o rval.o sdb_info.o stat.o stkval.o \
	tmps.o tprint.o tree.o type.o utilities.o var.o \
	yyget.o yylex.o yypanic.o yyrecover.o y.tab.o 

all : pc0

tabs.inc:	y.tab.c
	echo '/YLAST/m0' >edfile
	echo '2,/yyexca/-1d' >>edfile
	echo '/yyreds/,$$d' >>edfile
	echo 'g/yytabelem/s//int/g' >>edfile
	echo '$$a' >>edfile
	echo '#endif' >>edfile
	echo '.' >>edfile
	echo 'w tabs' >>edfile
	echo 'q' >>edfile
	ed - y.tab.c <edfile
	cc -DYYDEBUG=1 $(TOOLS)/tabgen.c -o tabgen
	./tabgen >tabs.inc
	echo '1,/YYLAST/-1d' >edfile
	echo '2,$$d' >>edfile
	echo 'r tabs.inc' >>edfile
	echo 'w tabs.inc' >>edfile
	echo 'q' >>edfile
	ed - y.tab.c <edfile
	rm -f edfile tabs tabgen

y.tab.h y.tab.c : pas.y yaccpar
		 $(YACC) $(YFLAGS) pas.y

.c.o:	
	$(CC) $(CFLAGS) -c $*.c

pc0: 	$(OBJS)
	$(CC) $(LDFLAGS) $(FFLAG) -o pc0 $(OBJS)

install: pc0
	rm -f $(LIBDIR)/pc0
	cp pc0 $(LIBDIR)/pc0
	$(STRIP) $(LIBDIR)/pc0
	chmod 775 $(LIBDIR)/pc0
	chgrp $(GRP) $(LIBDIR)/pc0
	chown $(OWN) $(LIBDIR)/pc0

clean:
	rm -f *.o y.tab.c y.tab.h tabs.inc tabs edfile tabgen

clobber: clean
	rm -f pc0

# Individual file dependencies follow...
#
call.o: 0.h pc.h tree.h yystype.h
clas.o: 0.h tree.h yystype.h
const.o: 0.h tree.h yystype.h
conv.o: 0.h pc.h yystype.h
cset.o: 0.h pc.h tree.h yystype.h
error.o: 0.h yystype.h parser.h
fdec.o: 0.h pc.h tree.h yystype.h
fend.o: 0.h pc.h tree.h yystype.h
fhdr.o: 0.h align.h pc.h tree.h yystype.h
forop.o: 0.h pc.h tree.h yystype.h
hash.o: 0.h parser.h y.tab.h yystype.h
lab.o: 0.h pc.h tree.h yystype.h
lookup.o: 0.h yystype.h
lval.o: 0.h pc.h tree.h yystype.h
main.o: 0.h parser.h yystype.h
nl.o: 0.h opcode.h yystype.h
p2put.o: 0.h pc.h yystype.h align.h
pccaseop.o: 0.h pc.h tree.h yystype.h
pcfunc.o: 0.h opcode.h pc.h tree.h yystype.h
pclval.o: 0.h pc.h tree.h yystype.h
pcproc.o: 0.h opcode.h pc.h tree.h yystype.h
	$(CC) -Wa,-j $(CFLAGS) -c pcproc.c
put.o: 0.h pc.h yystype.h
rec.o: 0.h tree.h yystype.h
rval.o: 0.h pc.h tree.h yystype.h
sdb_info.o: 0.h pc.h yystype.h
stat.o: 0.h pc.h tree.h yystype.h
stkval.o: 0.h pc.h tree.h yystype.h
tmps.o: 0.h align.h pc.h yystype.h
tprint.o: 0.h parser.h tree.h y.tab.h yystype.h
tree.o: 0.h parser.h tree.h y.tab.h yystype.h
type.o: 0.h tree.h yystype.h
utilities.o: 0.h yystype.h
var.o: 0.h align.h iorec.h pc.h yystype.h
y.tab.o: parser.h tree.h yystype.h
yyget.o: 0.h parser.h yystype.h
yylex.o: 0.h parser.h y.tab.h yystype.h
yypanic.o: parser.h y.tab.h yystype.h
yyrecover.o: 0.h parser.h tabs.inc y.tab.h yystype.h
