WRAPSRCS:=$(wildcard results/*.cc)
PLUGINS:=$(WRAPSRCS:_ladspa.cc=.so)
VPATH=results:opcodes-gpl:opcodes-non-gpl
CXXFLAGS:=-Iopcodes-gpl -Iopcodes-non-gpl -I.
BUILDDIR=/u/conversy/tmp/qcs/build

TOBEDONE =  $(addprefix build/,$(notdir $(PLUGINS)))
#TOBEDONE = $(notdir $(OBJS))

all: $(TOBEDONE)
#	@echo $(TOBEDONE)

$(BUILDDIR)/%.so: results/%_ladspa.o $(BUILDDIR)/%.o $(BUILDDIR)/qcs.o
	g++ -shared -o $@ $^

$(BUILDDIR)/%.o: %.cc
	g++ $(CXXFLAGS) -c $< -o $@


# special 

$(BUILDDIR)/fm4op.so: results/fm4op_ladspa.o $(BUILDDIR)/fm4op.o $(BUILDDIR)/qcs.o $(BUILDDIR)/physutil.o
	g++ -shared -o $@ $^ 


$(BUILDDIR)/moog1.so: results/moog1_ladspa.o $(BUILDDIR)/moog1.o $(BUILDDIR)/qcs.o  $(BUILDDIR)/fm4op.so
	g++ -shared -o $@ $^

clean:
	find -name *.o -exec rm {} \;
	rm -f build/*.o build/*.so opcodes*/*.o

tar:
	(cd ..; tar cvzf q2ladspa.tgz q2ladspa; )
