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