-
Notifications
You must be signed in to change notification settings - Fork 35
/
Makefile
49 lines (35 loc) · 1.08 KB
/
Makefile
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
TESTDIR := ./tests
PORT_TARGET := $(TESTDIR)/port/test.js
PORT_FFT_TARGET := $(TESTDIR)/port/test-fft.js
REF_TARGET := $(TESTDIR)/ref/ref.out
REF_FFT_TARGET := $(TESTDIR)/ref/fft.out
PORT_SOURCE := src/pitch.js $(TESTDIR)/tools/wavreader.js
REF_SOURCE := $(TESTDIR)/ref/pitch.cc $(TESTDIR)/ref/test.cc
REF_FFT_SOURCE := $(TESTDIR)/ref/test-fft.cc
WAVTESTS := $(patsubst %.wav,%.test,$(wildcard *.wav))
COMPARE := $(TESTDIR)/tools/compare.js
CXX := g++
CXX_FLAGS := -Wall -lm -lsndfile
all: fft.test $(WAVTESTS)
$(REF_TARGET): $(REF_SOURCE)
$(CXX) $(CXX_FLAGS) $^ -o $@
$(REF_FFT_TARGET): $(REF_FFT_SOURCE)
$(CXX) $(CXX_FLAGS) $^ -o $@
$(PORT_TARGET): $(PORT_SOURCE)
touch $@ # Nasty, but saves time
$(PORT_FFT_TARGET): $(PORT_SOURCE)
touch $@
fft.ref.data: $(REF_FFT_TARGET)
$^ $@
fft.port.data: $(PORT_FFT_TARGET)
$^ $@
%.test: %.ref.data %.port.data
$(COMPARE) $^ > $@
%.ref.data: $(REF_TARGET) %.wav
$^ $@
%.port.data: $(PORT_TARGET) %.wav
$^ $@
clean:
rm -rf $(REF_TARGET) $(REF_FFT_TARGET) *.data */*.data */*/*.data *.test */*.test */*/*.test
.PHONY: all clean
.SECONDARY: