#PLATFORM=-DS32
#RANLIB=@true

PLATFORM=-DSUN3
RANLIB=ranlib

.SUFFIXES:
.SUFFIXES: .junk .ex .o .c .C .h .doc .cl .ms

INCL=..
#PRODUCED=libbh.a stringtest.ex memtest.ex
PRODUCED=libbh.a 
TOBJ=stringtest.o memtest.o
CCFLAGS=-I$(INCL) +i

H=\
GrowingBuf.h \
RingBuffer.h \
charP.h \
avl.h \
avlbase.h \
basictypes.h \
elapsedtime.h \
fault.h \
gavl.h \
gavl_inh.h \
gdring.h \
giterator.h \
gqueue.h \
gring.h \
gstack.h \
heap.h \
parsebuf.h \
smallset.h \
stringt.h

LOBJ=\
error_count.o \
avl.o \
avlbase.o \
RingBuffer.o \
elapsedtime.o\
heap.o \
parsebuf.o \
BHObject.o \
GrowingBuf.o \
stringt.o

COBJ= $(INCL)/lib/mem/mem.o $(INCL)/lib/misc/assert.dbug.o
TOOLS=../../vax/tools
SHORT_LINES=$(TOOLS)/lineshorten 60



.o.ex:
	CC -o $*.ex $*.o libbh.a
.cl.h:
	nroff -ms macros.ms $*.cl >$*.h
.ms.doc:
	nroff -ms $*.ms >$*.doc
.c.o:		# For compiling .c files produced for PC or other cross compilation
	cc -c $*.c
.C.o :
	CC -c $(PLATFORM) $(CCFLAGS) $*.C
.C.junk :
	CC -c -E ${PLATFORM} $(CCFLAGS) $*.C  | $(SHORT_LINES) | sed "/^#/d" > $*.junk.C
	make $*.junk.o
final: $(PRODUCED)
libbh.a: ${LOBJ} $(COBJ)
	rm -f libbh.a
	ar crv libbh.a `lorder ${LOBJ} ${COBJ} | tsort`
	$(RANLIB) libbh.a
lib/misc/assert.dbug.c:
	ln lib/misc/assert.c lib/misc/assert.dbug.c
vax:
	make -f makefile.vax "CCFLAGS=$(CCFLAGS)"
pc:
	make -f makefile.pc "CCFLAGS=$(CCFLAGS)"
clean:
	rm -f *.o *.out *junk* *..c core
	make -f makefile.vax realclean
	make -f makefile.pc realclean
realclean:
	make clean
	rm -f ${PRODUCED} __ctdt.*

$(LOBJ) $(TOBJ): $H
stringtest.ex: libbh.a stringtest.o
memtest.ex: libbh.a memtest.o
