# Generated automatically from Makefile.in by configure.
include $(BLDDIR)/Make.conf

# I don't really intend to make this as part of the distribution.
# but there are some clues here as to how you might.

.SUFFIXES:
.SUFFIXES: .c .o 

.PHONY: dummy

LINK=`$(SRCDIR)/config.guess`

# in case the libs are not installed and have been built in src (no chance)

LIBS+= -L$(LINK)/lib -L./src/lib -L../src/lib -L../../src/lib 
CPPFLAGS+= -I$(LINK)/include -I./src/include -I../src/include -I../../src/include
CFLAGS+=$(CPPFLAGS)

all: z

z:	z.o zlex.o zaux.o 
	- $(CC) -o $@ z.o zlex.o zaux.o $(LIBS) -lcc1

z.o:     ../../include/ccx.h $(SRCDIR)/examples/z/z.c
	-@ $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $(SRCDIR)/examples/z/z.c  -o $@
zlex.o:     ../../include/ccx.h $(SRCDIR)/examples/z/zlex.c
	-@ $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $(SRCDIR)/examples/z/zlex.c  -o $@
zaux.o:     ../../include/ccx.h $(SRCDIR)/examples/z/zaux.c
	-@ $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $(SRCDIR)/examples/z/zaux.c  -o $@

check: test

test:  z
	@ sh -c 'if [ -z "` ./z test1.z | grep error `" ] ; then \
	   echo test1 OK ; else echo test1 failed ; fi'
	@ sh -c 'if [ -z "` ./z test2.z | grep error `" ] ; then \
	   echo test2 OK ; else echo test2 failed ; fi'
	@ sh -c 'if [ -z "` ./z test3.z | grep error `" ] ; then \
	   echo test3 OK ; else echo test3 failed ; fi'

clean: dummy
	- rm -f z *.o *~ *.bak *.sw?

realclean: clean

.c.o: $< 
	$(CC) $(CFLAGS) $(DEFS) -c $(CPPFLAGS) $<

.y.c:
	echo need to remake $*.c
	echo try preccx $*.y $*.c

dummy:

