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