]> git.sesse.net Git - vlc/blob - src/Makefile.am
Merge back branch 0.8.6-playlist-vlm to trunk.
[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
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/variables.h \
61         ../include/video_output.h \
62         ../include/vlc_access.h \
63         ../include/vlc_acl.h \
64         ../include/vlc_bits.h \
65         ../include/vlc_block.h \
66         ../include/vlc_block_helper.h \
67         ../include/vlc_codec.h \
68         ../include/vlc_common.h \
69         ../include/vlc_config.h \
70         ../include/vlc_cpu.h \
71         ../include/vlc_demux.h \
72         ../include/vlc_error.h \
73         ../include/vlc_es.h \
74         ../include/vlc_es_out.h \
75         ../include/vlc_filter.h \
76         ../include/vlc_config_cat.h \
77         ../include/vlc_httpd.h \
78         ../include/vlc_tls.h \
79         ../include/vlc_md5.h \
80         ../include/vlc_image.h \
81         ../include/vlc_input.h \
82         ../include/vlc_interaction.h \
83         ../include/vlc_interface.h \
84         ../include/vlc_keys.h \
85         ../include/vlc_messages.h \
86         ../include/vlc_meta.h \
87         ../include/vlc_objects.h \
88         ../include/vlc_osd.h \
89         ../include/vlc_playlist.h \
90         ../include/vlc_spu.h \
91         ../include/vlc_stream.h \
92         ../include/vlc_strings.h \
93         ../include/vlc_symbols.h \
94         ../include/vlc_threads_funcs.h \
95         ../include/vlc_threads.h \
96         ../include/vlc_update.h \
97         ../include/vlc_url.h \
98         ../include/vlc_video.h \
99         ../include/vlc_vlm.h \
100         ../include/vlc_vod.h \
101         ../include/vlc_xml.h \
102         ../include/vout_synchro.h \
103         ../include/win32_specific.h \
104         ../include/libvlc_internal.h \
105         ../include/mediacontrol_internal.h
106         $(NULL)
107
108 misc/modules_builtin.h: Makefile misc/modules_builtin.h.in ../vlc-config
109         $(TOOLBOX) --update-includes
110         touch $@
111
112 misc/modules.c: misc/modules_builtin.h
113
114 ###############################################################################
115 # Building builtin modules
116 ###############################################################################
117 #
118 # As long as we use builtins with a shared libvlc, we must build them before
119 # we build libvlc. Maybe one day, libvlc will handle multiple modules per
120 # shared object, which will make builtins fairly redumdant. Until then, we
121 # need this workaround.
122
123 stamp-builtins: Makefile ../vlc-config ../config.status
124 if USE_LIBTOOL
125         @for c in `$(VLC_CONFIG) --libs builtin`; do \
126                 case $$c in \
127                         ../modules/*.a) echo $$c ;; \
128                 esac ; \
129         done | \
130         sed -e 's/^\(.*\)\/\([^\/]*\)\.a$$/cd \1 \&\& $(MAKE) \2_builtin.la/g' | \
131         while read cmd; do echo $$cmd; eval "($$cmd)" || exit $$? ; done
132 endif
133 if BUILD_SHARED
134         @if test "$(pic)" = "pic"; then ext="_pic.a"; else ext=".a"; fi ; \
135         for c in `$(VLC_CONFIG) --libs builtin`; do \
136                 case $$c in \
137                         ../modules/*.a) echo $$c ;; \
138                 esac ; \
139         done | \
140         sed -e 's/^\(.*\)\/\([^\/]*\)\.a$$/cd \1 \&\& $(MAKE) \2/g' | \
141         while read cmd; do echo $$cmd$$ext; eval "($$cmd$$ext)" || exit $$? ; done
142 endif
143         touch $@
144
145 ###############################################################################
146 # Building libvlc
147 ###############################################################################
148
149 libvlc_a_SOURCES = $(SOURCES_libvlc)
150 libvlc_a_CFLAGS = `$(VLC_CONFIG) --cflags vlc`
151 libvlc_a_CXXFLAGS = `$(VLC_CONFIG) --cxxflags vlc`
152 libvlc_a_OBJCFLAGS = `$(VLC_CONFIG) --objcflags vlc`
153
154 libvlc_pic_a_SOURCES = $(SOURCES_libvlc)
155 libvlc_pic_a_CFLAGS = `$(VLC_CONFIG) --cflags vlc pic`
156 libvlc_pic_a_CXXFLAGS = `$(VLC_CONFIG) --cxxflags vlc pic`
157 libvlc_pic_a_OBJCFLAGS = `$(VLC_CONFIG) --objcflags vlc pic`
158
159 libvlc_la_SOURCES = $(SOURCES_libvlc)
160 libvlc_la_LIBADD = $(INCLUDED_LIBINTL)
161 libvlc_la_CFLAGS = `$(VLC_CONFIG) --cflags vlc`
162 libvlc_la_CXXFLAGS = `$(VLC_CONFIG) --cxxflags vlc`
163 libvlc_la_OBJCFLAGS = `$(VLC_CONFIG) --objcflags vlc`
164 libvlc_la_LDFLAGS = `$(VLC_CONFIG) --libs vlc builtin|sed -e 's/\(modules\/[^ ]*\)\.a /\1_builtin.la /g'` \
165                 -avoid-version -no-undefined
166 libvlc_la_DEPENDENCIES = stamp-builtins
167
168
169 if HAVE_BEOS
170 OPT_SOURCES_libvlc_beos = $(SOURCES_libvlc_beos)
171 endif
172 if HAVE_DARWIN
173 OPT_SOURCES_libvlc_darwin = $(SOURCES_libvlc_darwin)
174 endif
175 if HAVE_WIN32
176 OPT_SOURCES_libvlc_win32 = $(SOURCES_libvlc_win32)
177 endif
178 if HAVE_WINCE
179 OPT_SOURCES_libvlc_win32 = $(SOURCES_libvlc_win32)
180 endif
181 if BUILD_DIRENT
182 OPT_SOURCES_libvlc_dirent = $(SOURCES_libvlc_dirent)
183 endif
184 if BUILD_GETOPT
185 OPT_SOURCES_libvlc_getopt = $(SOURCES_libvlc_getopt)
186 endif
187
188 # Build libvlc as a shared library
189 if USE_LIBTOOL
190 lib_LTLIBRARIES = libvlc.la
191 else
192 lib_LIBRARIES = libvlc.a
193 if BUILD_PIC
194 lib_LIBRARIES += libvlc_pic.a
195 endif
196 endif
197
198 if HAVE_WIN32
199 if BUILD_SHARED
200 DATA_noinst_libvlc = libvlc$(LIBEXT)
201 endif
202
203 libvlc.dll.a: libvlc$(LIBEXT)
204
205 libvlc$(LIBEXT): $(OBJECTS_libvlc_so) stamp-builtins
206         @ldfl="`$(VLC_CONFIG) --libs plugin vlc builtin $(pic)` $(INCLUDED_LIBINTL)" ; \
207         case `$(VLC_CONFIG) --linkage vlc builtin` in \
208           c++)  ld="$(CXXLINK)" ;; \
209           objc) ld="$(OBJCLINK)" ;; \
210           c|*)  ld="$(LINK)" ;; \
211         esac ; \
212         echo $$ld $(OBJECTS_libvlc_so) $(LDFLAGS_libvlc_so) $$ldfl; \
213         $$ld $(libvlc_a_OBJECTS) \
214                 -Wl,--out-implib,$(top_builddir)/src/libvlc.dll.a $$ldfl
215 # It sucks big time, but we have to do that to link vlc properly
216 # on non-PIC OSes, otherwise ld will favor builtins-less libvlc.a over
217 # libvlc$(LIBEXT)
218         rm -f libvlc.a
219 # Cygwin work-around
220         @if test -f "$@.exe"; then mv -f "$@.exe" "$@"; fi
221 endif
222
223 EXTRA_DIST += \
224         $(SOURCES_libvlc_beos) \
225         $(SOURCES_libvlc_darwin) \
226         $(SOURCES_libvlc_win32) \
227         $(SOURCES_libvlc_dirent) \
228         $(SOURCES_libvlc_getopt) \
229         $(NULL)
230
231 SOURCES_libvlc_beos = \
232         misc/beos_specific.cpp \
233         $(NULL)
234
235 SOURCES_libvlc_darwin = \
236         misc/darwin_specific.m \
237         $(NULL)
238
239 SOURCES_libvlc_win32 = \
240         misc/win32_specific.c \
241         $(NULL)
242
243 SOURCES_libvlc_dirent = \
244         extras/dirent.c \
245         $(NULL)
246
247 SOURCES_libvlc_getopt = \
248         extras/getopt.c \
249         extras/getopt.h \
250         extras/getopt1.c \
251         $(NULL)
252
253 SOURCES_libvlc_common = \
254         libvlc.c \
255         libvlc.h \
256         interface/interface.c \
257         interface/intf_eject.c \
258         interface/interaction.c \
259         playlist/thread.c \
260         playlist/control.c \
261         playlist/engine.c \
262         playlist/sort.c \
263         playlist/loadsave.c \
264         playlist/tree.c \
265         playlist/item.c \
266         playlist/search.c \
267         playlist/services_discovery.c \
268         input/item.c \
269         input/access.c \
270         input/clock.c \
271         input/control.c \
272         input/decoder.c \
273         input/demux.c \
274         input/es_out.c \
275         input/input.c \
276         input/input_internal.h \
277         input/stream.c \
278         input/mem_stream.c \
279         input/subtitles.c \
280         input/var.c \
281         video_output/video_output.c \
282         video_output/vout_pictures.c \
283         video_output/vout_pictures.h \
284         video_output/video_text.c \
285         video_output/video_widgets.c \
286         video_output/vout_subpictures.c \
287         video_output/vout_synchro.c \
288         video_output/vout_intf.c \
289         audio_output/common.c \
290         audio_output/dec.c \
291         audio_output/filters.c \
292         audio_output/input.c \
293         audio_output/mixer.c \
294         audio_output/output.c \
295         audio_output/intf.c \
296         stream_output/stream_output.c \
297         stream_output/announce.c \
298         stream_output/sap.c \
299         osd/osd.c \
300         osd/osd_parser.c \
301         osd/osd_text.c \
302         osd/osd_widgets.c \
303         network/acl.c \
304         network/getaddrinfo.c \
305         network/io.c \
306         network/error.c \
307         network/tcp.c \
308         network/udp.c \
309         network/httpd.c \
310         network/rootwrap.c \
311         network/tls.c \
312         misc/charset.c \
313         misc/md5.c \
314         misc/mtime.c \
315         misc/block.c \
316         misc/modules.c \
317         misc/threads.c \
318         misc/stats.c \
319         misc/strings.c \
320         misc/unicode.c \
321         misc/cpu.c \
322         misc/configuration.c \
323         misc/image.c \
324         misc/iso_lang.c \
325         misc/iso-639_def.h \
326         misc/messages.c \
327         misc/objects.c \
328         misc/variables.c \
329         misc/error.c \
330         misc/update.c \
331         misc/vlm.c \
332         misc/xml.c \
333         misc/hashtables.c \
334         extras/libc.c \
335         control/core.c \
336         control/playlist.c \
337         control/vlm.c \
338         control/input.c \
339         control/video.c \
340         control/audio.c \
341         control/mediacontrol_core.c \
342         control/mediacontrol_util.c \
343         control/mediacontrol_audio_video.c \
344         $(NULL)
345
346 # These should be distributed, but not compiled
347 EXTRA_DIST += control/mediacontrol_init.c control/mediacontrol_plugin.c
348
349 SOURCES_libvlc = \
350         $(SOURCES_libvlc_common) \
351         $(OPT_SOURCES_libvlc_beos) \
352         $(OPT_SOURCES_libvlc_darwin) \
353         $(OPT_SOURCES_libvlc_win32) \
354         $(OPT_SOURCES_libvlc_dirent) \
355         $(OPT_SOURCES_libvlc_getopt) \
356         $(NULL)
357
358
359 if !USE_LIBTOOL
360 if !BUILD_SHARED
361 SOURCES_libvlc += misc/version.c
362 CLEANFILES += misc/version.c
363
364 misc/version.c: FORCE
365         $(TOOLBOX) --update-version
366 FORCE:
367
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 ###############################################################################
380 # Stamp rules
381 ###############################################################################
382 stamp-api: Makefile.in $(HEADERS_include) ../vlc-api.pl
383         ( cd $(srcdir) && cat $(HEADERS_include) ) | \
384           top_srcdir="$(top_srcdir)" perl $(top_srcdir)/vlc-api.pl
385         touch stamp-api
386
387 ###############################################################################
388 # Unit/regression test
389 ###############################################################################
390 if USE_LIBTOOL
391 check_PROGRAMS = test_i18n_atof test_url
392 TESTS = $(check_PROGRAMS)
393
394 CFLAGS_tests = `$(VLC_CONFIG) --cflags vlc`
395
396 test_i18n_atof_SOURCES = test/i18n_atof.c
397 test_i18n_atof_LDADD = libvlc.la
398 test_i18n_atof_CFLAGS = $(CFLAGS_tests)
399
400 test_url_SOURCES = test/url.c
401 test_url_LDADD = libvlc.la
402 test_url_CFLAGS = $(CFLAGS_tests)
403 endif
404