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