# Source files needed to create the library. Some of theme are generated by swig
SRC = ../../../architecture/faust/dsp/faust-dynamic-engine.h ../../../architecture/faust/dsp/faust-dynamic-engine.cpp FaustEngine.i FaustEngineConstants.java FaustEngine_wrap.cxx dsp.java FaustEngine.java FaustEngineJNI.java

all : faustProcessing.jar libFaustEngine.jnilib

faustProcessing.jar : $(SRC) FaustProcessing.java
	javac -d . *.java  -classpath .:/Applications/Processing.app/Contents/Java/core.jar
	jar cf faustProcessing.jar faustProcessing/* com/grame/faust/*
	
libFaustEngine.jnilib : $(SRC)
	g++ -dynamiclib -I/System/Library/Frameworks/JavaVM.framework/Headers -DLLVM_DSP -o libFaustEngine.jnilib ../../../architecture/faust/dsp/faust-dynamic-engine.cpp FaustEngine_wrap.cxx -framework CoreAudio -framework AudioUnit -framework CoreServices -L /usr/local/lib -ljack -ldl -lz -lncurses -lfaust `llvm-config --ldflags --libs all`
	
FaustProcessing.java : ../src/FaustProcessing.java
	cp ../src/FaustProcessing.java .
	
$(SRC) : ../src/FaustEngine.*
	cp ../src/FaustEngine.* .
	swig -c++ -java -I/usr/local/include -package com.grame.faust -outdir . FaustEngine.i
	
clean:
	rm -f $(SRC) *.jar *.jnilib FaustProcessing.java
	rm -rf com faustProcessing
	
