#
# Makefile for SenoraGC
#

srcdir = @srcdir@

CC = @CC@
CXX = @CXX@
RANLIB = @RANLIB@
AR = @AR@
ARFLAGS = @ARFLAGS@

CFLAGS = @CFLAGS@ @PREFLAGS@ @COMPFLAGS@ @PROFFLAGS@ @OPTIONS@

OBJS =  sgc.@LTO@

SRCS =  $(srcdir)/sgc.c

../libmzgc.@LIBSFX@: $(OBJS)
	$(MAKE) gcobjects
	$(AR) $(ARFLAGS) ../libmzgc.@LIBSFX@ $(OBJS)
	$(RANLIB) ../libmzgc.@LIBSFX@

test: $(OBJS) test.@LTO@
	$(CC) -o test $(OBJS) test.@LTO@

gcobjects: $(OBJS)

sgc.@LTO@: $(srcdir)/sgc.c $(srcdir)/autostat.inc $(srcdir)/collect.inc $(srcdir)/../utils/splay.c
	$(CC) $(CFLAGS) -I.. -c $(srcdir)/sgc.c -o sgc.@LTO@

test.@LTO@: $(srcdir)/test.c
	$(CC) $(CFLAGS) -c $(srcdir)/test.c -o test.@LTO@

clean:
	/bin/rm -f $(OBJS) gc.@LIBSFX@ test

# Extra dependencies

sgc.@LTO@: $(srcdir)/sgc.h

test.@LTO@: $(srcdir)/sgc.h
