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