| 1 |
LIB := $(shell faust --libdir) |
| 2 |
LIB_OPT := /opt/local/lib |
| 3 |
INC := $(shell faust --includedir) |
| 4 |
system := $(shell uname -s) |
| 5 |
|
| 6 |
DESTDIR ?= |
| 7 |
PREFIX ?= /usr/local |
| 8 |
LIB_OPT1 ?= |
| 9 |
|
| 10 |
ifeq ($(system), Darwin) |
| 11 |
LIB_OPT1=-framework CoreFoundation |
| 12 |
INC_OPT=/opt/local/include |
| 13 |
else ifeq ($(system), Linux) |
| 14 |
LDFLAGS=-Wl,--export-dynamic |
| 15 |
endif |
| 16 |
|
| 17 |
MACOSLIBS := -framework CoreAudio -framework AudioUnit -framework CoreServices -framework CoreMIDI -framework CoreFoundation |
| 18 |
|
| 19 |
LLVM := `llvm-config --link-static --ldflags --libs all --system-libs` |
| 20 |
|
| 21 |
prefix := $(DESTDIR)$(PREFIX) |
| 22 |
|
| 23 |
all: llvm-test llvm-algebra-test llvm-test-c faust-dynamic-engine-test |
| 24 |
|
| 25 |
faust-dynamic-engine-test: faust-dynamic-engine-test.cpp $(LIB)/libfaust.a |
| 26 |
$(CXX) -std=c++11 -O3 faust-dynamic-engine-test.cpp /usr/local/include/faust/dsp/faust-dynamic-engine.cpp -DLLVM_DSP -DJACK_DRIVER -DPORTAUDIO_DRIVER -DRTAUDIO_DRIVER -DSOUNDFILE -I$(INC) -I$(INC_OPT) -lsndfile -ljack -lportaudio -lrtaudio -L$(LIB) -L$(LIB_OPT) $(LIB_OPT1) $(LIB)/libfaust.a -lpthread $(LLVM) -o faust-dynamic-engine-test |
| 27 |
|
| 28 |
llvm-test: llvm-test.cpp $(LIB)/libfaust.a |
| 29 |
$(CXX) -std=c++11 -O3 llvm-test.cpp -I$(INC) -L$(LIB) -L$(LIB_OPT) $(LIB)/libfaust.a -lpthread $(LLVM) $(LDFLAGS) -o llvm-test |
| 30 |
|
| 31 |
llvm-test-poly: llvm-test-poly.cpp $(LIB)/libfaust.a |
| 32 |
$(CXX) -std=c++11 -O3 llvm-test-poly.cpp -I$(INC) -L$(LIB) -L$(LIB_OPT) $(LIB)/libfaust.a `pkg-config --cflags --libs jack gtk+-2.0` -lpthread $(LLVM) $(LDFLAGS) -o llvm-test-poly |
| 33 |
|
| 34 |
llvm-apiui-test: llvm-apiui-test.cpp $(LIB)/libfaust.a |
| 35 |
$(CXX) -std=c++11 -O3 llvm-apiui-test.cpp -I$(INC) -L$(LIB) -L$(LIB_OPT) $(LIB)/libfaust.a -lpthread $(LLVM) $(LDFLAGS) -o llvm-apiui-test |
| 36 |
|
| 37 |
# To test the LLVM backend with dynamic libfaust on Apple M1 and Rosetta |
| 38 |
llvm-test-x86: llvm-test.cpp |
| 39 |
$(CXX) -arch x86_64 -std=c++11 -O3 llvm-test.cpp -I$(INC) -L$(LIB) -L$(LIB_OPT) -lfaust -lpthread -DJIT_TARGET="\"x86_64-apple-darwin\"" -o llvm-test |
| 40 |
|
| 41 |
# To test the LLVM backend with dynamic libfaust on Apple M1 |
| 42 |
llvm-test-arm: llvm-test.cpp |
| 43 |
$(CXX) -std=c++11 -O3 llvm-test.cpp -I$(INC) -L$(LIB) -L$(LIB_OPT) -lfaust -lpthread -o llvm-test |
| 44 |
|
| 45 |
llvm-test-c: llvm-test.c $(LIB)/libfaust.a |
| 46 |
$(CXX) llvm-test.c -O3 -I $(INC) -L$(LIB_OPT) $(LIB)/libfaust.a -lpthread $(LLVM) -o llvm-test-c |
| 47 |
|
| 48 |
llvm-algebra-test: llvm-algebra-test.cpp $(LIB)/libfaust.a |
| 49 |
$(CXX) -std=c++11 -O3 llvm-algebra-test.cpp -I$(INC) -L$(LIB) -L$(LIB_OPT) $(LIB)/libfaust.a -lpthread $(LLVM) `pkg-config --cflags --libs gtk+-2.0` -o llvm-algebra-test |
| 50 |
|
| 51 |
install: |
| 52 |
([ -e llvm-test ]) && cp llvm-test $(prefix)/bin |
| 53 |
|
| 54 |
# Testing |
| 55 |
|
| 56 |
test: llvm-test |
| 57 |
./llvm-test foo.dsp |
| 58 |
|
| 59 |
test-c: llvm-test-c |
| 60 |
./llvm-test-c foo.dsp |
| 61 |
|
| 62 |
test-algebra :llvm-algebra-test |
| 63 |
./llvm-algebra-test |
| 64 |
|
| 65 |
test-poly: llvm-test-poly |
| 66 |
./llvm-test-poly organ.dsp |
| 67 |
./llvm-test-poly organ-effect.dsp |
| 68 |
|
| 69 |
clean: |
| 70 |
rm -f llvm-test llvm-test-poly llvm-test-c llvm-algebra-test faust-dynamic-engine-test |
| 71 |
|
| 72 |
help: |
| 73 |
@echo "Available targets:" |
| 74 |
@echo " test-algebra - test the DSP algebra API" |
| 75 |
@echo " test - test the factory/instance API" |
| 76 |
@echo " test-c - test the factory/instance API in C" |
| 77 |
@echo " test-poly - test the polyphonic factory/instance API, then with a gloabl effect" |
| 78 |
@echo " help - Display this help message" |