# ---- for GNU gcc ----

SOVER = 0

CC = gcc

CFLAGS = -g -pipe -Wall -fPIC -DPIC

OFLAGS = -O2

# ---- for SUN WS cc ----
#
#CC = cc
#
#CFLAGS = 
#
#OFLAGS = -xO2




all: libfft4f2d.so libfftsg2d.so libfftsg3d.so libshrtdct.so


libfft4f2d.so : fft4f2d.o alloc.o
	$(CC) -shared fft4f2d.o alloc.o -lm -Wl,-soname=$@.$(SOVER) -o $@.$(SOVER)
	ln -s $@.$(SOVER) $@

libfftsg2d.so : fftsg2d.o fftsg.o alloc.o
	$(CC) -shared fftsg2d.o fftsg.o alloc.o -lm -Wl,-soname=$@.$(SOVER) -o $@.$(SOVER)
	ln -s $@.$(SOVER) $@

libfftsg3d.so : fftsg3d.o fftsg.o alloc.o
	$(CC) -shared fftsg3d.o fftsg.o alloc.o -lm -Wl,-soname=$@.$(SOVER) -o $@.$(SOVER)
	ln -s $@.$(SOVER) $@

libshrtdct.so : shrtdct.o alloc.o
	$(CC) -shared shrtdct.o alloc.o -lm -Wl,-soname=$@.$(SOVER) -o $@.$(SOVER)
	ln -s $@.$(SOVER) $@


fft4f2dt.o : fft4f2dt.c
	$(CC) $(CFLAGS) $(OFLAGS) -c fft4f2dt.c -o fft4f2dt.o

fftsg2dt.o : fftsg2dt.c
	$(CC) $(CFLAGS) $(OFLAGS) -c fftsg2dt.c -o fftsg2dt.o

fftsg3dt.o : fftsg3dt.c
	$(CC) $(CFLAGS) $(OFLAGS) -c fftsg3dt.c -o fftsg3dt.o

shrtdctt.o : shrtdctt.c
	$(CC) $(CFLAGS) $(OFLAGS) -c shrtdctt.c -o shrtdctt.o


fft4f2d.o : fft4f2d.c
	$(CC) $(CFLAGS) $(OFLAGS) -c fft4f2d.c -o fft4f2d.o

fftsg2d.o : fftsg2d.c
	$(CC) $(CFLAGS) $(OFLAGS) -c fftsg2d.c -o fftsg2d.o

fftsg3d.o : fftsg3d.c
	$(CC) $(CFLAGS) $(OFLAGS) -c fftsg3d.c -o fftsg3d.o

fftsg.o : fftsg.c
	$(CC) $(CFLAGS) $(OFLAGS) -c fftsg.c -o fftsg.o

alloc.o : alloc.c
	$(CC) $(CFLAGS) $(OFLAGS) -c alloc.c -o alloc.o

shrtdct.o : shrtdct.c
	$(CC) $(CFLAGS) $(OFLAGS) -c shrtdct.c -o shrtdct.o




clean:
	rm -f *.o

