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