]> rtime.felk.cvut.cz Git - hercules2020/kcf.git/blob - Makefile
8ce0c8154de96fcf1742521a2eb291ee48a3111d
[hercules2020/kcf.git] / Makefile
1 # Makefile to build all the available variants
2
3 BUILDS = opencvfft-st opencvfft-async opencvfft-openmp fftw fftw-async fftw-openmp fftw-big fftw-big-openmp cufftw cufftw-big cufftw-big-openmp cufft cufft-openmp cufft-big cufft-big-openmp
4 TESTSEQ = bag ball1 car1
5
6 all: $(foreach build,$(BUILDS),build-$(build)/kcf_vot)
7
8 CMAKE_OPTS += -G Ninja
9 #CMAKE_OPTS += -DOpenCV_DIR=~/opt/opencv-2.4/share/OpenCV
10
11 CMAKE_OTPS_opencvfft-st      = -DFFT=OpenCV
12 CMAKE_OTPS_opencvfft-async   = -DFFT=OpenCV -DASYNC=ON
13 CMAKE_OTPS_opencvfft-openmp  = -DFFT=OpenCV -DOPENMP=ON
14 CMAKE_OTPS_fftw              = -DFFT=fftw
15 CMAKE_OTPS_fftw-openmp       = -DFFT=fftw -DOPENMP=ON
16 CMAKE_OTPS_fftw-async        = -DFFT=fftw -DASYNC=ON
17 CMAKE_OTPS_fftw-big          = -DFFT=fftw -DBIG_BATCH=ON
18 CMAKE_OTPS_fftw-big-openmp   = -DFFT=fftw -DBIG_BATCH=ON -DOPENMP=ON
19 CMAKE_OTPS_cufftw            = -DFFT=cuFFTW
20 CMAKE_OTPS_cufftw-big        = -DFFT=cuFFTW -DBIG_BATCH=ON
21 CMAKE_OTPS_cufftw-big-openmp = -DFFT=cuFFTW -DBIG_BATCH=ON -DOPENMP=ON
22 CMAKE_OTPS_cufft             = -DFFT=cuFFT
23 CMAKE_OTPS_cufft-openmp      = -DFFT=cuFFT -DOPENMP=ON
24 CMAKE_OTPS_cufft-big         = -DFFT=cuFFT -DBIG_BATCH=ON
25 CMAKE_OTPS_cufft-big-openmp  = -DFFT=cuFFT -DBIG_BATCH=ON -DOPENMP=ON
26
27 .SECONDARY: $(BUILDS:%=build-%/build.ninja)
28
29 build-%/build.ninja:
30         @echo '############################################################'
31         mkdir -p $(@D)
32         cd $(@D) && cmake $(CMAKE_OPTS) $(CMAKE_OTPS_$*) ..
33
34 .PHONY: FORCE
35 build-%/kcf_vot: build-%/build.ninja FORCE
36         @echo '############################################################'
37         cmake --build $(@D)
38
39 $(BUILDS): %: build-%/kcf_vot
40
41 clean:
42         rm -rf $(BUILDS:%=build-%)
43
44 ##########################
45 ### Tests
46 ##########################
47
48 print-test-results = grep ^Average $(1)|sed -E -e 's|build-(.*)/kcf_vot-(.*).log:|\2;\1;|'|sort|column -t -s';'
49
50 test: $(BUILDS:%=test-%)
51         @echo "Summary test results:
52         @$(call print-test-results,$(foreach build,$(BUILDS),$(foreach seq,$(TESTSEQ),build-$(build)/kcf_vot-$(seq).log)))
53
54 $(BUILDS:%=test-%): test-%:
55         @$(call print-test-results,$(foreach seq,$(TESTSEQ),build-$*/kcf_vot-$(seq).log))
56
57 # Usage: testcase <build> <seq>
58 define testcase
59 test-$(1): test-$(1)-$(2)
60 test-$(1)-$(2): build-$(1)/kcf_vot
61         $$< vot2016/$(2) | tee $$(<)-$(2).log
62 endef
63
64 $(foreach build,$(BUILDS),$(foreach seq,$(TESTSEQ),$(eval $(call testcase,$(build),$(seq)))))
65
66 vot2016: vot2016.zip
67         unzip -d $@ -q $^ || :
68         for i in $$(ls -d vot2016/*/); do ( echo Creating $${i}images.txt; cd $$i; ls *.jpg > images.txt ); done
69
70 vot2016.zip:
71         wget http://data.votchallenge.net/vot2016/vot2016.zip