
# C++ compiler for the test routine neffttest.cpp
CPPC=g++

# c compiler for the core nefft algorithm in nefft.c
CC=gcc

# we need two external functions: 
# first a fft library. We use fftw here

# second a function to compute the bessel function  i0
# we provide bessel.c that has been taken from www.netlib.org:
# cephes/bessel.tgz
# Cephes Math Library Release 2.8:  June, 2000
# Copyright 1984, 1987, 2000 by Stephen L. Moshier
#
# But you can use any other implementation.
# check the code for bessel_i0 in nefft.c, there's an example
# how to use NAG instead


# directory for fftw.h
FFTW_INC=/u/fourmon/c/fftw-2.0/fftw


all:   neffttest nefft.o nefft_float.o

clean:
	rm -f *.o

distclean:
	rm -f *.o
	rm -f nefftest
	rm -f *~

neffttest: neffttest.o nefft.o bessel.o
	$(CPPC)  -o $@ neffttest.o nefft.o bessel.o -L$(FFTW_LIB) -lm -lfftw


neffttest.o: neffttest.cpp
	$(CPPC) -c  -o $@ -O2 -I$(FFTW_INC) neffttest.cpp -DREALTYPE=double

# nefft.c contains the core nonequispaced code. this should be compiled
# with all optimizations. Note that nefft.c itself does not provide
# equispaced fft code. You can use any

nefft.o: nefft.c 
	$(CC) -c -o $@ -O3 -I$(FFTW_INC) nefft.c -DREALTYPE=double

# a float version is complied into nefft_float.o
# it is used by the fast fourier reconstrucion algorithm
nefft_float.o: nefft.c
	$(CC) -c -o $@ -O3 -I$(FFTW_INC) nefft.c -DREALTYPE=float

# bessel.c is only needed when no other bessel function implemenation
# is available
bessel.o: bessel.c
	$(CC) -c -o $@ bessel.c
