]> git.sesse.net Git - movit/blobdiff - Makefile
Simplify the Makefile for building unit tests.
[movit] / Makefile
index 1797de0086cb2c05b6a8fa88be6d452f44199436..8ad8c2d2df1c4efb7d59622c8178fa72642b4ee4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,13 @@
 GTEST_DIR = /usr/src/gtest
 
+EIGEN_CXXFLAGS := $(shell pkg-config --cflags eigen3)
+ifeq ($(EIGEN_CXXFLAGS),)
+$(error Empty EIGEN_CXXFLAGS. You probably need to install Eigen3)
+endif
+
 CC=gcc
 CXX=g++
-CXXFLAGS=-Wall -g -I$(GTEST_DIR)/include $(shell pkg-config --cflags eigen3 )
+CXXFLAGS=-Wall -g -I$(GTEST_DIR)/include $(EIGEN_CXXFLAGS)
 LDFLAGS=-lSDL -lSDL_image -lGL -lrt -lpthread
 RANLIB=ranlib
 
@@ -12,10 +17,27 @@ LDFLAGS += -fprofile-arcs -ftest-coverage
 endif
 
 DEMO_OBJS=demo.o
-TESTS=effect_chain_test mix_effect_test gamma_expansion_effect_test gamma_compression_effect_test saturation_effect_test deconvolution_sharpen_effect_test
+
+# Unit tests.
+TESTS=effect_chain_test
+TESTS += mix_effect_test
+TESTS += gamma_expansion_effect_test
+TESTS += gamma_compression_effect_test
+TESTS += colorspace_conversion_effect_test
+TESTS += saturation_effect_test
+TESTS += deconvolution_sharpen_effect_test
+TESTS += blur_effect_test
+TESTS += unsharp_mask_effect_test
+TESTS += diffusion_effect_test
+TESTS += white_balance_effect_test
+TESTS += lift_gamma_gain_effect_test
+TESTS += resample_effect_test
+TESTS += dither_effect_test
+TESTS += flat_input_test
+TESTS += ycbcr_input_test
 
 # Core.
-LIB_OBJS=util.o widgets.o effect.o effect_chain.o
+LIB_OBJS=util.o widgets.o effect.o effect_chain.o init.o
 
 # Inputs.
 LIB_OBJS += flat_input.o
@@ -36,6 +58,8 @@ LIB_OBJS += glow_effect.o
 LIB_OBJS += unsharp_mask_effect.o
 LIB_OBJS += mix_effect.o
 LIB_OBJS += resize_effect.o
+LIB_OBJS += resample_effect.o
+LIB_OBJS += dither_effect.o
 LIB_OBJS += deconvolution_sharpen_effect.o
 LIB_OBJS += sandbox_effect.o
 
@@ -51,17 +75,7 @@ gtest_sdl_main.o: gtest_sdl_main.cpp
        $(CXX) -MMD $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c $< -o $@
 
 # Unit tests.
-effect_chain_test: effect_chain_test.o $(TEST_OBJS) libmovit.a
-       $(CXX) -o $@ $^ $(LDFLAGS)
-mix_effect_test: mix_effect_test.o $(TEST_OBJS) libmovit.a
-       $(CXX) -o $@ $^ $(LDFLAGS)
-gamma_expansion_effect_test: gamma_expansion_effect_test.o $(TEST_OBJS) libmovit.a
-       $(CXX) -o $@ $^ $(LDFLAGS)
-gamma_compression_effect_test: gamma_compression_effect_test.o $(TEST_OBJS) libmovit.a
-       $(CXX) -o $@ $^ $(LDFLAGS)
-saturation_effect_test: saturation_effect_test.o $(TEST_OBJS) libmovit.a
-       $(CXX) -o $@ $^ $(LDFLAGS)
-deconvolution_sharpen_effect_test: deconvolution_sharpen_effect_test.o $(TEST_OBJS) libmovit.a
+$(TESTS): %: %.o $(TEST_OBJS) libmovit.a
        $(CXX) -o $@ $^ $(LDFLAGS)
 
 OBJS=$(DEMO_OBJS) $(LIB_OBJS) $(TEST_OBJS) $(TESTS:=.o)
@@ -83,6 +97,7 @@ DEPS=$(OBJS:.o=.d)
 
 clean:
        $(RM) demo $(TESTS) libmovit.a $(OBJS) $(OBJS:.o=.gcno) $(OBJS:.o=.gcda) $(DEPS) step-*.dot
+       $(RM) -r movit.info coverage/
 
 check: $(TESTS)
        FAIL=0; \
@@ -91,4 +106,10 @@ check: $(TESTS)
        done; \
        exit $$FAIL
 
-.PHONY: clean check all
+# You need to build with COVERAGE=1 to use this target.
+coverage: check
+       lcov -d . -c -o movit.info
+       lcov --remove movit.info '*_test.cpp' '*/test_util.{cpp,h}' -o movit.info
+       genhtml -o coverage movit.info
+
+.PHONY: coverage clean check all