]> git.sesse.net Git - vlc/blob - src/Makefile.am
Fix libvlc.la dependencies
[vlc] / src / Makefile.am
1 ###############################################################################
2 # Automake targets and declarations
3 ###############################################################################
4
5 AUTOMAKE_OPTIONS = subdir-objects
6
7 NULL =
8 SUBDIRS =
9
10 EXTRA_DIST = extras/COPYING misc/modules_builtin.h.in
11
12 BUILT_SOURCES = $(DISTCLEANFILES) $(CLEANFILES)
13 DISTCLEANFILES = stamp-api libvlc.sym
14 CLEANFILES = misc/modules_builtin.h
15 MOSTLYCLEANFILES = $(DATA_noinst_libvlc) stamp-builtins
16
17 TOOLBOX = srcdir=$(top_srcdir) builddir=$(top_builddir) $(top_srcdir)/toolbox
18
19 ###############################################################################
20 # Headers
21 ###############################################################################
22
23 pkgincludedir = $(includedir)/vlc
24
25 dist_pkginclude_HEADERS = \
26         ../include/vlc/vlc.h \
27         ../include/vlc/libvlc.h \
28         ../include/vlc/aout.h \
29         ../include/vlc/vout.h \
30         ../include/vlc/sout.h \
31         ../include/vlc/decoder.h \
32         ../include/vlc/input.h \
33         ../include/vlc/intf.h \
34         ../include/vlc/mediacontrol.h \
35         ../include/vlc/mediacontrol_structures.h \
36         $(NULL)
37
38 noinst_HEADERS = $(HEADERS_include)
39 noinst_DATA = $(DATA_noinst_libvlc)
40
41 HEADERS_include = \
42         ../include/aout_internal.h \
43         ../include/audio_output.h \
44         ../include/beos_specific.h \
45         ../include/charset.h \
46         ../include/codecs.h \
47         ../include/configuration.h \
48         ../include/darwin_specific.h \
49         ../include/intf_eject.h \
50         ../include/iso_lang.h \
51         ../include/main.h \
52         ../include/mmx.h \
53         ../include/modules.h \
54         ../include/modules_inner.h \
55         ../include/mtime.h \
56         ../include/network.h \
57         ../include/os_specific.h \
58         ../include/snapshot.h \
59         ../include/stream_output.h \
60         ../include/vlc_streaming.h \
61         ../include/variables.h \
62         ../include/video_output.h \
63         ../include/vlc_access.h \
64         ../include/vlc_arrays.h \
65         ../include/vlc_acl.h \
66         ../include/vlc_bits.h \
67         ../include/vlc_block.h \
68         ../include/vlc_block_helper.h \
69         ../include/vlc_codec.h \
70         ../include/vlc_common.h \
71         ../include/vlc_config.h \
72         ../include/vlc_cpu.h \
73         ../include/vlc_demux.h \
74         ../include/vlc_error.h \
75         ../include/vlc_es.h \
76         ../include/vlc_es_out.h \
77         ../include/vlc_filter.h \
78         ../include/vlc_config_cat.h \
79         ../include/vlc_httpd.h \
80         ../include/vlc_tls.h \
81         ../include/vlc_md5.h \
82         ../include/vlc_devices.h \
83         ../include/vlc_image.h \
84         ../include/vlc_input.h \
85         ../include/vlc_interaction.h \
86         ../include/vlc_interface.h \
87         ../include/vlc_intf_strings.h \
88         ../include/vlc_keys.h \
89         ../include/vlc_messages.h \
90         ../include/vlc_meta.h \
91         ../include/vlc_objects.h \
92         ../include/vlc_osd.h \
93         ../include/vlc_playlist.h \
94         ../include/vlc_spu.h \
95         ../include/vlc_stream.h \
96         ../include/vlc_strings.h \
97         ../include/vlc_symbols.h \
98         ../include/vlc_threads_funcs.h \
99         ../include/vlc_threads.h \
100         ../include/vlc_update.h \
101         ../include/vlc_url.h \
102         ../include/vlc_video.h \
103         ../include/vlc_vlm.h \
104         ../include/vlc_vod.h \
105         ../include/vlc_xml.h \
106         ../include/vout_synchro.h \
107         ../include/win32_specific.h \
108         ../include/libvlc_internal.h \
109         ../include/mediacontrol_internal.h
110         $(NULL)
111
112 misc/modules_builtin.h: Makefile misc/modules_builtin.h.in ../vlc-config
113         $(TOOLBOX) --update-includes
114         touch $@
115
116 misc/modules.c: misc/modules_builtin.h
117
118 ###############################################################################
119 # Building builtin modules
120 ###############################################################################
121 #
122 # As long as we use builtins with a shared libvlc, we must build them before
123 # we build libvlc. Maybe one day, libvlc will handle multiple modules per
124 # shared object, which will make builtins fairly redumdant. Until then, we
125 # need this workaround.
126
127
128 if BUILD_SHARED
129 stamp-builtins: Makefile ../vlc-config ../config.status
130         @for c in `$(VLC_CONFIG) --libs builtin`; do \
131                 case $$c in \
132                         ../modules/*.a) echo $$c ;; \
133                 esac ; \
134         done | \
135         sed -e 's,^\(.*\)/\([^/]*\)\.a$$,cd \1 \&\& $(MAKE) \2,g' | \
136         while read cmd; do echo $$cmd.a; eval "($$cmd.a)" || exit $$? ; done
137         touch $@
138 endif
139
140 ###############################################################################
141 # Building libvlc
142 ###############################################################################
143
144 libvlc_a_SOURCES = $(SOURCES_libvlc) $(SOURCES_libvlc_control)
145 nodist_libvlc_a_SOURCES = misc/version.c
146 libvlc_a_CFLAGS = `$(VLC_CONFIG) --cflags vlc pic` -DUSE_BUILTINS
147 libvlc_a_CXXFLAGS = `$(VLC_CONFIG) --cxxflags vlc pic`
148 libvlc_a_OBJCFLAGS = `$(VLC_CONFIG) --objcflags vlc pic`
149
150 libvlc_la_SOURCES = $(SOURCES_libvlc)
151 libvlc_la_LIBADD = $(INCLUDED_LIBINTL)
152 libvlc_la_CFLAGS = `$(VLC_CONFIG) --cflags vlc`
153 libvlc_la_CXXFLAGS = `$(VLC_CONFIG) --cxxflags vlc`
154 libvlc_la_OBJCFLAGS = `$(VLC_CONFIG) --objcflags vlc`
155 libvlc_la_LDFLAGS = `$(VLC_CONFIG) --libs vlc` \
156         -no-undefined -export-symbols libvlc.sym -version-info 0:0:0
157 libvlc_la_DEPENDENCIES = libvlc.sym
158
159 libvlc_control_la_SOURCES = $(SOURCES_libvlc_control)
160 libvlc_control_la_LIBADD = libvlc.la
161 libvlc_control_la_CFLAGS = `$(VLC_CONFIG) --cflags vlc`
162 libvlc_control_la_LDFLAGS = \
163         -no-undefined -export-symbols-regex '_?(libvlc|mediacontrol)_.*' \
164         -version-info 0:0:0
165
166 if HAVE_BEOS
167 OPT_SOURCES_libvlc_beos = $(SOURCES_libvlc_beos)
168 endif
169 if HAVE_DARWIN
170 OPT_SOURCES_libvlc_darwin = $(SOURCES_libvlc_darwin)
171 endif
172 if HAVE_WIN32
173 OPT_SOURCES_libvlc_win32 = $(SOURCES_libvlc_win32)
174 endif
175 if HAVE_WINCE
176 OPT_SOURCES_libvlc_win32 = $(SOURCES_libvlc_win32)
177 endif
178 if BUILD_DIRENT
179 OPT_SOURCES_libvlc_dirent = $(SOURCES_libvlc_dirent)
180 endif
181 if BUILD_GETOPT
182 OPT_SOURCES_libvlc_getopt = $(SOURCES_libvlc_getopt)
183 endif
184
185 # Build libvlc as a shared library
186 if USE_LIBTOOL
187 lib_LTLIBRARIES = libvlc.la libvlc-control.la
188 else
189 lib_LIBRARIES = libvlc.a
190 endif
191
192 if HAVE_WIN32
193 pic =
194 else
195 pic = pic
196 endif
197
198 if HAVE_WIN32
199 if BUILD_SHARED
200 DATA_noinst_libvlc = libvlc$(LIBEXT) libvlc$(LIBEXT).a
201 endif
202
203 libvlc.dll.a: libvlc$(LIBEXT)
204         $(DLLTOOL) --export-all-symbols -l $@ -D $< $(libvlc_a_OBJECTS)
205
206 libvlc$(LIBEXT): $(OBJECTS_libvlc_so) stamp-builtins
207         @ldfl="`$(VLC_CONFIG) --libs plugin vlc builtin pic` $(INCLUDED_LIBINTL)" ; \
208         case `$(VLC_CONFIG) --linkage vlc builtin` in \
209           c++)  ld="$(CXXLINK)" ;; \
210           objc) ld="$(OBJCLINK)" ;; \
211           c|*)  ld="$(LINK)" ;; \
212         esac ; \
213         echo $$ld $(OBJECTS_libvlc_so) $(LDFLAGS_libvlc_so) $$ldfl; \
214         $$ld $(libvlc_a_OBJECTS) \
215                 $$ldfl
216 # It sucks big time, but we have to do that to link vlc properly
217 # on non-PIC OSes, otherwise ld will favor builtins-less libvlc.a over
218 # libvlc$(LIBEXT)
219         rm -f libvlc.a
220 # Cygwin libtool work-around
221         @if test -f "$@.exe"; then mv -f "$@.exe" "$@"; fi
222 endif
223
224 EXTRA_DIST += \
225         $(SOURCES_libvlc_beos) \
226         $(SOURCES_libvlc_darwin) \
227         $(SOURCES_libvlc_win32) \
228         $(SOURCES_libvlc_dirent) \
229         $(SOURCES_libvlc_getopt) \
230         $(NULL)
231
232 SOURCES_libvlc_beos = \
233         misc/beos_specific.cpp \
234         $(NULL)
235
236 SOURCES_libvlc_darwin = \
237         misc/darwin_specific.m \
238         $(NULL)
239
240 SOURCES_libvlc_win32 = \
241         misc/win32_specific.c \
242         $(NULL)
243
244 SOURCES_libvlc_dirent = \
245         extras/dirent.c \
246         $(NULL)
247
248 SOURCES_libvlc_getopt = \
249         extras/getopt.c \
250         extras/getopt.h \
251         extras/getopt1.c \
252         $(NULL)
253
254 SOURCES_libvlc_common = \
255         libvlc.c \
256         libvlc-common.c \
257         libvlc.h \
258         interface/interface.c \
259         interface/intf_eject.c \
260         interface/interaction.c \
261         playlist/playlist_internal.h \
262         playlist/thread.c \
263         playlist/control.c \
264         playlist/engine.c \
265         playlist/sort.c \
266         playlist/loadsave.c \
267         playlist/tree.c \
268         playlist/item.c \
269         playlist/search.c \
270         playlist/services_discovery.c \
271         input/item.c \
272         input/access.c \
273         input/clock.c \
274         input/control.c \
275         input/decoder.c \
276         input/demux.c \
277         input/es_out.c \
278         input/input.c \
279         input/meta.c \
280         input/input_internal.h \
281         input/stream.c \
282         input/mem_stream.c \
283         input/subtitles.c \
284         input/var.c \
285         video_output/video_output.c \
286         video_output/vout_pictures.c \
287         video_output/vout_pictures.h \
288         video_output/video_text.c \
289         video_output/video_widgets.c \
290         video_output/vout_subpictures.c \
291         video_output/vout_synchro.c \
292         video_output/vout_intf.c \
293         audio_output/common.c \
294         audio_output/dec.c \
295         audio_output/filters.c \
296         audio_output/input.c \
297         audio_output/mixer.c \
298         audio_output/output.c \
299         audio_output/intf.c \
300         stream_output/stream_output.c \
301         stream_output/announce.c \
302         stream_output/profiles.c \
303         stream_output/sap.c \
304         osd/osd.c \
305         osd/osd_parser.c \
306         osd/osd_text.c \
307         osd/osd_widgets.c \
308         network/acl.c \
309         network/getaddrinfo.c \
310         network/io.c \
311         network/error.c \
312         network/tcp.c \
313         network/udp.c \
314         network/httpd.c \
315         network/rootwrap.c \
316         network/tls.c \
317         misc/charset.c \
318         misc/md5.c \
319         misc/mtime.c \
320         misc/block.c \
321         misc/modules.c \
322         misc/threads.c \
323         misc/stats.c \
324         misc/strings.c \
325         misc/unicode.c \
326         misc/cpu.c \
327         misc/configuration.c \
328         misc/configuration_chain.c \
329         misc/image.c \
330         misc/iso_lang.c \
331         misc/iso-639_def.h \
332         misc/messages.c \
333         misc/objects.c \
334         misc/variables.c \
335         misc/error.c \
336         misc/update.c \
337         misc/vlm.c \
338         misc/xml.c \
339         misc/dict.c \
340         misc/devices.c \
341         extras/libc.c \
342         $(NULL)
343
344 SOURCES_libvlc = \
345         $(SOURCES_libvlc_common) \
346         $(OPT_SOURCES_libvlc_beos) \
347         $(OPT_SOURCES_libvlc_darwin) \
348         $(OPT_SOURCES_libvlc_win32) \
349         $(OPT_SOURCES_libvlc_dirent) \
350         $(OPT_SOURCES_libvlc_getopt) \
351         $(NULL)
352
353 SOURCES_libvlc_control = \
354         control/core.c \
355         control/log.c \
356         control/playlist.c \
357         control/vlm.c \
358         control/input.c \
359         control/video.c \
360         control/audio.c \
361         control/mediacontrol_core.c \
362         control/mediacontrol_util.c \
363         control/mediacontrol_audio_video.c
364
365 if !USE_LIBTOOL
366 if !BUILD_SHARED
367 CLEANFILES += misc/version.c
368 endif
369
370 # Install shared libvlc
371 install-exec-local:
372         test -z "$(DATA_noinst_libvlc)" || $(INSTALL_PROGRAM) "$(DATA_noinst_libvlc)" "$(DESTDIR)$(libdir)"
373
374 # the opposite of install-{data,exec}-local
375 uninstall-local:
376         test -z "$(DATA_noinst_libvlc)" || rm -f "$(DESTDIR)$(libdir)/$(DATA_noinst_libvlc)"
377 endif
378
379 misc/version.c: FORCE
380         $(TOOLBOX) --update-version
381
382 ###############################################################################
383 # Stamp rules
384 ###############################################################################
385 stamp-api: Makefile.in $(HEADERS_include) ../vlc-api.pl
386         ( cd $(srcdir) && cat $(HEADERS_include) ) | \
387           top_srcdir="$(top_srcdir)" perl $(top_srcdir)/vlc-api.pl
388         touch stamp-api
389
390 libvlc.sym: $(HEADERS_include)
391         rm -f libvlc.sym
392         (cd $(srcdir) && cat $(HEADERS_include) ) | \
393         sed -ne 's/^.*VLC_EXPORT\s*(\s*\w.*\S\s*,\s*\(\w*\)\s*,\s*(\s*\w.*\S\s*)\s*)[^)]*$$/\1/p' \
394                 > libvlc.sym
395
396 ###############################################################################
397 # Unit/regression test
398 ###############################################################################
399 if USE_LIBTOOL
400 check_PROGRAMS = test_i18n_atof test_url
401 TESTS = $(check_PROGRAMS)
402
403 CFLAGS_tests = `$(VLC_CONFIG) --cflags vlc`
404
405 test_i18n_atof_SOURCES = test/i18n_atof.c
406 test_i18n_atof_LDADD = libvlc.la
407 test_i18n_atof_CFLAGS = $(CFLAGS_tests)
408
409 test_url_SOURCES = test/url.c
410 test_url_LDADD = libvlc.la
411 test_url_CFLAGS = $(CFLAGS_tests)
412 endif
413
414 FORCE: