]> git.sesse.net Git - vlc/blob - src/Makefile.am
Use stamp not to recompile and relink version.c when it doesn't have to (closes ...
[vlc] / src / Makefile.am
1 ###############################################################################
2 # Automake targets and declarations
3 ###############################################################################
4
5 NULL =
6 SUBDIRS =
7
8 EXTRA_DIST = extras/COPYING misc/modules_builtin.h.in
9
10 BUILT_SOURCES = $(DISTCLEANFILES) $(CLEANFILES) misc/version.c
11 DISTCLEANFILES = stamp-api
12 CLEANFILES = misc/modules_builtin.h stamp-version
13 MOSTLYCLEANFILES = $(DATA_noinst_libvlc) stamp-builtins
14
15 TOOLBOX = srcdir=$(top_srcdir) builddir=$(top_builddir) $(top_srcdir)/toolbox
16
17 ###############################################################################
18 # Headers
19 ###############################################################################
20
21 pkgincludedir = $(includedir)/vlc
22
23 dist_pkginclude_HEADERS = \
24         ../include/vlc/vlc.h \
25         ../include/vlc/libvlc.h \
26         ../include/vlc/aout.h \
27         ../include/vlc/vout.h \
28         ../include/vlc/sout.h \
29         ../include/vlc/decoder.h \
30         ../include/vlc/input.h \
31         ../include/vlc/intf.h \
32         ../include/vlc/mediacontrol.h \
33         ../include/vlc/mediacontrol_structures.h \
34         $(NULL)
35
36 noinst_HEADERS = $(HEADERS_include)
37 noinst_DATA = $(DATA_noinst_libvlc)
38
39 HEADERS_include = \
40         ../include/aout_internal.h \
41         ../include/audio_output.h \
42         ../include/beos_specific.h \
43         ../include/charset.h \
44         ../include/codecs.h \
45         ../include/configuration.h \
46         ../include/darwin_specific.h \
47         ../include/intf_eject.h \
48         ../include/iso_lang.h \
49         ../include/main.h \
50         ../include/mmx.h \
51         ../include/modules.h \
52         ../include/modules_inner.h \
53         ../include/mtime.h \
54         ../include/network.h \
55         ../include/os_specific.h \
56         ../include/snapshot.h \
57         ../include/stream_output.h \
58         ../include/variables.h \
59         ../include/video_output.h \
60         ../include/vlc_access.h \
61         ../include/vlc_acl.h \
62         ../include/vlc_bits.h \
63         ../include/vlc_block.h \
64         ../include/vlc_block_helper.h \
65         ../include/vlc_codec.h \
66         ../include/vlc_common.h \
67         ../include/vlc_config.h \
68         ../include/vlc_cpu.h \
69         ../include/vlc_demux.h \
70         ../include/vlc_error.h \
71         ../include/vlc_es.h \
72         ../include/vlc_es_out.h \
73         ../include/vlc_filter.h \
74         ../include/vlc_config_cat.h \
75         ../include/vlc_httpd.h \
76         ../include/vlc_tls.h \
77         ../include/vlc_md5.h \
78         ../include/vlc_image.h \
79         ../include/vlc_input.h \
80         ../include/vlc_interaction.h \
81         ../include/vlc_interface.h \
82         ../include/vlc_keys.h \
83         ../include/vlc_messages.h \
84         ../include/vlc_meta.h \
85         ../include/vlc_objects.h \
86         ../include/vlc_osd.h \
87         ../include/vlc_playlist.h \
88         ../include/vlc_spu.h \
89         ../include/vlc_stream.h \
90         ../include/vlc_symbols.h \
91         ../include/vlc_threads_funcs.h \
92         ../include/vlc_threads.h \
93         ../include/vlc_update.h \
94         ../include/vlc_video.h \
95         ../include/vlc_vlm.h \
96         ../include/vlc_vod.h \
97         ../include/vlc_xml.h \
98         ../include/vout_synchro.h \
99         ../include/win32_specific.h \
100         ../include/libvlc_internal.h \
101         ../include/mediacontrol_internal.h
102         $(NULL)
103
104 misc/modules_builtin.h: Makefile misc/modules_builtin.h.in ../vlc-config
105         $(TOOLBOX) --update-includes
106         touch $@
107
108 misc/modules.c: misc/modules_builtin.h
109
110 misc/version.c:
111         $(TOOLBOX) --update-version
112
113 stamp-version: misc/version.c
114         $(TOOLBOX) --update-version
115         touch $@
116
117 .PHONY: stamp-version
118
119 ###############################################################################
120 # Building builtin modules
121 ###############################################################################
122 #
123 # As long as we use builtins with a shared libvlc, we must build them before
124 # we build libvlc. Maybe one day, libvlc will handle multiple modules per
125 # shared object, which will make builtins fairly redumdant. Until then, we
126 # need this workaround.
127
128 stamp-builtins: Makefile ../vlc-config ../config.status
129 if USE_LIBTOOL
130         @for c in `$(VLC_CONFIG) --libs builtin`; do \
131                 case $$c in \
132                         ../modules/*.a) echo $$c ;; \
133                 esac ; \
134         done | \
135         sed -e 's/^\(.*\)\/\([^\/]*\)\.a$$/cd \1 \&\& $(MAKE) \2_builtin.la/g' | \
136         while read cmd; do echo $$cmd; eval "($$cmd)" || exit $$? ; done
137 endif
138 if BUILD_SHARED
139         @if test "$(pic)" = "pic"; then ext="_pic.a"; else ext=".a"; fi ; \
140         for c in `$(VLC_CONFIG) --libs builtin`; do \
141                 case $$c in \
142                         ../modules/*.a) echo $$c ;; \
143                 esac ; \
144         done | \
145         sed -e 's/^\(.*\)\/\([^\/]*\)\.a$$/cd \1 \&\& $(MAKE) \2/g' | \
146         while read cmd; do echo $$cmd$$ext; eval "($$cmd$$ext)" || exit $$? ; done
147 endif
148         touch $@
149
150 ###############################################################################
151 # Building libvlc
152 ###############################################################################
153
154 libvlc_a_SOURCES = $(SOURCES_libvlc)
155 libvlc_a_CFLAGS = `$(VLC_CONFIG) --cflags vlc`
156 libvlc_a_CXXFLAGS = `$(VLC_CONFIG) --cxxflags vlc`
157 libvlc_a_OBJCFLAGS = `$(VLC_CONFIG) --objcflags vlc`
158
159 libvlc_pic_a_SOURCES = $(SOURCES_libvlc)
160 libvlc_pic_a_CFLAGS = `$(VLC_CONFIG) --cflags vlc pic`
161 libvlc_pic_a_CXXFLAGS = `$(VLC_CONFIG) --cxxflags vlc pic`
162 libvlc_pic_a_OBJCFLAGS = `$(VLC_CONFIG) --objcflags vlc pic`
163
164 libvlc_la_SOURCES = $(SOURCES_libvlc)
165 libvlc_la_CFLAGS = `$(VLC_CONFIG) --cflags vlc`
166 libvlc_la_CXXFLAGS = `$(VLC_CONFIG) --cxxflags vlc`
167 libvlc_la_OBJCFLAGS = `$(VLC_CONFIG) --objcflags vlc`
168 libvlc_la_LDFLAGS = `$(VLC_CONFIG) --libs vlc builtin|sed -e 's/\.a /_builtin.la /g'` \
169                 -avoid-version -no-undefined
170 libvlc_la_DEPENDENCIES = stamp-builtins
171
172
173 if HAVE_BEOS
174 OPT_SOURCES_libvlc_beos = $(SOURCES_libvlc_beos)
175 endif
176 if HAVE_DARWIN
177 OPT_SOURCES_libvlc_darwin = $(SOURCES_libvlc_darwin)
178 endif
179 if HAVE_WIN32
180 OPT_SOURCES_libvlc_win32 = $(SOURCES_libvlc_win32)
181 endif
182 if HAVE_WINCE
183 OPT_SOURCES_libvlc_win32 = $(SOURCES_libvlc_win32)
184 endif
185 if BUILD_DIRENT
186 OPT_SOURCES_libvlc_dirent = $(SOURCES_libvlc_dirent)
187 endif
188 if BUILD_GETOPT
189 OPT_SOURCES_libvlc_getopt = $(SOURCES_libvlc_getopt)
190 endif
191
192 # Build libvlc as a shared library
193 if USE_LIBTOOL
194 lib_LTLIBRARIES = libvlc.la
195 else
196 lib_LIBRARIES = libvlc.a
197 if BUILD_PIC
198 lib_LIBRARIES += libvlc_pic.a
199 endif
200 endif
201
202 if HAVE_WIN32
203 if BUILD_SHARED
204 DATA_noinst_libvlc = libvlc$(LIBEXT)
205 endif
206
207 libvlc$(LIBEXT): $(OBJECTS_libvlc_so) stamp-builtins
208         @ldfl="`$(VLC_CONFIG) --libs plugin vlc builtin $(pic)` $(INCLUDED_LIBINTL)" ; \
209         case `$(VLC_CONFIG) --linkage vlc builtin` in \
210           c++)  ld="$(CXXLINK)" ;; \
211           objc) ld="$(OBJCLINK)" ;; \
212           c|*)  ld="$(LINK)" ;; \
213         esac ; \
214         echo $$ld $(OBJECTS_libvlc_so) $(LDFLAGS_libvlc_so) $$ldfl; \
215         $$ld $(libvlc_a_OBJECTS) \
216                 -Wl,--out-implib,$(top_builddir)/src/libvlc.dll.a $$ldfl
217 # It sucks big time, but we have to do that to link vlc properly
218 # on non-PIC OSes, otherwise ld will favor builtins-less libvlc.a over
219 # libvlc$(LIBEXT)
220         rm -f libvlc.a
221 # Cygwin work-around
222         @if test -f "$@.exe"; then mv -f "$@.exe" "$@"; fi
223 endif
224
225 EXTRA_DIST += \
226         $(SOURCES_libvlc_beos) \
227         $(SOURCES_libvlc_darwin) \
228         $(SOURCES_libvlc_win32) \
229         $(SOURCES_libvlc_dirent) \
230         $(SOURCES_libvlc_getopt) \
231         $(NULL)
232
233 SOURCES_libvlc_beos = \
234         misc/beos_specific.cpp \
235         $(NULL)
236
237 SOURCES_libvlc_darwin = \
238         misc/darwin_specific.m \
239         $(NULL)
240
241 SOURCES_libvlc_win32 = \
242         misc/win32_specific.c \
243         $(NULL)
244
245 SOURCES_libvlc_dirent = \
246         extras/dirent.c \
247         $(NULL)
248
249 SOURCES_libvlc_getopt = \
250         extras/getopt.c \
251         extras/getopt.h \
252         extras/getopt1.c \
253         $(NULL)
254
255 SOURCES_libvlc_common = \
256         libvlc.c \
257         libvlc.h \
258         interface/interface.c \
259         interface/intf_eject.c \
260         interface/interaction.c \
261         playlist/playlist.c \
262         playlist/sort.c \
263         playlist/loadsave.c \
264         playlist/view.c \
265         playlist/item.c \
266         playlist/item-ext.c \
267         playlist/services_discovery.c \
268         input/access.c \
269         input/clock.c \
270         input/control.c \
271         input/decoder.c \
272         input/demux.c \
273         input/es_out.c \
274         input/input.c \
275         input/input_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_synchro.c \
287         video_output/vout_intf.c \
288         audio_output/common.c \
289         audio_output/dec.c \
290         audio_output/filters.c \
291         audio_output/ainput.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/announce.c \
297         stream_output/sap.c \
298         osd/osd.c \
299         osd/osd_parser.c \
300         osd/osd_text.c \
301         osd/osd_widgets.c \
302         network/acl.c \
303         network/getaddrinfo.c \
304         network/io.c \
305         network/tcp.c \
306         network/udp.c \
307         network/httpd.c \
308         network/rootwrap.c \
309         network/tls.c \
310         misc/charset.c \
311         misc/md5.c \
312         misc/mtime.c \
313         misc/block.c \
314         misc/modules.c \
315         misc/threads.c \
316         misc/stats.c \
317         misc/unicode.c \
318         misc/cpu.c \
319         misc/configuration.c \
320         misc/image.c \
321         misc/iso_lang.c \
322         misc/iso-639_def.h \
323         misc/messages.c \
324         misc/objects.c \
325         misc/variables.c \
326         misc/error.c \
327         misc/update.c \
328         misc/vlm.c \
329         misc/xml.c \
330         misc/hashtables.c \
331         misc/version.c \
332         extras/libc.c \
333         control/libvlc_core.c \
334         control/libvlc_playlist.c \
335         control/libvlc_vlm.c \
336         control/libvlc_input.c \
337         control/libvlc_video.c \
338         control/libvlc_audio.c \
339         control/mediacontrol_core.c \
340         control/mediacontrol_util.c \
341         control/mediacontrol_audio_video.c \
342         $(NULL)
343
344 # These should be distributed, but not compiled
345 EXTRA_DIST += control/mediacontrol_init.c control/mediacontrol_plugin.c
346
347 SOURCES_libvlc = \
348         $(SOURCES_libvlc_common) \
349         $(OPT_SOURCES_libvlc_beos) \
350         $(OPT_SOURCES_libvlc_darwin) \
351         $(OPT_SOURCES_libvlc_win32) \
352         $(OPT_SOURCES_libvlc_dirent) \
353         $(OPT_SOURCES_libvlc_getopt) \
354         $(NULL)
355
356 if !USE_LIBTOOL
357 # Install shared libvlc
358 install-exec-local:
359         test -z "$(DATA_noinst_libvlc)" || $(INSTALL_PROGRAM) "$(DATA_noinst_libvlc)" "$(DESTDIR)$(libdir)"
360
361 # the opposite of install-{data,exec}-local
362 uninstall-local:
363         test -z "$(DATA_noinst_libvlc)" || rm -f "$(DESTDIR)$(libdir)/$(DATA_noinst_libvlc)"
364 endif
365
366 ###############################################################################
367 # Stamp rules
368 ###############################################################################
369 stamp-api: Makefile.in $(HEADERS_include) ../vlc-api.pl
370         ( cd $(srcdir) && cat $(HEADERS_include) ) | \
371           top_srcdir="$(top_srcdir)" perl $(top_srcdir)/vlc-api.pl
372         touch stamp-api
373