Always remove revision.tmp
[vlc.git] / src / Makefile.am
1 ###############################################################################
2 # Automake targets and declarations
3 ###############################################################################
4
5 AUTOMAKE_OPTIONS = subdir-objects
6 SUBDIRS = . test
7
8 NULL =
9 EXTRA_DIST = extras/COPYING \
10         misc/beos_specific.cpp \
11         libvlc.pc.in \
12         vlc-plugin.pc.in \
13         libvlc.sym \
14         libvlccore.sym
15
16 BUILT_SOURCES = ../include/vlc_about.h
17 CLEANFILES = $(BUILT_SOURCES)
18
19 SUFFIXES = .pc.in .pc
20
21 ###############################################################################
22 # Headers
23 ###############################################################################
24
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_events.h \
32         ../include/vlc/libvlc_media.h \
33         ../include/vlc/libvlc_media_discoverer.h \
34         ../include/vlc/libvlc_media_library.h \
35         ../include/vlc/libvlc_media_list.h \
36         ../include/vlc/libvlc_media_list_player.h \
37         ../include/vlc/libvlc_media_list_view.h \
38         ../include/vlc/libvlc_media_player.h \
39         ../include/vlc/libvlc_structures.h \
40         ../include/vlc/libvlc_vlm.h \
41         ../include/vlc/mediacontrol.h \
42         ../include/vlc/mediacontrol_structures.h \
43         $(NULL)
44
45 pluginsinclude_HEADERS = \
46         ../include/vlc_access.h \
47         ../include/vlc_acl.h \
48         ../include/vlc_aout.h \
49         ../include/vlc_aout_mixer.h \
50         ../include/vlc_arrays.h \
51         ../include/vlc_art_finder.h \
52         ../include/vlc_avcodec.h \
53         ../include/vlc_bits.h \
54         ../include/vlc_block.h \
55         ../include/vlc_block_helper.h \
56         ../include/vlc_charset.h \
57         ../include/vlc_codec.h \
58         ../include/vlc_common.h \
59         ../include/vlc_config.h \
60         ../include/vlc_config_cat.h \
61         ../include/vlc_configuration.h \
62         ../include/vlc_dialog.h \
63         ../include/vlc_demux.h \
64         ../include/vlc_epg.h \
65         ../include/vlc_es.h \
66         ../include/vlc_es_out.h \
67         ../include/vlc_events.h \
68         ../include/vlc_filter.h \
69         ../include/vlc_fourcc.h \
70         ../include/vlc_gcrypt.h \
71         ../include/vlc_http.h \
72         ../include/vlc_httpd.h \
73         ../include/vlc_image.h \
74         ../include/vlc_input.h \
75         ../include/vlc_input_item.h \
76         ../include/vlc_main.h \
77         ../include/vlc_md5.h \
78         ../include/vlc_messages.h \
79         ../include/vlc_meta.h \
80         ../include/vlc_modules.h \
81         ../include/vlc_mouse.h \
82         ../include/vlc_mtime.h \
83         ../include/vlc_objects.h \
84         ../include/vlc_picture.h \
85         ../include/vlc_picture_fifo.h \
86         ../include/vlc_picture_pool.h \
87         ../include/vlc_playlist.h \
88         ../include/vlc_plugin.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_strings.h \
94         ../include/vlc_subpicture.h \
95         ../include/vlc_threads.h \
96         ../include/vlc_url.h \
97         ../include/vlc_variables.h \
98         ../include/vlc_vlm.h \
99         ../include/vlc_video_splitter.h \
100         ../include/vlc_vout.h \
101         ../include/vlc_vout_display.h \
102         ../include/vlc_vout_window.h \
103         ../include/vlc_xml.h \
104         $(NULL)
105
106 noinst_HEADERS = \
107         ../include/mmx.h \
108         ../include/vlc_codec_synchro.h \
109         ../include/vlc_codecs.h \
110         ../include/vlc_devices.h \
111         ../include/vlc_fixups.h \
112         ../include/vlc_interface.h \
113         ../include/vlc_intf_strings.h \
114         ../include/vlc_iso_lang.h \
115         ../include/vlc_keys.h \
116         ../include/vlc_network.h \
117         ../include/vlc_osd.h \
118         ../include/vlc_pgpkey.h \
119         ../include/vlc_tls.h \
120         ../include/vlc_update.h \
121         ../include/vlc_vod.h \
122         ../include/vlc_vout_wrapper.h \
123         $(NULL)
124
125 ../include/vlc_about.h: Makefile.am $(top_srcdir)/COPYING $(top_srcdir)/THANKS $(top_srcdir)/AUTHORS
126         rm -f -- "$@.tmp"
127         mkdir -p -- ../include
128         echo "/* Automatically generated file - DO NOT EDIT */" > "$@.tmp"
129         echo "static const char psz_license[] =" >> "$@.tmp"
130         sed 's/"/\\"/g;s/^.*$$/\"&\\n\"/' "$(top_srcdir)/COPYING" >> "$@.tmp"
131         echo ";" >> "$@.tmp"
132         echo "static const char psz_thanks[] =" >> "$@.tmp"
133         sed '/\$$Id:/d;s/"/\\"/g;s/<.*.> //;s/^.*$$/\"&\\n\"/' \
134                 "$(top_srcdir)/THANKS" >> "$@.tmp"
135         echo ";" >> "$@.tmp"
136         echo "static const char psz_authors[] =" >> "$@.tmp"
137         sed -n '/^N: /{;s///;s/"/\\"/g;s/^.*$$/\"&\\n\"/;p;}' \
138                 "$(top_srcdir)/AUTHORS" >> "$@.tmp"
139         echo ";" >> "$@.tmp"
140
141         mv -f -- "$@.tmp" "$@"
142
143 ###############################################################################
144 # pkg-config integration
145 ###############################################################################
146
147 pkgconfigdir = $(libdir)/pkgconfig
148 pkgconfig_DATA = libvlc.pc vlc-plugin.pc
149 CLEANFILES += $(pkgconfig_DATA)
150
151 .pc.in.pc: $(top_builddir)/config.status
152         cd "$(top_builddir)" && \
153         $(SHELL) ./config.status --file="src/$@"
154
155 ###############################################################################
156 # Building libvlc
157 ###############################################################################
158
159 nice:
160         $(top_builddir)/compile
161
162 lib_LTLIBRARIES = libvlccore.la libvlc.la
163
164 AM_LDFLAGS = -no-undefined
165 if HAVE_WIN32
166 AM_LDFLAGS += -avoid-version
167 endif
168 if HAVE_WINCE
169 AM_LDFLAGS += -avoid-version
170 endif
171
172 libvlccore_la_SOURCES = $(SOURCES_libvlc)
173 nodist_libvlccore_la_SOURCES = revision.c
174 libvlccore_la_CFLAGS = `$(VLC_CONFIG) --cflags libvlccore` \
175         -DMODULE_STRING=\"main\" \
176         -DLOCALEDIR=\"$(localedir)\" \
177         -DSYSCONFDIR=\"$(sysconfdir)\" \
178         -DDATA_PATH=\"$(vlcdatadir)\" \
179         -DLIBDIR=\"$(libdir)\" \
180         -DPLUGIN_PATH=\"$(vlclibdir)\"
181 libvlccore_la_LDFLAGS = `$(VLC_CONFIG) --ldflags libvlccore` $(AM_LDFLAGS) \
182         -no-undefined \
183         -export-symbols $(srcdir)/libvlccore.sym \
184         -version-info 4:0:0
185 libvlccore_la_LIBADD = `$(VLC_CONFIG) -libs libvlccore` $(AM_LIBADD) \
186         $(LTLIBINTL) ../compat/libcompat.la
187 libvlccore_la_DEPENDENCIES = libvlccore.sym
188 if HAVE_WIN32
189 libvlccore_la_DEPENDENCIES += libvlc_win32_rc.$(OBJEXT)
190 libvlccore_la_LDFLAGS += -Wl,libvlc_win32_rc.$(OBJEXT)
191 endif
192
193 libvlc_win32_rc.$(OBJEXT): $(top_builddir)/share/libvlc_win32_rc.rc
194         $(WINDRES) --include-dir $(top_srcdir)/share -i $< -o $@
195
196 libvlc_la_SOURCES = $(SOURCES_libvlc_control)
197 nodist_libvlc_la_SOURCES = revision.c
198 libvlc_la_LIBADD = `$(VLC_CONFIG) -libs libvlc` \
199         libvlccore.la ../compat/libcompat.la
200 libvlc_la_CFLAGS = `$(VLC_CONFIG) --cflags libvlc`
201 libvlc_la_LDFLAGS = $(AM_LDFLAGS) `$(VLC_CONFIG) --ldflags libvlc` \
202         -version-info 5:0:0 \
203         -export-symbols $(srcdir)/libvlc.sym
204 libvlc_la_DEPENDENCIES = libvlc.sym libvlccore.la
205 if HAVE_WIN32
206 libvlc_la_DEPENDENCIES += $(DATA_win32_rc_lib)
207 libvlc_la_LDFLAGS += -Wl,$(DATA_win32_rc_lib)
208 endif
209
210
211 EXTRA_libvlccore_la_SOURCES = \
212         $(SOURCES_libvlc_beos) \
213         $(SOURCES_libvlc_darwin) \
214         $(SOURCES_libvlc_linux) \
215         $(SOURCES_libvlc_win32) \
216         $(SOURCES_libvlc_other) \
217         $(SOURCES_libvlc_dirent) \
218         $(SOURCES_libvlc_getopt) \
219         $(SOURCES_libvlc_httpd) \
220         $(SOURCES_libvlc_sout) \
221         $(SOURCES_libvlc_vlm) \
222         $(NULL)
223 if HAVE_BEOS
224 libvlccore_la_SOURCES += $(SOURCES_libvlc_beos)
225 else
226 if HAVE_DARWIN
227 libvlccore_la_SOURCES += $(SOURCES_libvlc_darwin)
228 else
229 if HAVE_LINUX
230 libvlccore_la_SOURCES += $(SOURCES_libvlc_linux)
231 else
232 if HAVE_WIN32
233 libvlccore_la_SOURCES += $(SOURCES_libvlc_win32)
234 else
235 if HAVE_WINCE
236 libvlccore_la_SOURCES += $(SOURCES_libvlc_win32)
237 else
238 libvlccore_la_SOURCES += $(SOURCES_libvlc_other)
239 endif
240 endif
241 endif
242 endif
243 endif
244 if BUILD_DIRENT
245 libvlccore_la_SOURCES += $(SOURCES_libvlc_dirent)
246 endif
247 if BUILD_GETOPT
248 libvlccore_la_SOURCES += $(SOURCES_libvlc_getopt)
249 endif
250 if BUILD_HTTPD
251 libvlccore_la_SOURCES += $(SOURCES_libvlc_httpd)
252 endif
253 if ENABLE_SOUT
254 libvlccore_la_SOURCES += $(SOURCES_libvlc_sout)
255 if ENABLE_VLM
256 libvlccore_la_SOURCES += $(SOURCES_libvlc_vlm)
257 endif
258 endif
259
260 SOURCES_libvlc_beos = \
261         misc/pthread.c \
262         $(NULL)
263
264 SOURCES_libvlc_darwin = \
265         config/dirs_macos.c \
266         misc/pthread.c \
267         misc/darwin_specific.c \
268         $(NULL)
269
270 SOURCES_libvlc_linux = \
271         config/dirs_xdg.c \
272         misc/pthread.c \
273         misc/linux_specific.c \
274         $(NULL)
275
276 SOURCES_libvlc_win32 = \
277         config/dirs_win.c \
278         misc/w32thread.c \
279         misc/win32_specific.c \
280         network/winsock.c \
281         $(NULL)
282
283 SOURCES_libvlc_other = \
284         config/dirs_xdg.c \
285         misc/pthread.c \
286         misc/not_specific.c
287
288 SOURCES_libvlc_dirent = \
289         extras/dirent.c \
290         $(NULL)
291
292 SOURCES_libvlc_getopt = \
293         extras/getopt.c \
294         extras/getopt.h \
295         extras/getopt1.c \
296         $(NULL)
297
298 SOURCES_libvlc_common = \
299         libvlc.c \
300         libvlc.h \
301         libvlc-module.c \
302         missing.c \
303         version.c \
304         interface/dialog.c \
305         interface/interface.c \
306         interface/intf_eject.c \
307         playlist/playlist_internal.h \
308         playlist/art.c \
309         playlist/art.h \
310         playlist/thread.c \
311         playlist/control.c \
312         playlist/engine.c \
313         playlist/fetcher.c \
314         playlist/fetcher.h \
315         playlist/sort.c \
316         playlist/loadsave.c \
317         playlist/preparser.c \
318         playlist/preparser.h \
319         playlist/tree.c \
320         playlist/item.c \
321         playlist/search.c \
322         playlist/services_discovery.c \
323         input/item.c \
324         input/access.c \
325         input/clock.c \
326         input/control.c \
327         input/decoder.c \
328         input/decoder_synchro.c \
329         input/demux.c \
330         input/es_out.c \
331         input/es_out_timeshift.c \
332         input/event.c \
333         input/input.c \
334         input/meta.c \
335         input/access.h \
336         input/clock.h \
337         input/decoder.h \
338         input/demux.h \
339         input/es_out.h \
340         input/es_out_timeshift.h \
341         input/event.h \
342         input/item.h \
343         input/stream.h \
344         input/input_internal.h \
345         input/input_interface.h \
346         input/vlm_internal.h \
347         input/vlm_event.h \
348         input/resource.h \
349         input/resource.c \
350         input/stream.c \
351         input/stream_demux.c \
352         input/stream_filter.c \
353         input/stream_memory.c \
354         input/subtitles.c \
355         input/var.c \
356         video_output/display.c \
357         video_output/display.h \
358         video_output/event.h \
359         video_output/snapshot.c \
360         video_output/snapshot.h \
361         video_output/statistic.h \
362         video_output/video_output.c \
363         video_output/vout_pictures.c \
364         video_output/vout_pictures.h \
365         video_output/video_text.c \
366         video_output/video_widgets.c \
367         video_output/vout_subpictures.c \
368         video_output/window.c \
369         video_output/vout_intf.c \
370         video_output/vout_internal.h \
371         video_output/vout_control.h \
372         audio_output/aout_internal.h \
373         audio_output/common.c \
374         audio_output/dec.c \
375         audio_output/filters.c \
376         audio_output/input.c \
377         audio_output/mixer.c \
378         audio_output/output.c \
379         audio_output/intf.c \
380         osd/osd.c \
381         osd/osd_text.c \
382         osd/osd_widgets.c \
383         network/acl.c \
384         network/getaddrinfo.c \
385         network/io.c \
386         network/tcp.c \
387         network/udp.c \
388         network/rootbind.c \
389         network/tls.c \
390         network/poll.c \
391         text/charset.c \
392         text/strings.c \
393         text/unicode.c \
394         text/filesystem.c \
395         text/wincp.c \
396         text/iso_lang.c \
397         text/iso-639_def.h \
398         misc/md5.c \
399         misc/rand.c \
400         misc/mtime.c \
401         misc/block.c \
402         misc/fourcc.c \
403         misc/es_format.c \
404         modules/modules.h \
405         modules/modules.c \
406         modules/cache.c \
407         modules/entry.c \
408         modules/os.c \
409         misc/threads.c \
410         misc/stats.c \
411         misc/cpu.c \
412         misc/action.c \
413         config/configuration.h \
414         config/core.c \
415         config/chain.c \
416         config/file.c \
417         config/intf.c \
418         config/cmdline.c \
419         misc/events.c \
420         misc/image.c \
421         misc/messages.c \
422         misc/objects.c \
423         misc/variables.h \
424         misc/variables.c \
425         misc/error.c \
426         misc/update.h \
427         misc/update.c \
428         misc/update_crypto.c \
429         misc/xml.c \
430         misc/devices.c \
431         extras/libc.c \
432         misc/filter.c \
433         misc/filter_chain.c \
434         misc/http_auth.c \
435         $(NULL)
436
437 SOURCES_libvlc_httpd = \
438         network/httpd.c \
439         $(NULL)
440
441 SOURCES_libvlc_sout = \
442         stream_output/stream_output.c \
443         stream_output/stream_output.h \
444         stream_output/announce.c \
445         stream_output/sap.c \
446         stream_output/sdp.c \
447         $(NULL)
448
449 SOURCES_libvlc_vlm = \
450         input/vlm.c \
451         input/vlm_event.c \
452         input/vlmshell.c \
453         $(NULL)
454
455 SOURCES_libvlc = \
456         $(SOURCES_libvlc_common) \
457         $(OPT_SOURCES_libvlc_beos) \
458         $(OPT_SOURCES_libvlc_darwin) \
459         $(OPT_SOURCES_libvlc_win32) \
460         $(OPT_SOURCES_libvlc_dirent) \
461         $(OPT_SOURCES_libvlc_getopt) \
462         $(NULL)
463
464 SOURCES_libvlc_control = \
465         control/libvlc_internal.h \
466         control/event_internal.h \
467         control/media_internal.h \
468         control/media_list_internal.h \
469         control/media_list_view_internal.h \
470         control/media_player_internal.h \
471         control/core.c \
472         control/error.c \
473         control/log.c \
474         control/playlist.c \
475         control/vlm.c \
476         control/video.c \
477         control/audio.c \
478         control/event.c \
479         control/event_async.c \
480         control/flat_media_list_view.c \
481         control/hierarchical_media_list_view.c \
482         control/hierarchical_node_media_list_view.c \
483         control/media.c \
484         control/media_player.c \
485         control/media_list.c \
486         control/media_list_path.h \
487         control/media_list_player.c \
488         control/media_list_view.c \
489         control/media_library.c \
490         control/mediacontrol_internal.h \
491         control/mediacontrol_core.c \
492         control/mediacontrol_util.c \
493         control/mediacontrol_audio_video.c \
494         control/media_discoverer.c
495
496 ###############################################################################
497 # GIT revision
498 ###############################################################################
499
500 BUILT_SOURCES += stamp-revision
501 CLEANFILES += revision.txt revision.c
502
503 revision.c: revision.txt
504         rm -f -- revision.c
505         echo "const char psz_vlc_changeset[] = \"$$(cat revision.txt)\";" \
506                 > revision.c
507
508 revision.txt:
509         $(MAKE) stamp-revision
510         touch revision.txt
511
512 stamp-revision:
513         rm -f -- revision.tmp
514         (git --git-dir="$(top_srcdir)/.git/" describe --tags --long \
515                 --always || echo exported) > revision.tmp
516         if diff revision.tmp revision.txt >/dev/null; then \
517                 rm -f -- revision.tmp; \
518         else \
519                 mv -f -- revision.tmp revision.txt; \
520         fi 2>&1
521
522 ###############################################################################
523 # Unit/regression test
524 ###############################################################################
525
526 dist_check_SCRIPTS = check_symbols check_headers
527 TESTS = check_symbols
528
529 check_DATA = libvlc-headers.sym libvlc-sorted.sym
530 CLEANFILES += $(check_DATA)
531
532 libvlc-sorted.sym: libvlccore.sym
533         rm -f libvlc-sorted.sym
534         sort -fdu < "$(srcdir)/libvlccore.sym" > libvlc-sorted.sym
535
536 libvlc-headers.sym:
537         rm -f libvlc-headers.sym
538         cat ${srcdir}/../include/vlc_*.h ${srcdir}/control/*.h | \
539         sed -n -e 's/^[ ]*VLC_EXPORT[ ]*([^,]*,\([^,]*\),.*/\1/p' | \
540         sed -e 's/[^a-zA-Z0-9_]*//' | \
541         sort -fdu > libvlc-headers.sym
542
543 .PHONY: libvlc-headers.sym
544
545 check-local:
546         for h in `echo $(pkginclude_HEADERS) | sed -e s,\.\./include/,,g`; \
547         do \
548                 echo grep - "#include <$$h>" $(srcdir)/test/headers.c ; \
549                 if ! grep -- "#include <$$h>" $(srcdir)/test/headers.c ; \
550                 then \
551                         echo "Header $$h not included in test/headers.c!"; \
552                         exit 1; \
553                 fi ; \
554         done
555         $(srcdir)/check_headers $(pkginclude_HEADERS)
556         $(srcdir)/check_headers $(pluginsinclude_HEADERS)
557
558 FORCE:
559         @echo "Generated source cannot be phony. Go away." >&2
560         @exit 1
561
562 .PHONY: FORCE