#
# Some install variables
#
include ../pSather.options
include ../Make.config
HEADERDIR=../include
LIBDIR=../lib
CFLAGS=$(PCFLAGS) $(PSATHER) -I$(HEADERDIR)

OBJ=alloc.o exceptions.o locks.o psather.o attach.o \
    debug.o trace.o import.o cache.o stat.o fakegc.o 
HEADER= debug.h exceptions.h local.h locks.h pSather.h

libpSather.a:	$(OBJ)
	@-$(RM) libpSather.a 2> /dev/null
	$(AR) rc libpSather.a $(OBJ)
	($(RANLIB) libpSather.a || echo > /dev/null) > /dev/null 2> /dev/null

../lib/libam.a:	../am.options
	cd ../am; $(MAKE) install ; cd ../pSather

ALL:	$(OBJ)

install: libpSather.a
	$(CP) libpSather.a $(LIBDIR)
	$(CP) pSather.h $(HEADERDIR)
	$(RANLIB) $(LIBDIR)/libpSather.a > /dev/null
	echo "-lpSather -lam $(PLIBS)" > ../libraries
	echo "$(PCFLAGS)" | sed 's/-Wall//' > ../flags

clean:
	@-rm *.o 2> /dev/null
	@-rm test 2> /dev/null
	@-rm libpSather.a 2> /dev/null
	$(MAKE) depend

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

$(OBJ): Makefile ../Make.config ../pSather.options

depend:;
	sed '/^[a-zA-Z0-9_]*\.o: /,$$d' < Makefile > M
	gcc -MM $(CFLAGS) $(OBJ:.o=.c) | sed 's/:/: ..\/Make.config Makefile ..\/pSather.options/' >> M
	mv M Makefile

## All lines below will be managed by the depend: rule and should not
## be edited by hand.

alloc.o: ../Make.config Makefile ../pSather.options alloc.c pSather.h memory.h
exceptions.o: ../Make.config Makefile ../pSather.options exceptions.c pSather.h local.h locks.h
locks.o: ../Make.config Makefile ../pSather.options locks.c locks.h pSather.h attach.h local.h stat.h trace.h \
 memory.h debug.h
psather.o: ../Make.config Makefile ../pSather.options psather.c memory.h debug.h locks.h pSather.h trace.h stat.h
attach.o: ../Make.config Makefile ../pSather.options attach.c pSather.h locks.h local.h trace.h memory.h stat.h \
 debug.h
debug.o: ../Make.config Makefile ../pSather.options debug.c pSather.h local.h
trace.o: ../Make.config Makefile ../pSather.options trace.c pSather.h
import.o: ../Make.config Makefile ../pSather.options import.c pSather.h locks.h local.h stat.h debug.h trace.h
cache.o: ../Make.config Makefile ../pSather.options cache.c pSather.h atomic.h locks.h local.h trace.h stat.h \
 memory.h debug.h
stat.o: ../Make.config Makefile ../pSather.options stat.c pSather.h stat.h
fakegc.o: ../Make.config Makefile ../pSather.options fakegc.c




