OS=__$(shell uname)
BUILD=..

include $(BUILD)/make.inc

LIB_INC=-I$(BUILD)/gpklib -I$(BUILD)
CC=$(CCLIB)

.PRECIOUS: $(BUILD)/libgpk.a

OBJS= mid2exp.o midexp.o midpnt.o mid3exp.o qromo.o mid_inv1.o mid_inv_half.o
OBJS1=trapzd.o midsqrt.o mid2sqrt.o romexp.o rom_mid_exp.o mid_inv2.o mid_prop.o
OBJS2=polint.o ratint.o

HDRS= romberg.h
HEADERS=${HDRS:%=$(INC)/gpklib/%}
LHDRS=${HDRS:%=$(BUILD)/gpklib/%}

.PHONY: all
all: $(BUILD)/libgpk.a($(OBJS) $(OBJS1) $(OBJS2)) $(LHDRS)


install: $(HEADERS)

$(INC)/gpklib/% : %
	../install-sh -c $* $(INC)/gpklib/$* -m 0444

$(BUILD)/gpklib/% : %
	../install-sh -c $* $(BUILD)/gpklib/$* -m 0444


$(OBJS) : $(LHDRS)
$(OBJS1) : $(LHDRS)
$(OBJS2) : $(LHDRS)

re_test : re_test.o all
	$(LD) -o re_test re_test.o $(BUILD)/libgpk.a -lm

test_rom : test_rom.o all
	$(LD) -o test_rom test_rom.o $(BUILD)/libgpk.a -lm

clean:
	rm -f *.o *.a *.so
