b1936d6cfa20b62db467c5b7e7cd61d4bded9091
[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
14 CLEANFILES = misc/modules_builtin.h stamp-version misc/version.c
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_symbols.h \
93         ../include/vlc_threads_funcs.h \
94         ../include/vlc_threads.h \
95         ../include/vlc_update.h \
96         ../include/vlc_url.h \
97         ../include/vlc_video.h \
98         ../include/vlc_vlm.h \
99         ../include/vlc_vod.h \
100         ../include/vlc_xml.h \
101         ../include/vout_synchro.h \
102         ../include/win32_specific.h \
103         ../include/libvlc_internal.h \
104         ../include/mediacontrol_internal.h
105         $(NULL)
106
107 misc/modules_builtin.h: Makefile misc/modules_builtin.h.in ../vlc-config
108         $(TOOLBOX) --update-includes
109         touch $@
110
111 misc/modules.c: misc/modules_builtin.h
112
113 misc/version.c:
114         $(TOOLBOX) --update-version
115
116 stamp-version: misc/version.c
117         $(TOOLBOX) --update-version
118         touch $@
119
120 .PHONY: stamp-version
121
122 ###############################################################################
123 # Building builtin modules
124 ###############################################################################
125 #
126 # As long as we use builtins with a shared libvlc, we must build them before
127 # we build libvlc. Maybe one day, libvlc will handle multiple modules per
128 # shared object, which will make builtins fairly redumdant. Until then, we
129 # need this workaround.
130
131 stamp-builtins: Makefile ../vlc-config ../config.status
132 if USE_LIBTOOL
133         @for c in `$(VLC_CONFIG) --libs builtin`; do \
134                 case $$c in \
135                         ../modules/*.a) echo $$c ;; \
136                 esac ; \
137         done | \
138         sed -e 's/^\(.*\)\/\([^\/]*\)\.a$$/cd \1 \&\& $(MAKE) \2_builtin.la/g' | \
139         while read cmd; do echo $$cmd; eval "($$cmd)" || exit $$? ; done
140 endif
141 if BUILD_SHARED
142         @if test "$(pic)" = "pic"; then ext="_pic.a"; else ext=".a"; fi ; \
143         for c in `$(VLC_CONFIG) --libs builtin`; do \
144                 case $$c in \
145                         ../modules/*.a) echo $$c ;; \
146                 esac ; \
147         done | \
148         sed -e 's/^\(.*\)\/\([^\/]*\)\.a$$/cd \1 \&\& $(MAKE) \2/g' | \
149         while read cmd; do echo $$cmd$$ext; eval "($$cmd$$ext)" || exit $$? ; done
150 endif
151         touch $@
152
153 ###############################################################################
154 # Building libvlc
155 ###############################################################################
156
157 libvlc_a_SOURCES = $(SOURCES_libvlc)
158 libvlc_a_CFLAGS = `$(VLC_CONFIG) --cflags vlc`
159 libvlc_a_CXXFLAGS = `$(VLC_CONFIG) --cxxflags vlc`
160 libvlc_a_OBJCFLAGS = `$(VLC_CONFIG) --objcflags vlc`
161
162 libvlc_pic_a_SOURCES = $(SOURCES_libvlc)
163 libvlc_pic_a_CFLAGS = `$(VLC_CONFIG) --cflags vlc pic`
164 libvlc_pic_a_CXXFLAGS = `$(VLC_CONFIG) --cxxflags vlc pic`
165 libvlc_pic_a_OBJCFLAGS = `$(VLC_CONFIG) --objcflags vlc pic`
166
167 libvlc_la_SOURCES = $(SOURCES_libvlc)
168 libvlc_la_CFLAGS = `$(VLC_CONFIG) --cflags vlc`
169 libvlc_la_CXXFLAGS = `$(VLC_CONFIG) --cxxflags vlc`
170 libvlc_la_OBJCFLAGS = `$(VLC_CONFIG) --objcflags vlc`
171 libvlc_la_LDFLAGS = `$(VLC_CONFIG) --libs vlc builtin|sed -e 's/\(modules\/[^ ]*\)\.a /\1_builtin.la /g'` \
172                 -avoid-version -no-undefined
173 libvlc_la_DEPENDENCIES = stamp-builtins
174
175
176 if HAVE_BEOS
177 OPT_SOURCES_libvlc_beos = $(SOURCES_libvlc_beos)
178 endif
179 if HAVE_DARWIN
180 OPT_SOURCES_libvlc_darwin = $(SOURCES_libvlc_darwin)
181 endif
182 if HAVE_WIN32
183 OPT_SOURCES_libvlc_win32 = $(SOURCES_libvlc_win32)
184 endif
185 if HAVE_WINCE
186 OPT_SOURCES_libvlc_win32 = $(SOURCES_libvlc_win32)
187 endif
188 if BUILD_DIRENT
189 OPT_SOURCES_libvlc_dirent = $(SOURCES_libvlc_dirent)
190 endif
191 if BUILD_GETOPT
192 OPT_SOURCES_libvlc_getopt = $(SOURCES_libvlc_getopt)
193 endif
194
195 # Build libvlc as a shared library
196 if USE_LIBTOOL
197 lib_LTLIBRARIES = libvlc.la
198 else
199 lib_LIBRARIES = libvlc.a
200 if BUILD_PIC
201 lib_LIBRARIES += libvlc_pic.a
202 endif
203 endif
204
205 if HAVE_WIN32
206 if BUILD_SHARED
207 DATA_noinst_libvlc = libvlc$(LIBEXT)
208 endif
209
210 libvlc.dll.a: libvlc$(LIBEXT)
211
212 libvlc$(LIBEXT): $(OBJECTS_libvlc_so) stamp-builtins
213         @ldfl="`$(VLC_CONFIG) --libs plugin vlc builtin $(pic)` $(INCLUDED_LIBINTL)" ; \
214         case `$(VLC_CONFIG) --linkage vlc builtin` in \
215           c++)  ld="$(CXXLINK)" ;; \
216           objc) ld="$(OBJCLINK)" ;; \
217           c|*)  ld="$(LINK)" ;; \
218         esac ; \
219         echo $$ld $(OBJECTS_libvlc_so) $(LDFLAGS_libvlc_so) $$ldfl; \
220         $$ld $(libvlc_a_OBJECTS) \
221                 -Wl,--out-implib,$(top_builddir)/src/libvlc.dll.a $$ldfl
222 # It sucks big time, but we have to do that to link vlc properly
223 # on non-PIC OSes, otherwise ld will favor builtins-less libvlc.a over
224 # libvlc$(LIBEXT)
225         rm -f libvlc.a
226 # Cygwin work-around
227         @if test -f "$@.exe"; then mv -f "$@.exe" "$@"; fi
228 endif
229
230 EXTRA_DIST += \
231         $(SOURCES_libvlc_beos) \
232         $(SOURCES_libvlc_darwin) \
233         $(SOURCES_libvlc_win32) \
234         $(SOURCES_libvlc_dirent) \
235         $(SOURCES_libvlc_getopt) \
236         $(NULL)
237
238 SOURCES_libvlc_beos = \
239         misc/beos_specific.cpp \
240         $(NULL)
241
242 SOURCES_libvlc_darwin = \
243         misc/darwin_specific.m \
244         $(NULL)
245
246 SOURCES_libvlc_win32 = \
247         misc/win32_specific.c \
248         $(NULL)
249
250 SOURCES_libvlc_dirent = \
251         extras/dirent.c \
252         $(NULL)
253
254 SOURCES_libvlc_getopt = \
255         extras/getopt.c \
256         extras/getopt.h \
257         extras/getopt1.c \
258         $(NULL)
259
260 SOURCES_libvlc_common = \
261         libvlc.c \
262         libvlc.h \
263         interface/interface.c \
264         interface/intf_eject.c \
265         interface/interaction.c \
266         playlist/playlist.c \
267         playlist/sort.c \
268         playlist/loadsave.c \
269         playlist/view.c \
270         playlist/item.c \
271         playlist/item-ext.c \
272         playlist/services_discovery.c \
273         input/access.c \
274         input/clock.c \
275         input/control.c \
276         input/decoder.c \
277         input/demux.c \
278         input/es_out.c \
279         input/input.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/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/unicode.c \
324         misc/cpu.c \
325         misc/configuration.c \
326         misc/image.c \
327         misc/iso_lang.c \
328         misc/iso-639_def.h \
329         misc/messages.c \
330         misc/objects.c \
331         misc/variables.c \
332         misc/error.c \
333         misc/update.c \
334         misc/vlm.c \
335         misc/xml.c \
336         misc/hashtables.c \
337         misc/version.c \
338         extras/libc.c \
339         control/core.c \
340         control/playlist.c \
341         control/vlm.c \
342         control/input.c \
343         control/video.c \
344         control/audio.c \
345         control/mediacontrol_core.c \
346         control/mediacontrol_util.c \
347         control/mediacontrol_audio_video.c \
348         $(NULL)
349
350 # These should be distributed, but not compiled
351 EXTRA_DIST += control/mediacontrol_init.c control/mediacontrol_plugin.c
352
353 SOURCES_libvlc = \
354         $(SOURCES_libvlc_common) \
355         $(OPT_SOURCES_libvlc_beos) \
356         $(OPT_SOURCES_libvlc_darwin) \
357         $(OPT_SOURCES_libvlc_win32) \
358         $(OPT_SOURCES_libvlc_dirent) \
359         $(OPT_SOURCES_libvlc_getopt) \
360         $(NULL)
361
362 if !USE_LIBTOOL
363 # Install shared libvlc
364 install-exec-local:
365         test -z "$(DATA_noinst_libvlc)" || $(INSTALL_PROGRAM) "$(DATA_noinst_libvlc)" "$(DESTDIR)$(libdir)"
366
367 # the opposite of install-{data,exec}-local
368 uninstall-local:
369         test -z "$(DATA_noinst_libvlc)" || rm -f "$(DESTDIR)$(libdir)/$(DATA_noinst_libvlc)"
370 endif
371
372 ###############################################################################
373 # Stamp rules
374 ###############################################################################
375 stamp-api: Makefile.in $(HEADERS_include) ../vlc-api.pl
376         ( cd $(srcdir) && cat $(HEADERS_include) ) | \
377           top_srcdir="$(top_srcdir)" perl $(top_srcdir)/vlc-api.pl
378         touch stamp-api
379
380 ###############################################################################
381 # Unit/regression test
382 ###############################################################################
383 if USE_LIBTOOL
384 check_PROGRAMS = test_i18n_atof
385 TESTS = $(check_PROGRAMS)
386
387 CFLAGS_tests = `$(VLC_CONFIG) --cflags vlc`
388
389 test_i18n_atof_SOURCES = test/i18n_atof.c
390 test_i18n_atof_LDADD = libvlc.la
391 test_i18n_atof_CFLAGS = $(CFLAGS_tests)
392 endif
393