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