CC = gcc
CFLAGS = -O2 -Wall -I. -D_WIN32
FC = gfortran
FFLAGS = -Wall -fbounds-check

# Default rules
%.o: %.c
	${CC} ${CFLAGS} -c $<
%.o: %.f
	${FC} ${FFLAGS} -c $<
%.o: %.F
	${FC} ${FFLAGS} -c $<
%.o: %.f90
	${FC} ${FFLAGS} -c $<
%.o: %.F90
	${FC} ${FFLAGS} -c $<

all:	 libq65.a q65.exe q65_ftn_test.exe

OBJS1 = normrnd.o npfwht.o pdmath.o qra15_65_64_irr_e23.o \
	    q65.o qracodes.o

libq65.a: $(OBJS1)
	ar cr libq65.a $(OBJS1) 
	ranlib libq65.a

OBJS2 = q65test.o 

q65.exe: $(OBJS2)
	${CC} -o q65.exe $(OBJS2) libq65.a -lm

OBJS3 = q65_ftn_test.o q65_subs.o

q65_ftn_test.exe: $(OBJS3)
	${FC} -o q65_ftn_test.exe $(OBJS3) libq65.a -lm

.PHONY : clean

clean:
	$(RM) *.o libq65.a q65.exe
