]> git.sesse.net Git - movit/blob - Makefile.in
Small refactoring in EffectChainTester.
[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 = 2:3:0
10 movit_version = 1.1.3
11
12 prefix = @prefix@
13 exec_prefix = @exec_prefix@
14 includedir = @includedir@
15 libdir = @libdir@
16 datarootdir = @datarootdir@
17 datadir = @datadir@
18 top_builddir = @top_builddir@
19 with_demo_app = @with_demo_app@
20 with_SDL2 = @with_SDL2@
21 with_coverage = @with_coverage@
22
23 CC=@CC@
24 CXX=@CXX@
25 CXXFLAGS=-Wall @CXXFLAGS@ -fvisibility-inlines-hidden -I$(GTEST_DIR)/include @SDL2_CFLAGS@ @SDL_CFLAGS@ @Eigen3_CFLAGS@ @epoxy_CFLAGS@ @FFTW3_CFLAGS@
26 ifeq ($(with_SDL2),yes)
27 CXXFLAGS += -DHAVE_SDL2
28 endif
29 LDFLAGS=@LDFLAGS@
30 LDLIBS=@epoxy_LIBS@ @FFTW3_LIBS@ -lpthread
31 TEST_LDLIBS=@epoxy_LIBS@ @SDL2_LIBS@ @SDL_LIBS@ -lpthread
32 DEMO_LDLIBS=@SDL2_image_LIBS@ @SDL_image_LIBS@ -lrt -lpthread @libpng_LIBS@ @FFTW3_LIBS@
33 SHELL=@SHELL@
34 LIBTOOL=@LIBTOOL@ --tag=CXX
35 RANLIB=ranlib
36 INSTALL=install
37 MKDIR=mkdir
38
39 ifeq ($(with_coverage),yes)
40 CXXFLAGS += -fprofile-arcs -ftest-coverage --coverage
41 LDFLAGS += -fprofile-arcs -ftest-coverage
42 LDLIBS += -lgcov
43 endif
44
45 DEMO_OBJS=demo.o
46
47 # Inputs.
48 TESTED_INPUTS = flat_input
49 TESTED_INPUTS += ycbcr_input
50 TESTED_INPUTS += ycbcr_422interleaved_input
51
52 INPUTS = $(TESTED_INPUTS) $(UNTESTED_INPUTS)
53
54 # Effects.
55 TESTED_EFFECTS = lift_gamma_gain_effect
56 TESTED_EFFECTS += white_balance_effect
57 TESTED_EFFECTS += gamma_expansion_effect
58 TESTED_EFFECTS += gamma_compression_effect
59 TESTED_EFFECTS += colorspace_conversion_effect
60 TESTED_EFFECTS += alpha_multiplication_effect
61 TESTED_EFFECTS += alpha_division_effect
62 TESTED_EFFECTS += saturation_effect
63 TESTED_EFFECTS += blur_effect
64 TESTED_EFFECTS += diffusion_effect
65 TESTED_EFFECTS += glow_effect
66 TESTED_EFFECTS += unsharp_mask_effect
67 TESTED_EFFECTS += mix_effect
68 TESTED_EFFECTS += overlay_effect
69 TESTED_EFFECTS += padding_effect
70 TESTED_EFFECTS += resample_effect
71 TESTED_EFFECTS += dither_effect
72 TESTED_EFFECTS += deconvolution_sharpen_effect
73 TESTED_EFFECTS += fft_pass_effect
74 TESTED_EFFECTS += vignette_effect
75 TESTED_EFFECTS += slice_effect
76 TESTED_EFFECTS += complex_modulate_effect
77 TESTED_EFFECTS += luma_mix_effect
78 TESTED_EFFECTS += fft_convolution_effect
79 TESTED_EFFECTS += ycbcr_conversion_effect
80
81 UNTESTED_EFFECTS = sandbox_effect
82 UNTESTED_EFFECTS += mirror_effect
83 UNTESTED_EFFECTS += resize_effect
84 UNTESTED_EFFECTS += multiply_effect
85 UNTESTED_EFFECTS += fft_input
86
87 EFFECTS = $(TESTED_EFFECTS) $(UNTESTED_EFFECTS)
88
89 # Unit tests.
90 TESTS=effect_chain_test fp16_test $(TESTED_INPUTS:=_test) $(TESTED_EFFECTS:=_test)
91
92 LIB_OBJS=effect_util.o util.o widgets.o effect.o effect_chain.o init.o resource_pool.o fp16.o ycbcr.o $(INPUTS:=.o) $(EFFECTS:=.o)
93
94 # Default target:
95 all: libmovit.la $(TESTS)
96
97 ifeq ($(with_demo_app),yes)
98 all: demo
99 endif
100
101 # Google Test and other test library functions.
102 OWN_TEST_OBJS = gtest_sdl_main.o test_util.o
103 TEST_OBJS = gtest-all.o $(OWN_TEST_OBJS)
104
105 gtest-all.o: $(GTEST_DIR)/src/gtest-all.cc
106         $(CXX) -MMD $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c $< -o $@
107 gtest_sdl_main.o: gtest_sdl_main.cpp
108         $(CXX) -MMD $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c $< -o $@
109
110 # Unit tests.
111 $(TESTS): %: %.o $(TEST_OBJS) libmovit.la
112         $(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -o $@ $^ $(TEST_LDLIBS)
113
114 OWN_OBJS=$(DEMO_OBJS) $(LIB_OBJS) $(OWN_TEST_OBJS) $(TESTS:=.o)
115 OBJS=$(DEMO_OBJS) $(LIB_OBJS) $(TEST_OBJS) $(TESTS:=.o)
116
117 # A small demo program.
118 demo: libmovit.la $(DEMO_OBJS)
119         $(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -o demo $(DEMO_OBJS) libmovit.la $(LDLIBS) $(DEMO_LDLIBS)
120
121 # The library itself.
122 libmovit.la: $(LIB_OBJS:.o=.lo)
123         $(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -rpath $(libdir) -version-info $(movit_ltversion) -o $@ $^ $(LDLIBS)
124
125 %.lo: %.cpp
126         $(LIBTOOL) --mode=compile $(CXX) -MMD -MP $(CPPFLAGS) $(CXXFLAGS) -o $@ -c $<
127         [ ! -r $(@:.lo=.d) ] || sed 's/\.o:/\.lo:/' < $(@:.lo=.d) > $(@:.lo=.ld)
128         [ ! -r .libs/$(@:.lo=.d) ] || sed 's/\.o:/\.lo:/' < .libs/$(@:.lo=.d) > .libs/$(@:.lo=.ld)
129 %.o: %.cpp
130         $(CXX) -MMD -MP $(CPPFLAGS) $(CXXFLAGS) -o $@ -c $<
131
132 DEPS=$(OBJS:.o=.d) $(OBJS:.o=.ld)
133 -include $(DEPS)
134
135 clean:
136         $(LIBTOOL) --mode=clean $(RM) demo $(TESTS) libmovit.la $(OBJS) $(OBJS:.o=.lo)
137         $(RM) $(OBJS:.o=.gcno) $(OBJS:.o=.gcda) $(DEPS) step*.dot chain*.frag
138         $(RM) -r movit.info coverage/ .libs/
139
140 distclean: clean
141         $(RM) Makefile movit.pc config.status config.log
142
143 check: $(TESTS)
144         FAILED_TESTS=""; \
145         for TEST in $(TESTS); do \
146                 ./$$TEST || FAILED_TESTS="$$TEST $$FAILED_TESTS"; \
147         done; \
148         if [ "$$FAILED_TESTS" ]; then \
149                 echo Failed tests: $$FAILED_TESTS; \
150                 exit 1; \
151         fi
152
153 ifeq ($(with_coverage),yes)
154 coverage: check
155         lcov -d . -c -o movit.info
156         lcov --remove movit.info '*_test.cpp' 'test_util.*' 'sandbox_effect.*' widgets.cpp -o movit.info
157         genhtml -o coverage movit.info
158 else
159 coverage:
160         @echo You need to compile with --enable-coverage to use this target.
161         @exit 1
162 endif
163
164 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 ycbcr.h version.h
165 HDRS += $(INPUTS:=.h)
166 HDRS += $(EFFECTS:=.h)
167
168 SHADERS = vs.vert vs.130.vert vs.300es.vert
169 SHADERS += header.frag header.130.frag header.300es.frag
170 SHADERS += footer.frag footer.130.frag footer.300es.frag
171 SHADERS += texture1d.frag texture1d.130.frag texture1d.300es.frag
172 SHADERS += $(INPUTS:=.frag)
173 SHADERS += $(EFFECTS:=.frag)
174 SHADERS += highlight_cutoff_effect.frag
175 SHADERS += overlay_matte_effect.frag
176
177 # These purposefully do not exist.
178 MISSING_SHADERS = diffusion_effect.frag glow_effect.frag unsharp_mask_effect.frag resize_effect.frag
179 MISSING_SHADERS += fft_convolution_effect.frag fft_input.frag
180 SHADERS := $(filter-out $(MISSING_SHADERS),$(SHADERS))
181
182 install: libmovit.la
183         $(MKDIR) -p $(DESTDIR)$(libdir)/
184         $(LIBTOOL) --mode=install $(INSTALL) -m 0644 libmovit.la $(DESTDIR)$(libdir)/
185         $(MKDIR) -p $(DESTDIR)$(includedir)/movit/
186         $(INSTALL) -m 0644 $(HDRS) $(DESTDIR)$(includedir)/movit/
187         $(MKDIR) -p $(DESTDIR)$(datadir)/movit/
188         $(INSTALL) -m 0644 $(SHADERS) $(DESTDIR)$(datadir)/movit/
189         $(MKDIR) -p $(DESTDIR)$(libdir)/pkgconfig/
190         $(INSTALL) -m 644 movit.pc $(DESTDIR)$(libdir)/pkgconfig/
191
192 DISTDIR=movit-$(movit_version)
193 OTHER_DIST_FILES=add.frag autogen.sh blue.frag configure.ac d65.h identity.frag invert_effect.frag Makefile.in mipmap_needing_effect.frag movit.pc.in README NEWS test_util.h widgets.h
194
195 dist:
196         $(MKDIR) $(DISTDIR)
197         cp $(OWN_OBJS:.o=.cpp) $(DISTDIR)/
198         cp $(HDRS) $(DISTDIR)/
199         cp $(SHADERS) $(DISTDIR)/
200         cp $(OTHER_DIST_FILES) $(DISTDIR)/
201         ( cd $(DISTDIR) && aclocal && libtoolize --install --copy && autoconf && $(RM) -r autom4te.cache/ )
202         tar zcvvf ../$(DISTDIR).tar.gz $(DISTDIR)
203         $(RM) -r $(DISTDIR)
204
205 .PHONY: coverage clean distclean check all install dist