#   Copyright (C) 2004 Tom Szilagyi
#
#   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., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#   $Id: Makefile,v 1.16 2004/08/13 18:34:31 tszilagyi Exp $


#####################################################################
# PLEASE CHANGE THIS to your preferred installation location!
#
# Change this if you want to install somewhere else. In particular
# you may wish to remove the middle "local/" part of the path.

INSTALL_PLUGINS_DIR	=	/usr/local/lib/ladspa/
INSTALL_LRDF_DIR	=	/usr/local/share/ladspa/rdf/

# NO EDITING below this line is required
# if all you want to do is install and use the plugins.
#####################################################################



# GENERAL

CC		=	gcc
CFLAGS		=	-I. -O3 -Wall -fomit-frame-pointer -fstrength-reduce -funroll-loops -ffast-math -c -fPIC -DPIC
LDFLAGS		=	-nostartfiles -shared -Wl,-Bsymbolic -lc -lm -lrt

PLUGINS		=	tap_autopan.so \
			tap_chorusflanger.so \
			tap_deesser.so \
			tap_dynamics_m.so \
			tap_dynamics_st.so \
			tap_eq.so \
			tap_eqbw.so \
			tap_doubler.so \
			tap_pinknoise.so \
			tap_pitch.so \
			tap_reflector.so \
			tap_reverb.so \
			tap_rotspeak.so \
			tap_limiter.so \
			tap_sigmoid.so \
			tap_echo.so \
			tap_tremolo.so \
			tap_tubewarmth.so \
			tap_vibrato.so


all: $(PLUGINS)

# RULES TO BUILD PLUGINS FROM C CODE

tap_tremolo.so: tap_tremolo.o tap_utils.h ladspa.h

tap_eq.so: tap_eq.o tap_utils.h ladspa.h

tap_eqbw.so: tap_eqbw.o tap_utils.h ladspa.h

tap_echo.so: tap_echo.o tap_utils.h ladspa.h

tap_reverb.so: tap_reverb.o tap_reverb.h tap_reverb_presets.h tap_utils.h ladspa.h

tap_limiter.so: tap_limiter.o tap_utils.h ladspa.h

tap_autopan.so: tap_autopan.o tap_utils.h ladspa.h

tap_deesser.so: tap_deesser.o tap_utils.h ladspa.h

tap_vibrato.so: tap_vibrato.o tap_utils.h ladspa.h

tap_rotspeak.so: tap_rotspeak.o tap_utils.h ladspa.h

tap_pitch.so: tap_pitch.o tap_utils.h ladspa.h

tap_dynamics_m.so: tap_dynamics_m.o tap_dynamics_presets.h tap_utils.h ladspa.h

tap_dynamics_st.so: tap_dynamics_st.o tap_dynamics_presets.h tap_utils.h ladspa.h

tap_reflector.so: tap_reflector.o tap_utils.h ladspa.h

tap_pinknoise.so: tap_pinknoise.o tap_utils.h ladspa.h

tap_doubler.so: tap_doubler.o tap_utils.h ladspa.h

tap_sigmoid.so: tap_sigmoid.o tap_utils.h ladspa.h

tap_tubewarmth.so: tap_tubewarmth.o tap_utils.h ladspa.h

tap_chorusflanger.so: tap_chorusflanger.o tap_utils.h ladspa.h


# OTHER TARGETS

install: targets
	-mkdir -p		$(INSTALL_PLUGINS_DIR)
	cp *.so 		$(INSTALL_PLUGINS_DIR)
	-mkdir -p		$(INSTALL_LRDF_DIR)
	cp tap-plugins.rdf 	$(INSTALL_LRDF_DIR)
	cp tap_reverb.rdf 	$(INSTALL_LRDF_DIR)

targets:	$(PLUGINS)

always:	

clean:
	-rm -f `find . -name "*.so"`
	-rm -f `find . -name "*.o"`
	-rm -f `find .. -name "*~"`

%.o: %.c
	@echo "Compiling $<"
	@$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ 

%.so: %.o
	@echo "Creating  $@"
	@$(CC) $(LDFLAGS) -o $@ $<
