1 GTEST_DIR ?= /usr/src/gtest
3 EIGEN_CXXFLAGS := $(shell pkg-config --cflags eigen3)
4 ifeq ($(EIGEN_CXXFLAGS),)
5 $(error Empty EIGEN_CXXFLAGS. You probably need to install Eigen3)
8 GLEW_CXXFLAGS := $(shell pkg-config --cflags glew)
9 ifeq ($(GLEW_CXXFLAGS),)
10 $(error Empty GLEW_CXXFLAGS. You probably need to install GLEW)
13 GLEW_LIBS := $(shell pkg-config --libs glew)
15 $(error Empty GLEW_LIBS. You probably need to install GLEW)
18 SDL_CXXFLAGS := $(shell sdl-config --cflags)
19 ifeq ($(SDL_CXXFLAGS),)
20 $(error Empty SDL_CXXFLAGS. You probably need to install SDL)
23 SDL_LIBS := $(shell sdl-config --libs)
25 $(error Empty SDL_LIBS. You probably need to install SDL)
30 CXXFLAGS=-Wall -g -I$(GTEST_DIR)/include $(EIGEN_CXXFLAGS) $(GLEW_CXXFLAGS)
31 LDFLAGS=-lSDL -lSDL_image -lGL -lrt -lpthread -lpng $(GLEW_LIBS) $(SDL_LIBS)
35 CXXFLAGS += -fprofile-arcs -ftest-coverage
36 LDFLAGS += -fprofile-arcs -ftest-coverage
42 TESTS=effect_chain_test
43 TESTS += mix_effect_test
44 TESTS += overlay_effect_test
45 TESTS += gamma_expansion_effect_test
46 TESTS += gamma_compression_effect_test
47 TESTS += colorspace_conversion_effect_test
48 TESTS += alpha_multiplication_effect_test
49 TESTS += alpha_division_effect_test
50 TESTS += saturation_effect_test
51 TESTS += deconvolution_sharpen_effect_test
52 TESTS += blur_effect_test
53 TESTS += unsharp_mask_effect_test
54 TESTS += glow_effect_test
55 TESTS += diffusion_effect_test
56 TESTS += white_balance_effect_test
57 TESTS += lift_gamma_gain_effect_test
58 TESTS += resample_effect_test
59 TESTS += padding_effect_test
60 TESTS += dither_effect_test
61 TESTS += flat_input_test
62 TESTS += ycbcr_input_test
65 LIB_OBJS=effect_util.o util.o widgets.o effect.o effect_chain.o init.o
68 LIB_OBJS += flat_input.o
69 LIB_OBJS += ycbcr_input.o
72 LIB_OBJS += lift_gamma_gain_effect.o
73 LIB_OBJS += white_balance_effect.o
74 LIB_OBJS += gamma_expansion_effect.o
75 LIB_OBJS += gamma_compression_effect.o
76 LIB_OBJS += colorspace_conversion_effect.o
77 LIB_OBJS += alpha_multiplication_effect.o
78 LIB_OBJS += alpha_division_effect.o
79 LIB_OBJS += saturation_effect.o
80 LIB_OBJS += vignette_effect.o
81 LIB_OBJS += mirror_effect.o
82 LIB_OBJS += blur_effect.o
83 LIB_OBJS += diffusion_effect.o
84 LIB_OBJS += glow_effect.o
85 LIB_OBJS += unsharp_mask_effect.o
86 LIB_OBJS += mix_effect.o
87 LIB_OBJS += overlay_effect.o
88 LIB_OBJS += resize_effect.o
89 LIB_OBJS += padding_effect.o
90 LIB_OBJS += resample_effect.o
91 LIB_OBJS += dither_effect.o
92 LIB_OBJS += deconvolution_sharpen_effect.o
93 LIB_OBJS += sandbox_effect.o
98 # Google Test and other test library functions.
99 TEST_OBJS = gtest-all.o gtest_sdl_main.o test_util.o
101 gtest-all.o: $(GTEST_DIR)/src/gtest-all.cc
102 $(CXX) -MMD $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c $< -o $@
103 gtest_sdl_main.o: gtest_sdl_main.cpp
104 $(CXX) -MMD $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c $< -o $@
107 $(TESTS): %: %.o $(TEST_OBJS) libmovit.a
108 $(CXX) -o $@ $^ $(LDFLAGS)
110 OBJS=$(DEMO_OBJS) $(LIB_OBJS) $(TEST_OBJS) $(TESTS:=.o)
112 # A small demo program.
113 demo: libmovit.a $(DEMO_OBJS)
114 $(CXX) -o demo $(DEMO_OBJS) libmovit.a $(LDFLAGS)
116 # The library itself.
117 libmovit.a: $(LIB_OBJS)
118 $(AR) rc $@ $(LIB_OBJS)
122 $(CXX) -MMD -MP $(CPPFLAGS) $(CXXFLAGS) -o $@ -c $<
128 $(RM) demo $(TESTS) libmovit.a $(OBJS) $(OBJS:.o=.gcno) $(OBJS:.o=.gcda) $(DEPS) step-*.dot
129 $(RM) -r movit.info coverage/
133 for TEST in $(TESTS); do \
134 ./$$TEST || FAILED_TESTS="$$TEST $$FAILED_TESTS"; \
136 if [ "$$FAILED_TESTS" ]; then \
137 echo Failed tests: $$FAILED_TESTS; \
141 # You need to build with COVERAGE=1 to use this target.
143 lcov -d . -c -o movit.info
144 lcov --remove movit.info '*_test.cpp' '*/test_util.{cpp,h}' -o movit.info
145 genhtml -o coverage movit.info
147 .PHONY: coverage clean check all