# @(#)makefile	2.2 1/20/88
# the following can be added to CFLAGS for various things
#
# add -DNOVOID		If your compiler can not handle the void keyword.
# add -DBSD		For BSD4.[23] UNIX Systems.
# add -DDOS		For MS-DOS/PC-DOS Systems, Micro-Soft C 4.0, Turbo C
#				Use the ANSI option.
# add -DNOGETOPT	If your library doesn't have getopt().
#				Another routine will be used in its place.
# add -DNOVARARGS	If you have neither <stdarg.h> (ANSI C) or
#				<varargs.h> (pre-ANSI C).
#				Another method will be compiled instead.
# add -Ddodebug		To compile in debugging trace statements.
# add -Ddoyydebug	To compile in yacc trace statements.

CFLAGS= -g -Ddodebug -Ddoyydebug
CC= cc
ALLFILES= makefile cdgram.y cdlex.l cdecl.c cdecl.1 testset testset++
BIN= /usr/lubin

cdecl: c++decl test

c++decl: cdgram.c cdlex.c cdecl.c
	$(CC) $(CFLAGS) -o cdecl cdecl.c
	-ln cdecl c++decl

cdlex.c: cdlex.l
	lex cdlex.l && mv lex.yy.c cdlex.c

cdgram.c: cdgram.y
	yacc cdgram.y && mv y.tab.c cdgram.c

test:
	./cdecl < testset
	./c++decl < testset++

install: c++decl
	mv cdecl $(BIN)/cdecl
	ln $(BIN)/cdecl $(BIN)/c++decl

clean:
	rm -f cdgram.c cdlex.c cdecl y.output c++decl

clobber: clean
	rm -f $(BIN)/cdecl $(BIN)/c++decl

cdecl.cpio: $(ALLFILES)
	ls $(ALLFILES) | cpio -ocv > cdecl.cpio

cdecl.shar: $(ALLFILES)
	shar $(ALLFILES) > cdecl.shar
tar :
	tar cf cdecl.tar MANIFEST POSTER cdecl.1 cdecl.c cdelc.sh cdgram.y \
		cdlex.l makefile testset testset++
	compress cdecl.tar


