-
Notifications
You must be signed in to change notification settings - Fork 20
/
test.mk
68 lines (53 loc) · 1.83 KB
/
test.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# makefile fragment to make test.exe, the unit test program.
#include "../../arch.mk"
include $(RACK_DIR)/arch.mk
TEST_SOURCES = $(wildcard test/*.cpp)
TEST_SOURCES += $(wildcard dsp/**/*.cpp)
TEST_SOURCES += $(wildcard dsp/third-party/falco/*.cpp)
TEST_SOURCES += $(wildcard sqsrc/**/*.cpp)
TEST_SOURCES += dsp/third-party/src/minblep.cpp
TEST_SOURCES += dsp/third-party/kiss_fft130/tools/kiss_fftr.c
TEST_SOURCES += dsp/third-party/kiss_fft130/kiss_fft.c
## This is a list of full paths to the .o files we want to build
TEST_OBJECTS = $(patsubst %, build_test/%.o, $(TEST_SOURCES))
build_test/%.cpp.o: %.cpp
mkdir -p $(@D)
$(CXX) $(CXXFLAGS) -c -o $@ $<
build_test/%.c.o: %.c
mkdir -p $(@D)
$(CXX) $(CXXFLAGS) -c -o $@ $<
# Always define _PERF for the perf tests.
perf.exe : PERFFLAG = -D _PERF
# Turn off asserts for perf, unless user overrides on command line
perf.exe : FLAGS += $(ASSERTOFF)
FLAGS += $(PERFFLAG)
ifeq ($(ARCH), win)
# don't need these yet
# -lcomdlg32 -lole32 -ldsound -lwinmm
test.exe perf.exe : LDFLAGS = -static \
-mwindows \
-lpthread -lopengl32 -lgdi32 -lws2_32
endif
ifeq ($(ARCH), lin)
test.exe perf.exe : LDFLAGS = -rdynamic \
-lpthread -lGL -ldl \
$(shell pkg-config --libs gtk+-2.0)
endif
ifeq ($(ARCH), mac)
test.exe perf.exe : LDFLAGS = -stdlib=libc++ -lpthread -ldl \
-framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo
endif
test : test.exe
## Note that perf and test targets both used build_test for object files,
## So you need to be careful to delete/clean when switching between the two.
## Consider fixing this in the future.
perf : perf.exe
## cleantest will clean out all the test and perf build products
cleantest :
rm -rfv build_test
rm -fv test.exe
rm -fv perf.exe
test.exe : $(TEST_OBJECTS)
$(CXX) -o $@ $^ $(LDFLAGS)
perf.exe : $(TEST_OBJECTS)
$(CXX) -o $@ $^ $(LDFLAGS)