# Makefile for DPS, Ingo Steller
#
# make test: for making al routines and the test program
# make:		 make all
#
#
# Version 0.1

CFLAGS = ${STDCFLAGS}
LIB    = ../../lib/alpha
BIN    = ../../bin/alpha

OBJS = util.o vector_math.o cryst_matrix.o invert.o \
       ind_transform.o nrutil.o mat_inversion.o \
       ind_stat.o fftn.o read_om.o allocate.o ref_cell_on_xyz.o 
LIBS = -lfilec
LIB = ../../../lib
BIN = ../../../bin
HEADERS = util.h util_def.h
all: util fftpack_lib filec_lib

fftpack_lib:  
	cd fftpack; make -f Makefile

filec_lib:  
	cd filec; make -f Makefile

util: $(OBJS) 
	ar ruv $(LIB)/libdps.a $(OBJS)
	chmod 644 $(LIB)/libdps.a

util.o: $(HEADERS)
vector_math.o: $(HEADERS)
cryst_matrix.o: $(HEADERS)
invert.o: $(HEADERS)
	${F77} ${FFLAGS} -c -o invert.o invert.f

# read_peaks.o: $(HEADERS) read_peaks.h
ind_transform.o: $(HEADERS) ind_transform.h
nrutil.o: $(HEADERS)
mat_inversion.o: $(HEADERS)
# call_blas.o: $(HEADERS)
ind_stat.o: $(HEADERS)
read_om.o: $(HEADERS) read_om.h
# read_frame.o: $(HEADERS) read_frame.h
fftn.o: $(HEADERS)
allocate.o: $(HEADERS) allocate.h
ref_cell_on_xyz.o: $(HEADERS) ref_cell_on_xyz.h

dps_frameinfo.o: 

dps_frameinfo: dps_frameinfo.o util
	${CC} -c -o $(BIN)/dps_frameinfo dps_frameinfo.o $(LIB)/libdps.a \
            $(LIB)/libfilec.a -lm 

dps_analyseOM.o:

dps_analyseOM: dps_analyseOM.o util
	${CC} -c -o $(BIN)/dps_analyseOM dps_analyseOM.o $(LIB)/libdps.a -lm 

clean:
	- rm $(OBJS) $(LIB)/libdps.a dps_frameinfo.o $(BIN)/dps_frameinfo \
	     dps_analyseOM.o $(BIN)/dps_analyseOM
	cd fftpack; make -f Makefile clean

