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