1 GTEST_DIR ?= /usr/src/gtest
4 exec_prefix = @exec_prefix@
5 includedir = @includedir@
7 datarootdir = @datarootdir@
9 with_demo_app = @with_demo_app@
13 CXXFLAGS=-Wall @CXXFLAGS@ -I$(GTEST_DIR)/include @Eigen3_CFLAGS@ @GLEW_CFLAGS@
14 LDFLAGS=@GLEW_LIBS@ @SDL_LIBS@ -lpthread
15 DEMO_LDFLAGS=@SDL_image_LIBS@ -lrt -lpthread @libpng_LIBS@
21 CXXFLAGS += -fprofile-arcs -ftest-coverage
22 LDFLAGS += -fprofile-arcs -ftest-coverage
28 TESTED_INPUTS = flat_input
29 TESTED_INPUTS += ycbcr_input
31 INPUTS = $(TESTED_INPUTS) $(UNTESTED_INPUTS)
34 TESTED_EFFECTS = lift_gamma_gain_effect
35 TESTED_EFFECTS += white_balance_effect
36 TESTED_EFFECTS += gamma_expansion_effect
37 TESTED_EFFECTS += gamma_compression_effect
38 TESTED_EFFECTS += colorspace_conversion_effect
39 TESTED_EFFECTS += alpha_multiplication_effect
40 TESTED_EFFECTS += alpha_division_effect
41 TESTED_EFFECTS += saturation_effect
42 TESTED_EFFECTS += blur_effect
43 TESTED_EFFECTS += diffusion_effect
44 TESTED_EFFECTS += glow_effect
45 TESTED_EFFECTS += unsharp_mask_effect
46 TESTED_EFFECTS += mix_effect
47 TESTED_EFFECTS += overlay_effect
48 TESTED_EFFECTS += padding_effect
49 TESTED_EFFECTS += resample_effect
50 TESTED_EFFECTS += dither_effect
51 TESTED_EFFECTS += deconvolution_sharpen_effect
53 UNTESTED_EFFECTS = sandbox_effect
54 UNTESTED_EFFECTS += mirror_effect
55 UNTESTED_EFFECTS += resize_effect
56 UNTESTED_EFFECTS += vignette_effect
57 UNTESTED_EFFECTS += multiply_effect
59 EFFECTS = $(TESTED_EFFECTS) $(UNTESTED_EFFECTS)
62 TESTS=effect_chain_test $(TESTED_INPUTS:=_test) $(TESTED_EFFECTS:=_test)
64 LIB_OBJS=effect_util.o util.o widgets.o effect.o effect_chain.o init.o resource_pool.o $(INPUTS:=.o) $(EFFECTS:=.o)
67 all: libmovit.a $(TESTS)
69 ifeq ($(with_demo_app),yes)
73 # Google Test and other test library functions.
74 TEST_OBJS = gtest-all.o gtest_sdl_main.o test_util.o
76 gtest-all.o: $(GTEST_DIR)/src/gtest-all.cc
77 $(CXX) -MMD $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c $< -o $@
78 gtest_sdl_main.o: gtest_sdl_main.cpp
79 $(CXX) -MMD $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c $< -o $@
82 $(TESTS): %: %.o $(TEST_OBJS) libmovit.a
83 $(CXX) -o $@ $^ $(LDFLAGS)
85 OBJS=$(DEMO_OBJS) $(LIB_OBJS) $(TEST_OBJS) $(TESTS:=.o)
87 # A small demo program.
88 demo: libmovit.a $(DEMO_OBJS)
89 $(CXX) -o demo $(DEMO_OBJS) libmovit.a $(LDFLAGS) $(DEMO_LDFLAGS)
92 libmovit.a: $(LIB_OBJS)
93 $(AR) rc $@ $(LIB_OBJS)
97 $(CXX) -MMD -MP $(CPPFLAGS) $(CXXFLAGS) -o $@ -c $<
103 $(RM) demo $(TESTS) libmovit.a $(OBJS) $(OBJS:.o=.gcno) $(OBJS:.o=.gcda) $(DEPS) step*.dot chain*.frag
104 $(RM) -r movit.info coverage/
107 $(RM) Makefile movit.pc config.status config.log
111 for TEST in $(TESTS); do \
112 ./$$TEST || FAILED_TESTS="$$TEST $$FAILED_TESTS"; \
114 if [ "$$FAILED_TESTS" ]; then \
115 echo Failed tests: $$FAILED_TESTS; \
119 # You need to build with COVERAGE=1 to use this target.
121 lcov -d . -c -o movit.info
122 lcov --remove movit.info '*_test.cpp' '*/test_util.{cpp,h}' -o movit.info
123 genhtml -o coverage movit.info
125 HDRS = effect_chain.h effect_util.h effect.h input.h image_format.h init.h util.h defs.h resource_pool.h
126 HDRS += $(INPUTS:=.h)
127 HDRS += $(EFFECTS:=.h)
129 SHADERS = vs.vert header.frag footer.frag
130 SHADERS += $(INPUTS:=.frag)
131 SHADERS += $(EFFECTS:=.frag)
132 SHADERS += highlight_cutoff_effect.frag
133 SHADERS += overlay_matte_effect.frag
135 # These purposefully do not exist.
136 MISSING_SHADERS = diffusion_effect.frag glow_effect.frag unsharp_mask_effect.frag resize_effect.frag
137 SHADERS := $(filter-out $(MISSING_SHADERS),$(SHADERS))
140 $(INSTALL) -m 0644 libmovit.a $(libdir)/
141 $(MKDIR) -p $(includedir)/movit/
142 $(INSTALL) -m 0644 $(HDRS) $(includedir)/movit/
143 $(MKDIR) -p $(datadir)/movit/
144 $(INSTALL) -m 0644 $(SHADERS) $(datadir)/movit/
145 $(MKDIR) -p $(libdir)/pkgconfig/
146 $(INSTALL) -m 644 movit.pc $(libdir)/pkgconfig/
148 .PHONY: coverage clean distclean check all install