#
# makefile for the C preprocessor
#
# options:
#       "print" prints source files
#       "test" runs some sample tests (controlled by Makefile in tst)
#       "install" installs npp in /lib/cpp
#       "lint" runs lint on the appropriate source
#       by default the object file "npp" is created
#

CCFLAGS = -O
I = /usr/include
OBJ = cpp.o sym.o ifexp.o

cpp:            $(OBJ)
	cc -n -o cpp $(OBJ) -ll
/lib/cpp:       cpp
	/etc/instcmd -m 1775 cpp /lib/cpp
	rm $(OBJ)

cpp.o:		cpp.c		$I/stdio.h $I/ctype.h cpp.h \
				sym.h 
sym.o:		sym.c		$I/stdio.h sym.h cpp.h \
				keywords 
ifexp.o:	ifexp.y		lex.yy.c $I/stdio.h cpp.h \
				sym.h 
lex.yy.c:       ifexp.l         cpp.h sym.h
	lex ifexp.l

print:
	@pr Makefile cpp.h sym.h keywords cpp.c sym.c ifexp.l ifexp.y

test:
	@chdir tst; make

lint:
	@lint cpp.c sym.c y.tab.c

save: cpp.h+ sym.h+ keywords+ cpp.c+ sym.c+ ifexp.l+ ifexp.y+

.c.c+:
	save $*.c
	@touch $*.c; touch $*.o
.h.h+:
	save $*.h
	@touch $*.h

cpp.h+: cpp.h
sym.h+: sym.h
keywords+: keywords
cpp.c+: cpp.c
sym.c+: sym.c
ifexp.l+: ifexp.l
ifexp.y+: ifexp.y
