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