]> git.sesse.net Git - vlc/blob - src/Makefile.am
* No longer use the $(pic) variable, since all flags are properly set
[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/vlc_streaming.h \
61         ../include/variables.h \
62         ../include/video_output.h \
63         ../include/vlc_access.h \
64         ../include/vlc_acl.h \
65         ../include/vlc_bits.h \
66         ../include/vlc_block.h \
67         ../include/vlc_block_helper.h \
68         ../include/vlc_codec.h \
69         ../include/vlc_common.h \
70         ../include/vlc_config.h \
71         ../include/vlc_cpu.h \
72         ../include/vlc_demux.h \
73         ../include/vlc_error.h \
74         ../include/vlc_es.h \
75         ../include/vlc_es_out.h \
76         ../include/vlc_filter.h \
77         ../include/vlc_config_cat.h \
78         ../include/vlc_httpd.h \
79         ../include/vlc_tls.h \
80         ../include/vlc_md5.h \
81         ../include/vlc_devices.h \
82         ../include/vlc_image.h \
83         ../include/vlc_input.h \
84         ../include/vlc_interaction.h \
85         ../include/vlc_interface.h \
86         ../include/vlc_intf_strings.h \
87         ../include/vlc_keys.h \
88         ../include/vlc_messages.h \
89         ../include/vlc_meta.h \
90         ../include/vlc_objects.h \
91         ../include/vlc_osd.h \
92         ../include/vlc_playlist.h \
93         ../include/vlc_spu.h \
94         ../include/vlc_stream.h \
95         ../include/vlc_strings.h \
96         ../include/vlc_symbols.h \
97         ../include/vlc_threads_funcs.h \
98         ../include/vlc_threads.h \
99         ../include/vlc_update.h \
100         ../include/vlc_url.h \
101         ../include/vlc_video.h \
102         ../include/vlc_vlm.h \
103         ../include/vlc_vod.h \
104         ../include/vlc_xml.h \
105         ../include/vout_synchro.h \
106         ../include/win32_specific.h \
107         ../include/libvlc_internal.h \
108         ../include/mediacontrol_internal.h
109         $(NULL)
110
111 misc/modules_builtin.h: Makefile misc/modules_builtin.h.in ../vlc-config
112         $(TOOLBOX) --update-includes
113         touch $@
114
115 misc/modules.c: misc/modules_builtin.h
116
117 ###############################################################################
118 # Building builtin modules
119 ###############################################################################
120 #
121 # As long as we use builtins with a shared libvlc, we must build them before
122 # we build libvlc. Maybe one day, libvlc will handle multiple modules per
123 # shared object, which will make builtins fairly redumdant. Until then, we
124 # need this workaround.
125
126 stamp-builtins: Makefile ../vlc-config ../config.status
127 if USE_LIBTOOL
128         @for c in `$(VLC_CONFIG) --libs builtin`; do \
129                 case $$c in \
130                         ../modules/*.a) echo $$c ;; \
131                 esac ; \
132         done | \
133         sed -e 's,^\(.*\)/\([^/]*\)\.a$$,cd \1 \&\& $(MAKE) \2_builtin.la,g' | \
134         while read cmd; do echo $$cmd; eval "($$cmd)" || exit $$? ; done
135 endif
136 if BUILD_SHARED
137         @for c in `$(VLC_CONFIG) --libs builtin`; do \
138                 case $$c in \
139                         ../modules/*.a) echo $$c ;; \
140                 esac ; \
141         done | \
142         sed -e 's,^\(.*\)/\([^/]*\)\.a$$,cd \1 \&\& $(MAKE) \2,g' | \
143         while read cmd; do echo $$cmd.a; eval "($$cmd.a)" || exit $$? ; done
144 endif
145         touch $@
146
147 ###############################################################################
148 # Building libvlc
149 ###############################################################################
150
151 libvlc_a_SOURCES = $(SOURCES_libvlc)
152 libvlc_a_CFLAGS = `$(VLC_CONFIG) --cflags vlc pic`
153 libvlc_a_CXXFLAGS = `$(VLC_CONFIG) --cxxflags vlc pic`
154 libvlc_a_OBJCFLAGS = `$(VLC_CONFIG) --objcflags vlc pic`
155
156 libvlc_la_SOURCES = $(SOURCES_libvlc)
157 libvlc_la_LIBADD = $(INCLUDED_LIBINTL)
158 libvlc_la_CFLAGS = `$(VLC_CONFIG) --cflags vlc`
159 libvlc_la_CXXFLAGS = `$(VLC_CONFIG) --cxxflags vlc`
160 libvlc_la_OBJCFLAGS = `$(VLC_CONFIG) --objcflags vlc`
161 libvlc_la_LDFLAGS = `$(VLC_CONFIG) --libs vlc builtin|sed -e 's/\(modules\/[^ ]*\)\.a /\1_builtin.la /g'` -no-undefined -export-symbols libvlc.sym
162 libvlc_la_DEPENDENCIES = stamp-builtins stamp-api
163
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
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.h \
256         interface/interface.c \
257         interface/intf_eject.c \
258         interface/interaction.c \
259         playlist/playlist_internal.h \
260         playlist/thread.c \
261         playlist/control.c \
262         playlist/engine.c \
263         playlist/sort.c \
264         playlist/loadsave.c \
265         playlist/tree.c \
266         playlist/item.c \
267         playlist/search.c \
268         playlist/services_discovery.c \
269         input/item.c \
270         input/access.c \
271         input/clock.c \
272         input/control.c \
273         input/decoder.c \
274         input/demux.c \
275         input/es_out.c \
276         input/input.c \
277         input/input_internal.h \
278         input/stream.c \
279         input/mem_stream.c \
280         input/subtitles.c \
281         input/var.c \
282         video_output/video_output.c \
283         video_output/vout_pictures.c \
284         video_output/vout_pictures.h \
285         video_output/video_text.c \
286         video_output/video_widgets.c \
287         video_output/vout_subpictures.c \
288         video_output/vout_synchro.c \
289         video_output/vout_intf.c \
290         audio_output/common.c \
291         audio_output/dec.c \
292         audio_output/filters.c \
293         audio_output/input.c \
294         audio_output/mixer.c \
295         audio_output/output.c \
296         audio_output/intf.c \
297         stream_output/stream_output.c \
298         stream_output/announce.c \
299         stream_output/profiles.c \
300         stream_output/sap.c \
301         osd/osd.c \
302         osd/osd_parser.c \
303         osd/osd_text.c \
304         osd/osd_widgets.c \
305         network/acl.c \
306         network/getaddrinfo.c \
307         network/io.c \
308         network/error.c \
309         network/tcp.c \
310         network/udp.c \
311         network/httpd.c \
312         network/rootwrap.c \
313         network/tls.c \
314         misc/charset.c \
315         misc/md5.c \
316         misc/mtime.c \
317         misc/block.c \
318         misc/modules.c \
319         misc/threads.c \
320         misc/stats.c \
321         misc/strings.c \
322         misc/unicode.c \
323         misc/cpu.c \
324         misc/configuration.c \
325         misc/image.c \
326         misc/iso_lang.c \
327         misc/iso-639_def.h \
328         misc/messages.c \
329         misc/objects.c \
330         misc/variables.c \
331         misc/error.c \
332         misc/update.c \
333         misc/vlm.c \
334         misc/xml.c \
335         misc/dict.c \
336         misc/devices.c \
337         extras/libc.c \
338         control/core.c \
339         control/playlist.c \
340         control/vlm.c \
341         control/input.c \
342         control/video.c \
343         control/audio.c \
344         control/mediacontrol_core.c \
345         control/mediacontrol_util.c \
346         control/mediacontrol_audio_video.c \
347         $(NULL)
348
349 # These should be distributed, but not compiled
350 EXTRA_DIST += control/mediacontrol_init.c control/mediacontrol_plugin.c
351
352 SOURCES_libvlc = \
353         $(SOURCES_libvlc_common) \
354         $(OPT_SOURCES_libvlc_beos) \
355         $(OPT_SOURCES_libvlc_darwin) \
356         $(OPT_SOURCES_libvlc_win32) \
357         $(OPT_SOURCES_libvlc_dirent) \
358         $(OPT_SOURCES_libvlc_getopt) \
359         $(NULL)
360
361 if !USE_LIBTOOL
362 if !BUILD_SHARED
363 SOURCES_libvlc += misc/version.c
364 CLEANFILES += misc/version.c
365 endif
366
367 # Install shared libvlc
368 install-exec-local:
369         test -z "$(DATA_noinst_libvlc)" || $(INSTALL_PROGRAM) "$(DATA_noinst_libvlc)" "$(DESTDIR)$(libdir)"
370
371 # the opposite of install-{data,exec}-local
372 uninstall-local:
373         test -z "$(DATA_noinst_libvlc)" || rm -f "$(DESTDIR)$(libdir)/$(DATA_noinst_libvlc)"
374 endif
375
376 misc/version.c: FORCE
377         $(TOOLBOX) --update-version
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 libvlc.sym:
388         rm -f stamp-api
389         $(MAKE) stamp-api
390
391 ###############################################################################
392 # Unit/regression test
393 ###############################################################################
394 if USE_LIBTOOL
395 check_PROGRAMS = test_i18n_atof test_url
396 TESTS = $(check_PROGRAMS)
397
398 CFLAGS_tests = `$(VLC_CONFIG) --cflags vlc`
399
400 test_i18n_atof_SOURCES = test/i18n_atof.c
401 test_i18n_atof_LDADD = libvlc.la
402 test_i18n_atof_CFLAGS = $(CFLAGS_tests)
403
404 test_url_SOURCES = test/url.c
405 test_url_LDADD = libvlc.la
406 test_url_CFLAGS = $(CFLAGS_tests)
407 endif
408
409 FORCE: