#
# Makefile for libDSP
# Copyright (C) 2000-2001 Jussi Laako
#
# This program 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.
#
# This program 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 should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#

CXX = g++
CXXFLAGS = -mcpu=k6 -march=k6 -O6 -fomit-frame-pointer -ffast-math -funroll-loops -malign-loops=3 -malign-jumps=3 -malign-functions=3 -mpreferred-stack-boundary=3 -mfancy-math-387 -Wall
DEFS = -D_REENTRANT -D_THREAD_SAFE
INCS = -I.
LIBS = -lm #-ldrfftw -ldfftw
LIBTOOL = libtool
PREFIX = /usr/local

VERSION = 0:6:0

CCSRC = cc
OBJ = o
LOBJ = lo

SRCS = DSPOp.$(CCSRC) \
	Decimator.$(CCSRC) \
	Filter.$(CCSRC) \
	Hankel.$(CCSRC) \
	PFAFFT.$(CCSRC) \
	Transform4.$(CCSRC) \
	Transform8.$(CCSRC) \
	TransformS.$(CCSRC)

OBJS = DSPOp.$(OBJ) \
	Decimator.$(OBJ) \
	Filter.$(OBJ) \
	Hankel.$(OBJ) \
	PFAFFT.$(OBJ) \
	Transform4.$(OBJ) \
	Transform8.$(OBJ) \
	TransformS.$(OBJ)

LOBJS = DSPOp.$(LOBJ) \
	Decimator.$(LOBJ) \
	Filter.$(LOBJ) \
	Hankel.$(LOBJ) \
	PFAFFT.$(LOBJ) \
	Transform4.$(LOBJ) \
	Transform8.$(LOBJ) \
	TransformS.$(LOBJ)

default: all

all: libdsp.la

.cc.o: $(SRCS)
	$(LIBTOOL) --mode=compile $(CXX) $(CXXFLAGS) $(DEFS) $(INCS) -c $<

libdsp.la: $(OBJS)
	$(LIBTOOL) --mode=link $(CXX) -rpath $(PREFIX)/lib -version-info $(VERSION) -o libdsp.la $(LOBJS) $(LIBS)

install: libdsp.la
	install -m 755 -d $(PREFIX)/include/dsp
	install -m 644 dsp/DSPConfig.hh $(PREFIX)/include/dsp
	install -m 644 dsp/DSPOp.hh $(PREFIX)/include/dsp
	install -m 644 dsp/Decimator.hh $(PREFIX)/include/dsp
	install -m 644 dsp/Filter.hh $(PREFIX)/include/dsp
	install -m 644 dsp/Hankel.hh $(PREFIX)/include/dsp
	install -m 644 dsp/PFAFFT.hh $(PREFIX)/include/dsp
	install -m 644 dsp/Transform4.hh $(PREFIX)/include/dsp
	install -m 644 dsp/Transform8.hh $(PREFIX)/include/dsp
	install -m 644 dsp/TransformS.hh $(PREFIX)/include/dsp
	$(LIBTOOL) --mode=install install libdsp.la $(PREFIX)/lib

dep: $(SRCS)
	$(CXX) $(DEFS) $(INCS) -MM $(SRCS) >libdsp.dep

clean:
	rm -f *.$(OBJ) *.$(LOBJ) *~ libdsp.la core

cleanall:
	rm -rf *.$(OBJ) *.$(LOBJ) *~ libdsp.la .libs core

include libdsp.dep

