]> git.sesse.net Git - movit/blob - Makefile.in
2cd3e77ebf8c1b79de54df474d21edbcb1bf3f53
[movit] / Makefile.in
1 GTEST_DIR ?= /usr/src/gtest
2
3 # This will be upgraded for each release, although not necessarily for every git commit.
4 # See http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
5 # for the rules as of how this is changed. This does not really mean that Movit will
6 # strive towards having a rock-stable ABI, but at least the soversion will increase
7 # whenever it breaks, so that you will not have silent failures, and distribution package
8 # management can run its course.
9 movit_ltversion = 1:0:0
10
11 prefix = @prefix@
12 exec_prefix = @exec_prefix@
13 includedir = @includedir@
14 libdir = @libdir@
15 datarootdir = @datarootdir@
16 datadir = @datadir@
17 top_builddir = @top_builddir@
18 with_demo_app = @with_demo_app@
19 with_coverage = @with_coverage@
20
21 CC=@CC@
22 CXX=@CXX@
23 CXXFLAGS=-Wall @CXXFLAGS@ -I$(GTEST_DIR)/include @Eigen3_CFLAGS@ @GLEW_CFLAGS@ @FFTW3_CFLAGS@
24 LDFLAGS=@GLEW_LIBS@ @SDL_LIBS@ @FFTW3_LIBS@ -lpthread
25 DEMO_LDLIBS=@SDL_image_LIBS@ -lrt -lpthread @libpng_LIBS@ @FFTW3_LIBS@
26 SHELL=@SHELL@
27 LIBTOOL=@LIBTOOL@ --tag=CXX
28 RANLIB=ranlib
29 INSTALL=install
30 MKDIR=mkdir
31
32 ifeq ($(with_coverage),yes)
33 CXXFLAGS += -fprofile-arcs -ftest-coverage --coverage
34 LDFLAGS += -fprofile-arcs -ftest-coverage
35 LDLIBS += -lgcov
36 endif
37
38 DEMO_OBJS=demo.o
39
40 # Inputs.
41 TESTED_INPUTS = flat_input
42 TESTED_INPUTS += ycbcr_input
43
44 INPUTS = $(TESTED_INPUTS) $(UNTESTED_INPUTS)
45
46 # Effects.
47 TESTED_EFFECTS = lift_gamma_gain_effect
48 TESTED_EFFECTS += white_balance_effect
49 TESTED_EFFECTS += gamma_expansion_effect
50 TESTED_EFFECTS += gamma_compression_effect
51 TESTED_EFFECTS += colorspace_conversion_effect
52 TESTED_EFFECTS += alpha_multiplication_effect
53 TESTED_EFFECTS += alpha_division_effect
54 TESTED_EFFECTS += saturation_effect
55 TESTED_EFFECTS += blur_effect
56 TESTED_EFFECTS += diffusion_effect
57 TESTED_EFFECTS += glow_effect
58 TESTED_EFFECTS += unsharp_mask_effect
59 TESTED_EFFECTS += mix_effect
60 TESTED_EFFECTS += overlay_effect
61 TESTED_EFFECTS += padding_effect
62 TESTED_EFFECTS += resample_effect
63 TESTED_EFFECTS += dither_effect
64 TESTED_EFFECTS += deconvolution_sharpen_effect
65 TESTED_EFFECTS += fft_pass_effect
66 TESTED_EFFECTS += vignette_effect
67 TESTED_EFFECTS += slice_effect
68 TESTED_EFFECTS += complex_modulate_effect
69 TESTED_EFFECTS += luma_mix_effect
70 TESTED_EFFECTS += fft_convolution_effect
71
72 UNTESTED_EFFECTS = sandbox_effect
73 UNTESTED_EFFECTS += mirror_effect
74 UNTESTED_EFFECTS += resize_effect
75 UNTESTED_EFFECTS += multiply_effect
76 UNTESTED_EFFECTS += fft_input
77
78 EFFECTS = $(TESTED_EFFECTS) $(UNTESTED_EFFECTS)
79
80 # Unit tests.
81 TESTS=effect_chain_test fp16_test $(TESTED_INPUTS:=_test) $(TESTED_EFFECTS:=_test)
82
83 LIB_OBJS=effect_util.o util.o widgets.o effect.o effect_chain.o init.o resource_pool.o fp16.o $(INPUTS:=.o) $(EFFECTS:=.o)
84
85 # Default target:
86 all: libmovit.la $(TESTS)
87
88 ifeq ($(with_demo_app),yes)
89 all: demo
90 endif
91
92 # Google Test and other test library functions.
93 TEST_OBJS = gtest-all.o gtest_sdl_main.o test_util.o
94
95 gtest-all.o: $(GTEST_DIR)/src/gtest-all.cc
96         $(CXX) -MMD $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c $< -o $@
97 gtest_sdl_main.o: gtest_sdl_main.cpp
98         $(CXX) -MMD $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c $< -o $@
99
100 # Unit tests.
101 $(TESTS): %: %.o $(TEST_OBJS) libmovit.la
102         $(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
103
104 OBJS=$(DEMO_OBJS) $(LIB_OBJS) $(TEST_OBJS) $(TESTS:=.o)
105
106 # A small demo program.
107 demo: libmovit.la $(DEMO_OBJS)
108         $(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -o demo $(DEMO_OBJS) libmovit.la $(LDLIBS) $(DEMO_LDLIBS)
109
110 # The library itself.
111 libmovit.la: $(LIB_OBJS:.o=.lo)
112         $(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -version-info $(movit_ltversion) -o $@ $^ $(LDLIBS)
113
114 %.lo: %.cpp
115         $(LIBTOOL) --mode=compile $(CXX) -MMD -MP $(CPPFLAGS) $(CXXFLAGS) -o $@ -c $<
116         [ ! -r $(@:.lo=.d) ] || sed 's/\.o:/\.lo:/' < $(@:.lo=.d) > $(@:.lo=.ld)
117         [ ! -r .libs/$(@:.lo=.d) ] || sed 's/\.o:/\.lo:/' < .libs/$(@:.lo=.d) > .libs/$(@:.lo=.ld)
118 %.o: %.cpp
119         $(CXX) -MMD -MP $(CPPFLAGS) $(CXXFLAGS) -o $@ -c $<
120
121 DEPS=$(OBJS:.o=.d) $(OBJS:.o=.ld)
122 -include $(DEPS)
123
124 clean:
125         $(LIBTOOL) --mode=clean $(RM) demo $(TESTS) libmovit.la $(OBJS) $(OBJS:.o=.lo)
126         $(RM) $(OBJS:.o=.gcno) $(OBJS:.o=.gcda) $(DEPS) step*.dot chain*.frag
127         $(RM) -r movit.info coverage/ .libs/
128
129 distclean: clean
130         $(RM) Makefile movit.pc config.status config.log
131
132 check: $(TESTS)
133         FAILED_TESTS=""; \
134         for TEST in $(TESTS); do \
135                 ./$$TEST || FAILED_TESTS="$$TEST $$FAILED_TESTS"; \
136         done; \
137         if [ "$$FAILED_TESTS" ]; then \
138                 echo Failed tests: $$FAILED_TESTS; \
139                 exit 1; \
140         fi
141
142 ifeq ($(with_coverage),yes)
143 coverage: check
144         lcov -d . -c -o movit.info
145         lcov --remove movit.info '*_test.cpp' 'test_util.*' 'sandbox_effect.*' widgets.cpp -o movit.info
146         genhtml -o coverage movit.info
147 else
148 coverage:
149         @echo You need to compile with --enable-coverage to use this target.
150         @exit 1
151 endif
152
153 HDRS = effect_chain.h effect_util.h effect.h input.h image_format.h init.h util.h defs.h resource_pool.h fp16.h
154 HDRS += $(INPUTS:=.h)
155 HDRS += $(EFFECTS:=.h)
156
157 SHADERS = vs.vert header.frag footer.frag
158 SHADERS += $(INPUTS:=.frag)
159 SHADERS += $(EFFECTS:=.frag)
160 SHADERS += highlight_cutoff_effect.frag
161 SHADERS += overlay_matte_effect.frag
162 SHADERS += texture1d.frag
163
164 # These purposefully do not exist.
165 MISSING_SHADERS = diffusion_effect.frag glow_effect.frag unsharp_mask_effect.frag resize_effect.frag
166 MISSING_SHADERS += fft_convolution_effect.frag fft_input.frag
167 SHADERS := $(filter-out $(MISSING_SHADERS),$(SHADERS))
168
169 install: libmovit.la
170         $(LIBTOOL) --mode=install $(INSTALL) -m 0644 libmovit.la $(libdir)/
171         $(MKDIR) -p $(includedir)/movit/
172         $(INSTALL) -m 0644 $(HDRS) $(includedir)/movit/
173         $(MKDIR) -p $(datadir)/movit/
174         $(INSTALL) -m 0644 $(SHADERS) $(datadir)/movit/
175         $(MKDIR) -p $(libdir)/pkgconfig/
176         $(INSTALL) -m 644 movit.pc $(libdir)/pkgconfig/
177
178 .PHONY: coverage clean distclean check all install