a7ec95658eac0502123d13648f2b7d7ef30f0d5b
[vlc.git] / src / Makefile.am
1 ###############################################################################
2 # Automake targets and declarations
3 ###############################################################################
4
5 AUTOMAKE_OPTIONS = subdir-objects
6
7 NULL =
8 EXTRA_DIST = extras/COPYING modules/builtin.h.in libvlc.sym vlc-control.pc.in
9
10 BUILT_SOURCES = modules/builtin.h misc/revision.c ../include/vlc_about.h
11 CLEANFILES = $(BUILT_SOURCES)
12
13 SUFFIXES = .pc.in .pc
14
15 ###############################################################################
16 # Headers
17 ###############################################################################
18
19 pkgincludedir = $(includedir)/vlc
20
21 dist_pkginclude_HEADERS = \
22         ../include/vlc/vlc.h \
23         ../include/vlc/libvlc.h \
24         ../include/vlc/libvlc_structures.h \
25         ../include/vlc/mediacontrol.h \
26         ../include/vlc/mediacontrol_structures.h \
27         $(NULL)
28
29 noinst_HEADERS = $(HEADERS_include)
30
31 HEADERS_include = \
32         ../include/iso_lang.h \
33         ../include/main.h \
34         ../include/mmx.h \
35         ../include/vlc_access.h \
36         ../include/vlc_acl.h \
37         ../include/vlc_aout.h \
38         ../include/vlc_arrays.h \
39         ../include/vlc_bits.h \
40         ../include/vlc_block.h \
41         ../include/vlc_block_helper.h \
42         ../include/vlc_charset.h \
43         ../include/vlc_codec.h \
44         ../include/vlc_codec_synchro.h \
45         ../include/vlc_codecs.h \
46         ../include/vlc_common.h \
47         ../include/vlc_config.h \
48         ../include/vlc_config_cat.h \
49         ../include/vlc_configuration.h \
50         ../include/vlc_demux.h \
51         ../include/vlc_devices.h \
52         ../include/vlc_epg.h \
53         ../include/vlc_es.h \
54         ../include/vlc_es_out.h \
55         ../include/vlc_events.h \
56         ../include/vlc_filter.h \
57         ../include/vlc_fixups.h \
58         ../include/vlc_httpd.h \
59         ../include/vlc_image.h \
60         ../include/vlc_input.h \
61         ../include/vlc_interface.h \
62         ../include/vlc_intf_strings.h \
63         ../include/vlc_keys.h \
64         ../include/vlc_md5.h \
65         ../include/vlc_messages.h \
66         ../include/vlc_meta.h \
67         ../include/vlc_modules.h \
68         ../include/vlc_modules_macros.h \
69         ../include/vlc_mtime.h \
70         ../include/vlc_network.h \
71         ../include/vlc_objects.h \
72         ../include/vlc_osd.h \
73         ../include/vlc_pgpkey.h \
74         ../include/vlc_playlist.h \
75         ../include/vlc_plugin.h \
76         ../include/vlc_rand.h \
77         ../include/vlc_services_discovery.h \
78         ../include/vlc_sout.h \
79         ../include/vlc_stream.h \
80         ../include/vlc_streaming.h \
81         ../include/vlc_strings.h \
82         ../include/vlc_threads.h \
83         ../include/vlc_threads_funcs.h \
84         ../include/vlc_tls.h \
85         ../include/vlc_update.h \
86         ../include/vlc_url.h \
87         ../include/vlc_variables.h \
88         ../include/vlc_vlm.h \
89         ../include/vlc_vod.h \
90         ../include/vlc_vout.h \
91         ../include/vlc_xml.h \
92         $(NULL)
93
94 modules/builtin.h: modules/builtin.h.in ../vlc-config Makefile.am
95         rm -f -- "$@.tmp"
96         cat "$(srcdir)/modules/builtin.h.in" > "$@.tmp"
97 if !HAVE_PLUGINS
98         plugins="$$($(VLC_CONFIG) --list plugin)" ; \
99         test -n "$${plugins}" && \
100         for p in $${plugins}; do \
101                 echo "int vlc_entry__$$p (module_t *);" ; \
102         done >> "$@.tmp"
103 endif
104         echo "#define ALLOCATE_ALL_BUILTINS() \\" >> "$@.tmp"
105         echo "    do \\" >> "$@.tmp"
106         echo "    { \\" >> "$@.tmp"
107 if !HAVE_PLUGINS
108         plugins="$$($(VLC_CONFIG) --list plugin)" ; \
109         test -n "$${plugins}" && \
110         for p in $${plugins}; do \
111                 echo "        ALLOCATE_BUILTIN($$p); \\" ; \
112         done >> "$@.tmp"
113 endif
114         echo '    } while( 0 );' >> "$@.tmp"
115         mv -f -- "$@.tmp" "$@"
116
117 modules/modules.c: modules/builtin.h
118
119 ../include/vlc_about.h: Makefile.am $(top_srcdir)/COPYING $(top_srcdir)/THANKS $(top_srcdir)/AUTHORS
120         rm -f -- "$@.tmp"
121         mkdir -p -- ../include
122         echo "/* Automatically generated file - DO NOT EDIT */" > "$@.tmp"
123         echo "static const char psz_license[] =" >> "$@.tmp"
124         cat $(top_srcdir)/COPYING | sed s/'"'/'\\"'/g | $(AWK) '{ print "\""$$0"\\n\"" }' >> "$@.tmp"
125         echo ";" >> "$@.tmp"
126         echo "static const char psz_thanks[] =" >> "$@.tmp"
127         grep -v '$$Id:'  $(top_srcdir)/THANKS | sed s/'"'/'\\"'/g | $(AWK) '{ print "\""$$0"\\n\"" }'|sed s/"<.*.> "// >> "$@.tmp"
128         echo ";" >> "$@.tmp"
129         echo "static const char psz_authors[] =" >> "$@.tmp"
130         grep N: $(top_srcdir)/AUTHORS | cut -d" " -f 2- | sed s/'"'/'\\"'/g | $(AWK) '{ print "\""$$0"\\n\"" }' >> "$@.tmp"
131         echo ";" >> "$@.tmp"
132         mv -f -- "$@.tmp" "$@"
133
134 ###############################################################################
135 # pkg-config integration
136 ###############################################################################
137
138 pkgconfigdir = $(libdir)/pkgconfig
139 pkgconfig_DATA = vlc-control.pc vlc-plugin.pc
140 CLEANFILES += $(pkgconfig_DATA)
141
142 .pc.in.pc: $(top_builddir)/config.status
143         cd "$(top_builddir)" && \
144         $(SHELL) ./config.status --file="src/$@"
145
146 ###############################################################################
147 # Building libvlc
148 ###############################################################################
149
150 nice:
151         $(top_builddir)/compile
152
153 lib_LTLIBRARIES = libvlc.la libvlc-control.la
154
155 AM_LDFLAGS = -no-undefined -no-install
156 if HAVE_WIN32
157 AM_LDFLAGS += -avoid-version
158 endif
159
160 libvlc_la_SOURCES = $(SOURCES_libvlc)
161 nodist_libvlc_la_SOURCES = misc/revision.c
162 libvlc_la_CFLAGS = `$(VLC_CONFIG) --cflags libvlc` \
163         -DLOCALEDIR=\"$(localedir)\" \
164         -DDATA_PATH=\"$(pkgdatadir)\" \
165         -DPLUGIN_PATH=\"$(pkglibdir)\"
166 libvlc_la_CXXFLAGS = `$(VLC_CONFIG) --cxxflags libvlc`
167 libvlc_la_OBJCFLAGS = `$(VLC_CONFIG) --objcflags libvlc`
168 libvlc_la_LDFLAGS = `$(VLC_CONFIG) --ldflags libvlc` $(AM_LDFLAGS) \
169         -version-info 1:0:0
170 if HAVE_COMPILER_EXPORT
171 libvlc_la_LDFLAGS += -export-dynamic
172 else
173 libvlc_la_LDFLAGS += -export-symbols $(srcdir)/libvlc.sym 
174 endif
175 libvlc_la_LIBADD = `$(VLC_CONFIG) -libs libvlc` $(AM_LIBADD) $(LTLIBINTL)
176
177 libvlc_la_DEPENDENCIES = libvlc.sym
178
179 libvlc_control_la_SOURCES = $(SOURCES_libvlc_control)
180 libvlc_control_la_LIBADD = libvlc.la
181 libvlc_control_la_CFLAGS = `$(VLC_CONFIG) --cflags libvlc`
182 libvlc_control_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1:0:0
183 if HAVE_COMPILER_EXPORT
184 libvlc_control_la_LDFLAGS += -export-dynamic
185 else
186 libvlc_control_la_LDFLAGS += -export-symbols-regex '^_?(libvlc|mediacontrol)_.*'
187 endif
188
189 EXTRA_libvlc_la_SOURCES = \
190         $(SOURCES_libvlc_beos) \
191         $(SOURCES_libvlc_darwin) \
192         $(SOURCES_libvlc_win32) \
193         $(SOURCES_libvlc_dirent) \
194         $(SOURCES_libvlc_getopt) \
195         $(NULL)
196 if HAVE_BEOS
197 libvlc_la_SOURCES += $(SOURCES_libvlc_beos)
198 endif
199 if HAVE_DARWIN
200 libvlc_la_SOURCES += $(SOURCES_libvlc_darwin)
201 endif
202 if HAVE_WIN32
203 libvlc_la_SOURCES += $(SOURCES_libvlc_win32)
204 endif
205 if HAVE_WINCE
206 libvlc_la_SOURCES += $(SOURCES_libvlc_win32)
207 endif
208 if BUILD_DIRENT
209 libvlc_la_SOURCES += $(SOURCES_libvlc_dirent)
210 endif
211 if BUILD_GETOPT
212 libvlc_la_SOURCES += $(SOURCES_libvlc_getopt)
213 endif
214
215 SOURCES_libvlc_beos = \
216         misc/beos_specific.cpp \
217         $(NULL)
218
219 SOURCES_libvlc_darwin = \
220         misc/darwin_specific.c \
221         $(NULL)
222
223 SOURCES_libvlc_win32 = \
224         misc/win32_specific.c \
225         $(NULL)
226
227 SOURCES_libvlc_dirent = \
228         extras/dirent.c \
229         $(NULL)
230
231 SOURCES_libvlc_getopt = \
232         extras/getopt.c \
233         extras/getopt.h \
234         extras/getopt1.c \
235         $(NULL)
236
237 SOURCES_libvlc_common = \
238         libvlc.c \
239         libvlc-common.c \
240         libvlc.h \
241         libvlc-module.c \
242         interface/interface.c \
243         interface/intf_eject.c \
244         interface/interaction.c \
245         playlist/playlist_internal.h \
246         playlist/thread.c \
247         playlist/control.c \
248         playlist/engine.c \
249         playlist/sort.c \
250         playlist/loadsave.c \
251         playlist/tree.c \
252         playlist/item.c \
253         playlist/search.c \
254         playlist/services_discovery.c \
255         input/item.c \
256         input/access.c \
257         input/clock.c \
258         input/control.c \
259         input/decoder.c \
260         input/decoder_synchro.c \
261         input/demux.c \
262         input/es_out.c \
263         input/input.c \
264         input/meta.c \
265         input/input_internal.h \
266         input/vlm_internal.h \
267         input/stream.c \
268         input/mem_stream.c \
269         input/subtitles.c \
270         input/var.c \
271         video_output/video_output.c \
272         video_output/vout_pictures.c \
273         video_output/vout_pictures.h \
274         video_output/video_text.c \
275         video_output/video_widgets.c \
276         video_output/vout_subpictures.c \
277         video_output/vout_intf.c \
278         audio_output/aout_internal.h \
279         audio_output/common.c \
280         audio_output/dec.c \
281         audio_output/filters.c \
282         audio_output/input.c \
283         audio_output/mixer.c \
284         audio_output/output.c \
285         audio_output/intf.c \
286         stream_output/stream_output.c \
287         stream_output/stream_output.h \
288         stream_output/announce.c \
289         stream_output/profiles.c \
290         stream_output/sap.c \
291         stream_output/sdp.c \
292         osd/osd.c \
293         osd/osd_text.c \
294         osd/osd_widgets.c \
295         network/acl.c \
296         network/getaddrinfo.c \
297         network/io.c \
298         network/error.c \
299         network/tcp.c \
300         network/udp.c \
301         network/httpd.c \
302         network/rootwrap.c \
303         network/tls.c \
304         network/poll.c \
305         text/charset.c \
306         text/strings.c \
307         text/unicode.c \
308         text/wincp.c \
309         text/iso_lang.c \
310         text/iso-639_def.h \
311         misc/md5.c \
312         misc/rand.c \
313         misc/mtime.c \
314         misc/block.c \
315         modules/modules.h \
316         modules/modules.c \
317         modules/cache.c \
318         modules/entry.c \
319         modules/os.c \
320         misc/threads.c \
321         misc/stats.c \
322         misc/cpu.c \
323         config/configuration.h \
324         config/core.c \
325         config/chain.c \
326         config/file.c \
327         config/intf.c \
328         config/cmdline.c \
329         misc/events.c \
330         misc/image.c \
331         misc/messages.c \
332         misc/objects.c \
333         misc/variables.h \
334         misc/variables.c \
335         misc/error.c \
336         misc/update.c \
337         input/vlm.c \
338         misc/xml.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/libvlc_internal.h \
354         control/core.c \
355         control/log.c \
356         control/playlist.c \
357         control/vlm.c \
358         control/video.c \
359         control/audio.c \
360         control/dynamic_media_list.c \
361         control/event.c \
362         control/flat_media_list_view.c \
363         control/hierarchical_media_list_view.c \
364         control/hierarchical_node_media_list_view.c \
365         control/media_descriptor.c \
366         control/media_instance.c \
367         control/media_list.c \
368         control/media_list_path.h \
369         control/media_list_player.c \
370         control/media_list_view.c \
371         control/media_library.c \
372         control/mediacontrol_internal.h \
373         control/mediacontrol_core.c \
374         control/mediacontrol_util.c \
375         control/mediacontrol_audio_video.c \
376         control/media_discoverer.c \
377         control/tag_query.c
378
379 ###############################################################################
380 # Stamp rules
381 ###############################################################################
382
383 misc/revision.c:
384         rm -f $@ $@.tmp
385         echo "/* AUTOGENERATED FILE - DO NOT EDIT */" > $@.tmp
386         REVISION="$$((LANG=C git --git-dir=$(top_srcdir)/.git show-ref -s HEAD 2>/dev/null || echo exported) | cut -b -10)"; \
387         echo "const char psz_vlc_changeset[] = \"$$REVISION\";" >> $@.tmp
388         mv -f $@.tmp $@
389
390
391 ###############################################################################
392 # Building vlc
393 ###############################################################################
394
395 if BUILD_VLC
396 bin_PROGRAMS = vlc
397 endif
398
399 vlc_SOURCES = vlc.c
400 vlc_DEPENDENCIES = $(DATA_win32_rc) libvlc.la
401
402 vlc_CFLAGS = `$(VLC_CONFIG) --cflags vlc`
403 vlc_LDFLAGS = `$(VLC_CONFIG) --ldflags vlc`
404 vlc_LDADD = $(DATA_win32_rc) libvlc.la $(LTLIBINTL) `$(VLC_CONFIG) -libs vlc`
405
406 if BUILD_VLC
407 vlc$(EXEEXT): $(vlc_OBJECTS) $(vlc_DEPENDENCIES)
408         @rm -f vlc$(EXEEXT)
409         @case `$(VLC_CONFIG) --linkage vlc builtin` in \
410           c++) cmd="$(CXXLINK)" ;; \
411           objc) cmd="$(OBJCLINK)" ;; \
412           c|*) cmd="$(LINK)" ;; \
413         esac ; \
414         cmd="$$cmd $(vlc_OBJECTS) $(vlc_LDADD) $(vlc_LDFLAGS)" ; \
415         echo $$cmd ; \
416         eval $$cmd
417
418 if HAVE_WIN32
419 DATA_win32_rc = $(noinst_DATA)
420 noinst_DATA = vlc_win32_rc.$(OBJEXT)
421
422 vlc_win32_rc.$(OBJEXT): $(top_srcdir)/share/vlc_win32_rc.rc
423         $(WINDRES) -DVERSION=$(VERSION) -DVERSION_NUMBER=`echo $(VERSION).0.0.0 | sed 's/\([0-9]*\)[^.]*\.*\([0-9]*\)[^.]*\.*\([0-9]*\)[^.]*\.*\([0-9]*\).*/\1,\2,\3,\4/'` --include-dir $(top_srcdir)/share -i $< -o $@
424 endif
425 endif
426
427 ###############################################################################
428 # Unit/regression test
429 ###############################################################################
430 check_PROGRAMS = \
431         test_dictionary \
432         test_i18n_atof \
433         test_url \
434         test_utf8 \
435         test_headers \
436         test_control \
437         $(NULL)
438
439 dist_check_SCRIPTS = check_symbols
440 TESTS = $(check_PROGRAMS) $(dist_check_SCRIPTS)
441
442 CFLAGS_tests = `$(VLC_CONFIG) --cflags libvlc`
443
444 test_dictionary_SOURCES = test/dictionary.c
445 test_dictionary_LDADD = libvlc.la
446 test_dictionary_CFLAGS = $(CFLAGS_tests)
447
448 test_i18n_atof_SOURCES = test/i18n_atof.c text/charset.c
449 test_i18n_atof_LDADD = libvlc.la
450 test_i18n_atof_CFLAGS = $(CFLAGS_tests)
451
452 test_url_SOURCES = test/url.c
453 test_url_LDADD = libvlc.la
454 test_url_CFLAGS = $(CFLAGS_tests)
455
456 test_utf8_SOURCES = test/utf8.c
457 test_utf8_LDADD = libvlc.la
458 test_utf8_CFLAGS = $(CFLAGS_tests)
459
460 test_headers_SOURCES = test/headers.c
461 test_headers_CFLAGS = $(CFLAGS_tests)
462
463 test_control_SOURCES = control/testapi.c
464 test_control_LDADD = libvlc-control.la
465 test_control_CFLAGS = $(CFLAGS_tests)
466
467 check-local:
468         for h in `echo $(dist_pkginclude_HEADERS) $(pkginclude_HEADERS) | sed -e s,\.\./include/,,g`; \
469         do \
470                 echo grep - "#include <$$h>" $(srcdir)/test/headers.c ; \
471                 if ! grep -- "#include <$$h>" $(srcdir)/test/headers.c ; \
472                 then \
473                         echo "Header $$h not included in test/headers.c!"; \
474                         exit 1; \
475                 fi ; \
476         done
477
478 FORCE:
479         @echo "Generated source cannot be phony. Go away." >&2
480         @exit 1
481
482 .PHONY: FORCE