# Makefile for DPS, Ingo Steller
#
# make test: for making al routines and the test program
# make:		 make all
#
#
# Version 0.1
LIBDIR = ../../lib/${HOSTTYPE}
BIN    = ../../bin/${HOSTTYPE}

CFLAGS = ${STDCFLAGS} ${EXTRAFLAGS}

IOBJS = index.o error_exit.o \
	ind_gen_direct.o ind_sort_merge.o ind_choose.o \
	ind_help.o ind_fortran.o
DOBJS = dps_index.o dps_index_read.o
FOBJS = dps_fortran_test.o
LIB = ../../../lib/libdps_index.a ../../../lib/libdps.a \
   ../../../lib/libfftpack.a -lm 
LIBDIR = ../../../lib
BIN = ../../../bin

all: index 

dps_fortran: index $(FOBJS)
	$(F77) $(FFLAGS) -o $(BIN)/dps_fortran_test $(FOBJS) $(LIB)

index: $(IOBJS) 
	ar ruv $(LIBDIR)/libdps_index.a $(IOBJS)
	chmod 644 $(LIBDIR)/libdps_index.a

dps_index: $(LIBDIR)/libdps.a index $(DOBJS)
	${CC} $(CFLAGS) -o $(BIN)/dps_index $(DOBJS) $(LIB)

dps_index_read.o: dps_index_read.c dps_index_read.h

dps_index.o: dps_index.c index.h

index.o: index.c index.h

invert.o: invert.f global.inc include.inc
	${F77} ${FFLAGS} -o invert.o invert.f

error_exit.o: error_exit.f

ind_gen_direct.o: ind_gen_direct.c ind_gen_direct.h

ind_sort_merge.o: ind_sort_merge.c ind_sort_merge.h index.h

ind_choose.o: ind_choose.c index.h ind_choose.h

ind_help.o:

ind_fortran.o: ind_fortran.c index.h

dps_fortran_test.o: 

clean:
	- rm $(DOBJS) $(IOBJS) $(FOBS) $(BIN)/dps_index $(BIN)/dps_fortran_test $(LIBDIR)/libdps_index.a
