comparison constant-q-cpp/src/ext/kissfft/test/Makefile @ 366:5d0a2ebb4d17

Bring dependent libraries in to repo
author Chris Cannam
date Fri, 24 Jun 2016 14:47:45 +0100
parents
children
comparison
equal deleted inserted replaced
365:112766f4c34b 366:5d0a2ebb4d17
1
2 WARNINGS=-W -Wall -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return \
3 -Wcast-align -Wcast-qual -Wnested-externs -Wshadow -Wbad-function-cast \
4 -Wwrite-strings
5
6 CFLAGS=-O3 -I.. -I../tools $(WARNINGS)
7 CFLAGS+=-ffast-math -fomit-frame-pointer
8 #CFLAGS+=-funroll-loops
9 #CFLAGS+=-march=prescott
10 #CFLAGS+= -mtune=native
11 # TIP: try adding -openmp or -fopenmp to enable OPENMP directives and use of multiple cores
12 #CFLAGS+=-fopenmp
13 CFLAGS+= $(CFLAGADD)
14
15
16 ifeq "$(NFFT)" ""
17 NFFT=1800
18 endif
19 ifeq "$(NUMFFTS)" ""
20 NUMFFTS=10000
21 endif
22
23 ifeq "$(DATATYPE)" ""
24 DATATYPE=float
25 endif
26
27 BENCHKISS=bm_kiss_$(DATATYPE)
28 BENCHFFTW=bm_fftw_$(DATATYPE)
29 SELFTEST=st_$(DATATYPE)
30 TESTREAL=tr_$(DATATYPE)
31 TESTKFC=tkfc_$(DATATYPE)
32 FASTFILTREAL=ffr_$(DATATYPE)
33 SELFTESTSRC=twotonetest.c
34
35
36 TYPEFLAGS=-Dkiss_fft_scalar=$(DATATYPE)
37
38 ifeq "$(DATATYPE)" "int16_t"
39 TYPEFLAGS=-DFIXED_POINT=16
40 endif
41
42 ifeq "$(DATATYPE)" "int32_t"
43 TYPEFLAGS=-DFIXED_POINT=32
44 endif
45
46 ifeq "$(DATATYPE)" "simd"
47 TYPEFLAGS=-DUSE_SIMD=1 -msse
48 endif
49
50
51 ifeq "$(DATATYPE)" "float"
52 # fftw needs to be built with --enable-float to build this lib
53 FFTWLIB=-lfftw3f
54 else
55 FFTWLIB=-lfftw3
56 endif
57
58 FFTWLIBDIR=-L/usr/local/lib/
59
60 SRCFILES=../kiss_fft.c ../tools/kiss_fftnd.c ../tools/kiss_fftr.c pstats.c ../tools/kfc.c ../tools/kiss_fftndr.c
61
62 all: tools $(BENCHKISS) $(SELFTEST) $(BENCHFFTW) $(TESTREAL) $(TESTKFC)
63
64 tools:
65 cd ../tools && make all
66
67
68 $(SELFTEST): $(SELFTESTSRC) $(SRCFILES)
69 $(CC) -o $@ $(CFLAGS) $(TYPEFLAGS) $+ -lm
70
71 $(TESTKFC): $(SRCFILES)
72 $(CC) -o $@ $(CFLAGS) -DKFC_TEST $(TYPEFLAGS) $+ -lm
73
74 $(TESTREAL): test_real.c $(SRCFILES)
75 $(CC) -o $@ $(CFLAGS) $(TYPEFLAGS) $+ -lm
76
77 $(BENCHKISS): benchkiss.c $(SRCFILES)
78 $(CC) -o $@ $(CFLAGS) $(TYPEFLAGS) $+ -lm
79
80 $(BENCHFFTW): benchfftw.c pstats.c
81 @echo "======attempting to build FFTW benchmark"
82 @$(CC) -o $@ $(CFLAGS) -DDATATYPE$(DATATYPE) $+ $(FFTWLIB) $(FFTWLIBDIR) -lm || echo "FFTW not available for comparison"
83
84 test: all
85 @./$(TESTKFC)
86 @echo "======1d & 2-d complex fft self test (type= $(DATATYPE) )"
87 @./$(SELFTEST)
88 @echo "======real FFT (type= $(DATATYPE) )"
89 @./$(TESTREAL)
90 @echo "======timing test (type=$(DATATYPE))"
91 @./$(BENCHKISS) -x $(NUMFFTS) -n $(NFFT)
92 @[ -x ./$(BENCHFFTW) ] && ./$(BENCHFFTW) -x $(NUMFFTS) -n $(NFFT) ||true
93 @echo "======higher dimensions type=$(DATATYPE))"
94 @./testkiss.py
95
96 selftest.c:
97 ./mk_test.py 10 12 14 > selftest.c
98 selftest_short.c:
99 ./mk_test.py -s 10 12 14 > selftest_short.c
100
101
102 CXXFLAGS=-O3 -ffast-math -fomit-frame-pointer -I.. -I../tools -W -Wall
103 testcpp: testcpp.cc ../kissfft.hh
104 $(CXX) -o $@ $(CXXFLAGS) testcpp.cc -lm
105
106
107 clean:
108 rm -f *~ bm_* st_* tr_* kf_* tkfc_* ff_* ffr_* *.pyc *.pyo *.dat testcpp