]> rtime.felk.cvut.cz Git - hercules2020/kcf.git/blobdiff - Makefile
Remove debug printf
[hercules2020/kcf.git] / Makefile
index 9ac01e9b0407a724b91fdf5d57e496a78c82b931..322196b0879e3f184e257e8fe8885fe4f1f4d903 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,23 +1,24 @@
 # Makefile to build all the available variants
 
 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
-TESTSEQ = bag ball1 car1 book
-TESTFLAGS = default fit128
+TESTSEQ = bmx ball1 crossing racing book
+TESTFLAGS = default fit
 
 all: $(BUILDS)
 
+print_%:
+       @$(foreach v,$($*),echo $(v);)
+
 ninja: build.ninja
        ninja
 
 $(BUILDS): build.ninja
        ninja build-$@/build.ninja
-       ninja -C build-$@
+       ninja -C $(CURDIR)/build-$@
 
 clean: build.ninja
        ninja $@
 
-CMAKE_OPTS += -G Ninja
-
 ## Useful setting - uncomment and modify as needed
 # CMAKE_OPTS += -DOpenCV_DIR=~/opt/opencv-2.4/share/OpenCV
 # CMAKE_OPTS += -DCUDA_VERBOSE_BUILD=ON -DCUDA_NVCC_FLAGS="--verbose;--save-temps"
@@ -46,8 +47,6 @@ CMAKE_OTPS_cufft-big-openmp  = -DFFT=cuFFT  $(if $(CUDA_ARCH_LIST),-DCUDA_ARCH_L
 ### Tests
 ##########################
 
-print-test-results = grep ^Average $(1)|sed -E -e "s|build-(.*)/kcf_vot-(.*).log:|\2;\1;|"|sort|column -t -s";"
-
 test $(BUILDS:%=test-%) $(SEQ:%=test-%): build.ninja
        ninja $@
 
@@ -58,7 +57,7 @@ vot2016 $(TESTSEQ:%=vot2016/%): vot2016.zip
 .INTERMEDIATE: vot2016.zip
 .SECONDARY:    vot2016.zip
 vot2016.zip:
-       wget http://data.votchallenge.net/vot2016/vot2016.zip
+       wget --progress=dot:giga -O $@ http://data.votchallenge.net/vot2016/vot2016.zip
 
 ###################
 # Ninja generator #
@@ -69,67 +68,87 @@ vot2016.zip:
 # compiles all variants in the same ways as this makefile, but faster.
 # The down side is that the build needs about 10 GB of memory.
 
-define nl
 
+# Define echo depending on whether make supports the $(file) function.
+$(file >.test.file)
+ifneq ($(wildcard .test.file),)
+  echo = $(file $(1),$(2))
+else
+  define nl
 
-endef
 
-define echo
-echo $(1) '$(subst $(nl),\n,$(subst \,\\,$(2)))';
-endef
+  endef
+  echo = echo $(1) '$(subst $(nl),\n,$(subst \,\\,$(2)))';
+endif
 
 # Ninja generator - to have faster parallel builds and tests
-.PHONY: build.ninja build.ninja.new
+.PHONY: build.ninja
 
-build.ninja: build.ninja.new
-       @cmp -s $@ $< || mv -v $< $@
-
-build.ninja.new:
+build.ninja:: $(MAKEFILE_LIST)
+       @echo "Generating $@"
        @$(call echo,>$@,$(ninja-rule))
        @$(foreach build,$(BUILDS),\
                $(call echo,>>$@,$(call ninja-build,$(build),$(CMAKE_OTPS_$(build)))))
        @$(foreach build,$(BUILDS),$(foreach seq,$(TESTSEQ),$(foreach f,$(TESTFLAGS),\
                $(call echo,>>$@,$(call ninja-testcase,$(build),$(seq),$(f)))$(nl))))
-       @$(call echo,>>$@,build test: PRINT_RESULTS $(foreach build,$(BUILDS),$(foreach seq,$(TESTSEQ),$(foreach f,$(TESTFLAGS),$(call ninja-test,$(build),$(seq),$(f))))))
-       @$(foreach build,$(BUILDS),$(call echo,>>$@,build test-$(build): PRINT_RESULTS $(foreach seq,$(TESTSEQ),$(foreach f,$(TESTFLAGS),$(call ninja-test,$(build),$(seq),$(f))))))
-       @$(foreach seq,$(TESTSEQ),$(call echo,>>$@,build test-$(seq): PRINT_RESULTS $(foreach build,$(BUILDS),$(foreach f,$(TESTFLAGS),$(call ninja-test,$(build),$(seq),$(f))))))
+       @$(call echo,>>$@,build test: PRINT_RESULTS $(foreach build,$(BUILDS),$(foreach seq,$(TESTSEQ),$(foreach f,$(TESTFLAGS),$(call ninja-test,$(build),$(seq),$(f))))) | print-test-results)
+       @$(foreach build,$(BUILDS),$(call echo,>>$@,build test-$(build): PRINT_RESULTS $(foreach seq,$(TESTSEQ),$(foreach f,$(TESTFLAGS),$(call ninja-test,$(build),$(seq),$(f)))) | print-test-results))
+       @$(foreach seq,$(TESTSEQ),$(call echo,>>$@,build test-$(seq): PRINT_RESULTS $(foreach build,$(BUILDS),$(foreach f,$(TESTFLAGS),$(call ninja-test,$(build),$(seq),$(f)))) | print-test-results))
+       @$(call echo,>>$@,build plot: PLOT_RESULTS $(foreach build,$(BUILDS),$(foreach seq,$(TESTSEQ),$(foreach f,$(TESTFLAGS),$(call ninja-test,$(build),$(seq),$(f))))) | graphGen.sh)
+       @$(foreach build,$(BUILDS),$(call echo,>>$@,build plot-$(build): PLOT_RESULTS $(foreach seq,$(TESTSEQ),$(foreach f,$(TESTFLAGS),$(call ninja-test,$(build),$(seq),$(f)))) | graphGen.sh))
+       @$(foreach seq,$(TESTSEQ),$(call echo,>>$@,build plot-$(seq): PLOT_RESULTS $(foreach build,$(BUILDS),$(foreach f,$(TESTFLAGS),$(call ninja-test,$(build),$(seq),$(f)))) | graphGen.sh))
        @$(foreach seq,$(TESTSEQ),$(call echo,>>$@,build vot2016/$(seq): MAKE))
 
+ninja-test = build-$(1)/kcf_vot-$(2)-$(3).log
 
 define ninja-rule
+rule REGENERATE
+  command = MAKEFLAGS='$(MAKEFLAGS)' $(MAKE) $$out
+  description = Regenerating $$out
+  generator = 1
 rule CMAKE
-  command = cd $$$$(dirname $$out) && cmake $(CMAKE_OPTS) $$opts ..
+  command = cd $$subdir && cmake -G Ninja $(CMAKE_OPTS) $$opts ..
 rule NINJA
   # Absolute path in -C allows Emacs to properly jump to error message locations
-  command = ninja -C `realpath $$$$(dirname $$out)` && touch $$out
-  description = Ninja $$out
+  command = ninja -C $(CURDIR)/$$subdir
+  restat = 1
 rule TEST_SEQ
-  command = build-$$build/kcf_vot $$flags $$seq > $$out
+  # Errors are ignored - they will be reported by PRINT_RESULTS
+  command = build-$$build/kcf_vot $$flags $$seq $(if $(TRAVIS),2>&1) >$$out $(if $(TRAVIS),| grep -v libdc1394); true
 rule PRINT_RESULTS
   description = Print results
-  command = $(call print-test-results,$$in)
+  command = ./wvtool -w120 -v run ./print-test-results $$in
+rule PLOT_RESULTS
+  description = Plot results
+  command = ./graphGen.sh -f -s $$in
 rule MAKE
   command = make $$out
+  pool = make
+pool make
+  depth = 1
 rule CLEAN
 #  command = /usr/bin/ninja -t clean -r NINJA
   description = Cleaning all built files...
   command = rm -rf $(BUILDS:%=build-%)
 build clean: CLEAN
+build build.ninja: REGENERATE $(MAKEFILE_LIST)
 endef
 
+GIT_LS_FILES := $(shell git ls-files)
+
 define ninja-build
 build build-$(1)/build.ninja: CMAKE
   opts = $(2)
-build build-$(1)/kcf_vot: NINJA build-$(1)/build.ninja $(shell git ls-files)
+  subdir = build-$(1)
+build build-$(1)/kcf_vot: NINJA build-$(1)/build.ninja $(GIT_LS_FILES)
+  subdir = build-$(1)
 default build-$(1)/kcf_vot
 endef
 
-ninja-test = build-$(1)/kcf_vot-$(2)-$(3).log
-
 # Usage: ninja-testcase <build> <seq> <flags>
 define ninja-testcase
-build build-$(1)/kcf_vot-$(2)-$(3).log: TEST_SEQ build-$(1)/kcf_vot $(filter-out %/output.txt,$(wildcard vot2016/$(2)/*)) || vot2016/$(2)
+build build-$(1)/kcf_vot-$(2)-$(3).log: TEST_SEQ build-$(1)/kcf_vot $(filter-out %/output.txt,$(wildcard vot2016/$(2)/*)) vot2016/$(2)
   build = $(1)
   seq = vot2016/$(2)
-  flags = $(if $(3:fit128=),,--fit=128)
+  flags = $(if $(3:fit128=),,--fit=128)$(if $(3:fit=),,--fit)
 endef