a54b283d153185881e9ae28535e8d1fab8c2dc07
[vlc.git] / 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 stamp-builtins: Makefile ../vlc-config ../config.status
128 if BUILD_SHARED
129         @for c in `$(VLC_CONFIG) --libs builtin`; do \
130                 case $$c in \
131                         ../modules/*.a) echo $$c ;; \
132                 esac ; \
133         done | \
134         sed -e 's,^\(.*\)/\([^/]*\)\.a$$,cd \1 \&\& $(MAKE) \2,g' | \
135         while read cmd; do echo $$cmd.a; eval "($$cmd.a)" || exit $$? ; done
136 endif
137         touch $@
138
139 ###############################################################################
140 # Building libvlc
141 ###############################################################################
142
143 libvlc_a_SOURCES = $(SOURCES_libvlc) $(SOURCES_libvlc_control)
144 nodist_libvlc_a_SOURCES = misc/version.c
145 libvlc_a_CFLAGS = `$(VLC_CONFIG) --cflags vlc pic` -DUSE_BUILTINS
146 libvlc_a_CXXFLAGS = `$(VLC_CONFIG) --cxxflags vlc pic`
147 libvlc_a_OBJCFLAGS = `$(VLC_CONFIG) --objcflags vlc pic`
148
149 libvlc_la_SOURCES = $(SOURCES_libvlc)
150 libvlc_la_LIBADD = $(INCLUDED_LIBINTL)
151 libvlc_la_CFLAGS = `$(VLC_CONFIG) --cflags vlc`
152 libvlc_la_CXXFLAGS = `$(VLC_CONFIG) --cxxflags vlc`
153 libvlc_la_OBJCFLAGS = `$(VLC_CONFIG) --objcflags vlc`
154 libvlc_la_LDFLAGS = `$(VLC_CONFIG) --libs vlc` \
155         -no-undefined -export-symbols libvlc.sym -version-info 0:0:0
156 libvlc_la_DEPENDENCIES = stamp-builtins stamp-api
157
158 libvlc_control_la_SOURCES = $(SOURCES_libvlc_control)
159 libvlc_control_la_LIBADD = libvlc.la
160 libvlc_control_la_CFLAGS = `$(VLC_CONFIG) --cflags vlc`
161 libvlc_control_la_LDFLAGS = \
162         -no-undefined -export-symbols-regex '_?(libvlc|mediacontrol)_.*' \
163         -version-info 0:0:0
164
165 if HAVE_BEOS
166 OPT_SOURCES_libvlc_beos = $(SOURCES_libvlc_beos)
167 endif
168 if HAVE_DARWIN
169 OPT_SOURCES_libvlc_darwin = $(SOURCES_libvlc_darwin)
170 endif
171 if HAVE_WIN32
172 OPT_SOURCES_libvlc_win32 = $(SOURCES_libvlc_win32)
173 endif
174 if HAVE_WINCE
175 OPT_SOURCES_libvlc_win32 = $(SOURCES_libvlc_win32)
176 endif
177 if BUILD_DIRENT
178 OPT_SOURCES_libvlc_dirent = $(SOURCES_libvlc_dirent)
179 endif
180 if BUILD_GETOPT
181 OPT_SOURCES_libvlc_getopt = $(SOURCES_libvlc_getopt)
182 endif
183
184 # Build libvlc as a shared library
185 if USE_LIBTOOL
186 lib_LTLIBRARIES = libvlc.la libvlc-control.la
187 else
188 lib_LIBRARIES = libvlc.a
189 endif
190
191 if HAVE_WIN32
192 pic =
193 else
194 pic = pic
195 endif
196
197 if HAVE_WIN32
198 if BUILD_SHARED
199 DATA_noinst_libvlc = libvlc$(LIBEXT) libvlc$(LIBEXT).a
200 endif
201
202 libvlc.dll.a: libvlc$(LIBEXT)
203         $(DLLTOOL) --export-all-symbols -l $@ -D $< $(libvlc_a_OBJECTS)
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                 $$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 libtool 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-common.c \
256         libvlc.h \
257         interface/interface.c \
258         interface/intf_eject.c \
259         interface/interaction.c \
260         playlist/playlist_internal.h \
261         playlist/thread.c \
262         playlist/control.c \
263         playlist/engine.c \
264         playlist/sort.c \
265         playlist/loadsave.c \
266         playlist/tree.c \
267         playlist/item.c \
268         playlist/search.c \
269         playlist/services_discovery.c \
270         input/item.c \
271         input/access.c \
272         input/clock.c \
273         input/control.c \
274         input/decoder.c \
275         input/demux.c \
276         input/es_out.c \
277         input/input.c \
278         input/meta.c \
279         input/input_internal.h \
280         input/stream.c \
281         input/mem_stream.c \
282         input/subtitles.c \
283         input/var.c \
284         video_output/video_output.c \
285         video_output/vout_pictures.c \
286         video_output/vout_pictures.h \
287         video_output/video_text.c \
288         video_output/video_widgets.c \
289         video_output/vout_subpictures.c \
290         video_output/vout_synchro.c \
291         video_output/vout_intf.c \
292         audio_output/common.c \
293         audio_output/dec.c \
294         audio_output/filters.c \
295         audio_output/input.c \
296         audio_output/mixer.c \
297         audio_output/output.c \
298         audio_output/intf.c \
299         stream_output/stream_output.c \
300         stream_output/announce.c \
301         stream_output/profiles.c \
302         stream_output/sap.c \
303         osd/osd.c \
304         osd/osd_parser.c \
305         osd/osd_text.c \
306         osd/osd_widgets.c \
307         network/acl.c \
308         network/getaddrinfo.c \
309         network/io.c \
310         network/error.c \
311         network/tcp.c \
312         network/udp.c \
313         network/httpd.c \
314         network/rootwrap.c \
315         network/tls.c \
316         misc/charset.c \
317         misc/md5.c \
318         misc/mtime.c \
319         misc/block.c \
320         misc/modules.c \
321         misc/threads.c \
322         misc/stats.c \
323         misc/strings.c \
324         misc/unicode.c \
325         misc/cpu.c \
326         misc/configuration.c \
327         misc/configuration_chain.c \
328         misc/image.c \
329         misc/iso_lang.c \
330         misc/iso-639_def.h \
331         misc/messages.c \
332         misc/objects.c \
333         misc/variables.c \
334         misc/error.c \
335         misc/update.c \
336         misc/vlm.c \
337         misc/xml.c \
338         misc/dict.c \
339         misc/devices.c \
340         extras/libc.c \
341         $(NULL)
342
343 SOURCES_libvlc = \
344         $(SOURCES_libvlc_common) \
345         $(OPT_SOURCES_libvlc_beos) \
346         $(OPT_SOURCES_libvlc_darwin) \
347         $(OPT_SOURCES_libvlc_win32) \
348         $(OPT_SOURCES_libvlc_dirent) \
349         $(OPT_SOURCES_libvlc_getopt) \
350         $(NULL)
351
352 SOURCES_libvlc_control = \
353         control/core.c \
354         control/log.c \
355         control/playlist.c \
356         control/vlm.c \
357         control/input.c \
358         control/video.c \
359         control/audio.c \
360         control/mediacontrol_core.c \
361         control/mediacontrol_util.c \
362         control/mediacontrol_audio_video.c
363
364 if !USE_LIBTOOL
365 if !BUILD_SHARED
366 CLEANFILES += misc/version.c
367 endif
368
369 # Install shared libvlc
370 install-exec-local:
371         test -z "$(DATA_noinst_libvlc)" || $(INSTALL_PROGRAM) "$(DATA_noinst_libvlc)" "$(DESTDIR)$(libdir)"
372
373 # the opposite of install-{data,exec}-local
374 uninstall-local:
375         test -z "$(DATA_noinst_libvlc)" || rm -f "$(DESTDIR)$(libdir)/$(DATA_noinst_libvlc)"
376 endif
377
378 misc/version.c: FORCE
379         $(TOOLBOX) --update-version
380
381 ###############################################################################
382 # Stamp rules
383 ###############################################################################
384 stamp-api: Makefile.in $(HEADERS_include) ../vlc-api.pl
385         ( cd $(srcdir) && cat $(HEADERS_include) ) | \
386           top_srcdir="$(top_srcdir)" perl $(top_srcdir)/vlc-api.pl
387         touch stamp-api
388
389 libvlc.sym:
390         rm -f stamp-api
391         $(MAKE) stamp-api
392
393 ###############################################################################
394 # Unit/regression test
395 ###############################################################################
396 if USE_LIBTOOL
397 check_PROGRAMS = test_i18n_atof test_url
398 TESTS = $(check_PROGRAMS)
399
400 CFLAGS_tests = `$(VLC_CONFIG) --cflags vlc`
401
402 test_i18n_atof_SOURCES = test/i18n_atof.c
403 test_i18n_atof_LDADD = libvlc.la
404 test_i18n_atof_CFLAGS = $(CFLAGS_tests)
405
406 test_url_SOURCES = test/url.c
407 test_url_LDADD = libvlc.la
408 test_url_CFLAGS = $(CFLAGS_tests)
409 endif
410
411 FORCE: