#Copyright 2001,2002 Matt Flax <flatmax@ieee.org>
#This file is part of the MFFM FFTw Wrapper library.
#
#MFFM MFFM FFTw Wrapper library is free software; you can 
#redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the License, or
#(at your option) any later version.
#
#MFFM FFTw Wrapper library is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.
#
#You have received a copy of the GNU General Public License
#along with the MFFM FFTw Wrapper library

CC=g++ -O3
#CC=g++-3.0 -O3
#CC=g++-3.2 -O3
#CC=g++-3.0 -ggdb
#CC=g++ -O2
.cc.o:
	$(CC) -fPIC -c $<
.C.o:
	$(CC) -fPIC -c $<
#MAKELIB=$(CC) -Wl,-shared,-soname
MAKELIB=$(CC) -shared -Wl,-soname

#EXAMPLES= complexFFTExample real2DFFTExample realFFTExample
SRC= realFFT.cc realFFTData.cc complexFFT.cc
SRC2D= real2DFFT.cc
OBJ=$(SRC:.cc=.o)
OBJ2D=$(SRC2D:.cc=.o)

all: $(OBJ) \
	$(OBJ2D) \
	libs \
	docs \
	ex

docs:
	doxygen

libs:
	$(MAKELIB),libfft.so.0.1 -o libfft.so.0.1 $(OBJ)
	$(MAKELIB),lib2Dfft.so.0.1 -o lib2Dfft.so.0.1 $(OBJ2D)

ex:
#fftw V2
#	$(CC) *.o -lrfftw -lfftw complexFFTExample.cc -o complexFFTExample
#	$(CC) *.o -lrfftw -lfftw real2DFFTExample.cc -o real2DFFTExample
#	$(CC) *.o -lrfftw -lfftw realFFTExample.cc -o realFFTExample
#fftw V3
	$(CC) *.o -lfftw3 complexFFTExample.cc -o complexFFTExample
	$(CC) *.o -lfftw3 real2DFFTExample.cc -o real2DFFTExample
	$(CC) *.o -lfftw3 realFFTExample.cc -o realFFTExample

clean:
	rm -f $(EXAMPLES) *.o a.out *~ *.txt lib*.so.0.1 complexFFTExample realFFTExample real2DFFTExample
