CFLAGS = -g
OBJS = trio.o strio.o
TARGETLIB = libtrio.a
LDFLAGS = -L. -ltrio -lm

AR=ar
RANLIB=ranlib

PURIFY = purify
PURIFYOPTIONS = -chain-length=16 -first-only=YES

all: $(TARGETLIB) $(TARGET) regression example

pure: $(TOBJS) $(OBJS)
	$(PURIFY) $(PURIFYOPTIONS) $(CC) $(CFLAGS) $^ $(LDFLAGS)

regression: regression.o $(TARGETLIB)
	$(CC) -o regression regression.o $(LDFLAGS)

example: example.o $(TARGETLIB)
	$(CC) -o example example.o $(LDFLAGS)

$(TARGETLIB): $(OBJS)
	$(AR) ruv $(TARGETLIB) $(OBJS)
	$(RANLIB) $(TARGETLIB)

clean:
	rm -f *~ core regression example $(TOBJS) $(OBJS) $(TARGET) $(TARGETLIB)
