]> git.sesse.net Git - vlc/blob - Makefile.am
* ./Makefile.am: we properly install plugins in the OS X vlc.app directory.
[vlc] / Makefile.am
1 ###############################################################################
2 # Automake targets and declarations
3 ###############################################################################
4
5 # SUBDIRS stores the directories where a "make" is required when building
6 # something. DIST_SUBDIRS stores the directories where nothing is built but
7 # which have makefiles with distribution information.
8 SUBDIRS = po intl m4 share
9 DIST_SUBDIRS = $(SUBDIRS) modules src debian doc ipkg lib
10
11 EXTRA_DIST = BUGS FAQ HACKING MAINTAINERS STATUS \
12              INSTALL.win32 README.MacOSX.rtf vlc.spec install-win32 \
13              Modules.am macosx-dmg \
14              configure.ac.in mkinstalldirs bootstrap
15 MOSTLYCLEANFILES =
16 BUILT_SOURCES =
17 SUFFIXES = 
18
19 # List of programs, libraries and headers that need to be built and/or
20 # distributed. Initialized to empty because we'll use += later.
21 bin_PROGRAMS =
22
23 lib_LIBRARIES = 
24 libvlc_LIBRARIES =
25 noinst_LIBRARIES =
26
27 noinst_HEADERS =
28
29 # Tell aclocal to use -I m4. Wonder if it really works.
30 ACLOCAL_AMFLAGS = -I m4
31
32 # XXX: these flags could be set in configure.ac.in, but we set them here
33 # because old versions of automake don't support them in configure.ac.
34 AUTOMAKE_OPTIONS = foreign dist-bzip2 subdir-objects
35
36 ###############################################################################
37 # Compilation flags for debug mode, profiling, and others
38 ###############################################################################
39
40 # Standard flags used everywhere to build things in the distribution. Some
41 # of them are empty but might be extended later in the Makefile. *_default
42 # is the default flag list for all files in the distribution, for instance
43 # the vlc code. *_pic is for PIC code, such as the Mozilla plugin. *_plugin
44 # is for plugin code, *_builtin is for builtin code, and *_builtin_pic is
45 # for PIC builtin code, for instance builtin modules in the mozilla plugin.
46
47 CPPFLAGS_default = -I$(top_srcdir)/include
48 CFLAGS_default = 
49 CXXFLAGS_default = 
50 OBJCFLAGS_default = 
51 LDFLAGS_default =
52
53 CPPFLAGS_pic = $(CPPFLAGS_default)
54 CFLAGS_pic = $(CFLAGS_default) @CFLAGS_pics@
55 CXXFLAGS_pic = $(CXXFLAGS_default) @CFLAGS_pics@
56 OBJCFLAGS_pic = $(OBJCFLAGS_default) @CFLAGS_pics@
57 LDFLAGS_pic = $(LDFLAGS_default)
58
59 CPPFLAGS_plugin = $(CPPFLAGS_default) -D__VLC__ -D__PLUGIN__
60 CFLAGS_plugin = $(CFLAGS_default) @CFLAGS_plugins@
61 CXXFLAGS_plugin = $(CXXFLAGS_default) @CFLAGS_plugins@
62 OBJCFLAGS_plugin = $(OBJCFLAGS_default) @CFLAGS_plugins@
63 LDFLAGS_plugin = @LDFLAGS_plugins@
64
65 CPPFLAGS_builtin = $(CPPFLAGS_default) -D__VLC__ -D__BUILTIN__
66 CFLAGS_builtin = $(CFLAGS_default) @CFLAGS_builtins@
67 CXXFLAGS_builtin = $(CXXFLAGS_default) @CFLAGS_builtins@
68 OBJCFLAGS_builtin = $(OBJCFLAGS_default) @CFLAGS_builtins@
69 LDFLAGS_builtin =
70 L_builtin =
71
72 CPPFLAGS_builtin_pic = $(CPPFLAGS_builtin) $(CPPFLAGS_pic)
73 CFLAGS_builtin_pic = $(CFLAGS_builtin) $(CFLAGS_pic)
74 CXXFLAGS_builtin_pic = $(CXXFLAGS_builtin) $(CXXFLAGS_pic)
75 OBJCFLAGS_builtin_pic = $(OBJCFLAGS_builtin) $(OBJCFLAGS_pic)
76 LDFLAGS_builtin_pic = $(LDFLAGS_builtin) $(LDFLAGS_pic)
77 L_builtin_pic = $(L_builtin) $(L_pic)
78
79 # On Linux and Solaris, activate 64-bit off_t (by default under BSD)
80 CPPFLAGS_default += -D_FILE_OFFSET_BITS=64 -D__USE_UNIX98 -D_LARGEFILE64_SOURCE
81 CPPFLAGS_default += -D_REENTRANT -D_THREAD_SAFE
82 CPPFLAGS_default += -D_GNU_SOURCE
83
84 # Gettext support
85 CPPFLAGS_default += -DLOCALEDIR=\"$(datadir)/locale\"
86
87 # Data and plugin location
88 CPPFLAGS_default += -DDATA_PATH=\"@prefix@/share/vlc\"
89 CPPFLAGS_default += -DPLUGIN_PATH=\"@prefix@/lib/vlc\"
90
91 # Conditional flags that get added to *FLAGS_default
92 if RELEASE
93 CPPFLAGS_release = -DHAVE_RELEASE
94 endif
95 if DEBUG
96 CPPFLAGS_debug = -DDEBUG
97 CFLAGS_debug = -g
98 endif
99 if GPROF
100 CPPFLAGS_gprof = -DGPROF
101 CFLAGS_gprof = -finstrument-functions
102 endif
103 if CPROF
104 CPPFLAGS_cprof = -DCPROF
105 CFLAGS_cprof = -pg
106 endif
107 if OPTIM
108 CFLAGS_optim = @CFLAGS_OPTIM@ @CFLAGS_TUNING@
109 if DEBUG
110 else
111 if GPROF
112 else
113 if CPROF
114 else
115 CFLAGS_nodebug = @CFLAGS_OPTIM_NODEBUG@
116 endif
117 endif
118 endif
119 endif
120
121 CPPFLAGS_default += $(CPPFLAGS_release) \
122                 $(CPPFLAGS_debug) $(CPPFLAGS_gprof) $(CPPFLAGS_cprof)
123 CFLAGS_default += $(CFLAGS_optim) $(CFLAGS_nodebug) \
124                 $(CFLAGS_debug) $(CFLAGS_gprof) $(CFLAGS_cprof)
125 CXXFLAGS_default += $(CFLAGS_optim) $(CFLAGS_nodebug) \
126                 $(CFLAGS_debug) $(CFLAGS_gprof) $(CFLAGS_cprof)
127 OBJCFLAGS_default += $(CFLAGS_optim) $(CFLAGS_nodebug) \
128                 $(CFLAGS_debug) $(CFLAGS_gprof) $(CFLAGS_cprof)
129
130 ###############################################################################
131 # Headers
132 ###############################################################################
133
134 BUILT_SOURCES += \
135         include/vlc_symbols.h \
136         src/misc/modules_builtin.h \
137         src/misc/modules_plugin.h
138
139 pkgincludedir = $(includedir)/vlc
140
141 dist_pkginclude_HEADERS = \
142         include/vlc/vlc.h \
143         include/vlc/aout.h \
144         include/vlc/vout.h \
145         include/vlc/sout.h \
146         include/vlc/decoder.h \
147         include/vlc/input.h \
148         include/vlc/intf.h
149
150 noinst_HEADERS += $(HEADERS_include) $(HEADERS_include_built)
151
152 HEADERS_include = \
153         include/aout_internal.h \
154         include/audio_output.h \
155         include/beos_specific.h \
156         include/configuration.h \
157         include/darwin_specific.h \
158         include/codecs.h \
159         include/error.h \
160         include/input_ext-dec.h \
161         include/input_ext-intf.h \
162         include/input_ext-plugins.h \
163         include/interface.h \
164         include/intf_eject.h \
165         include/iso_lang.h \
166         include/main.h \
167         include/mmx.h \
168         include/modules.h \
169         include/modules_inner.h \
170         include/mtime.h \
171         include/netutils.h \
172         include/network.h \
173         include/os_specific.h \
174         include/stream_control.h \
175         include/stream_output.h \
176         include/variables.h \
177         include/video.h \
178         include/video_output.h \
179         include/vlc_common.h \
180         include/vlc_config.h \
181         include/vlc_cpu.h \
182         include/vlc_messages.h \
183         include/vlc_objects.h \
184         include/vlc_playlist.h \
185         include/vlc_threads.h \
186         include/vlc_threads_funcs.h \
187         include/win32_specific.h
188
189 HEADERS_include_built = \
190         include/vlc_symbols.h
191
192 include/vlc_symbols.h: Makefile $(HEADERS_include)
193         rm -f $@.in
194         echo '/* DO NOT EDIT THIS FILE! See Makefile.am */' >> $@.in
195         echo 'struct module_symbols_t {' >> $@.in
196         cat $(HEADERS_include) | grep '^ *VLC_EXPORT.*;' | sed -e 's/VLC_EXPORT( *\([^,]*\), *\([^,]*\), *\(.*\));.*/    \1 (* \2_inner) \3;/' >> $@.in
197         echo '};' >> $@.in
198         echo '#ifdef __PLUGIN__' >> $@.in
199         cat $(HEADERS_include) | grep '^ *VLC_EXPORT.*;' | sed -e 's/VLC_EXPORT( *\([^,]*\), *\([^,]*\), *\(.*\));.*/#   define \2 p_symbols->\2_inner/' >> $@.in
200         echo '#endif /* __PLUGIN__ */' >> $@.in
201         mv -f $@.in $@
202
203 src/misc/modules_plugin.h: Makefile src/misc/modules_plugin.h.in $(HEADERS_include)
204         rm -f $@.tmp && cp $@.in $@.tmp
205         sed -e 's#.*\$[I][d]:.*# * Automatically generated from '$@'.in by bootstrap#' < $@.in > $@.tmp
206         echo '#define STORE_SYMBOLS( p_symbols ) \' >> $@.tmp
207         cat $(HEADERS_include) | grep '^ *VLC_EXPORT.*;' | sed -e 's/VLC_EXPORT( *\([^,]*\), *\([^,]*\), *\(.*\));.*/    (p_symbols)->\2_inner = \2; \\/' >> $@.tmp
208         echo '' >> $@.tmp
209         mv -f $@.tmp $@
210
211 src/misc/modules_builtin.h: Makefile src/misc/modules_builtin.h.in
212         rm -f $@.tmp && cp $@.in $@.tmp
213 if HAVE_BUILTINS
214         for i in $(BUILTINS) ; do echo "int vlc_entry__"`echo $$i | sed -e 'y@/@_@' -e 's@\..*@@'`"( module_t* );" >>$@.tmp; done
215         echo "" >> $@.tmp
216 endif
217         echo "#define ALLOCATE_ALL_BUILTINS() \\" >> $@.tmp
218         echo "    do \\" >> $@.tmp
219         echo "    { \\" >> $@.tmp
220 if HAVE_BUILTINS
221         for i in $(BUILTINS) ; do echo "        ALLOCATE_BUILTIN("`echo $$i | sed -e 'y@/@_@' -e 's@\..*@@'`"); \\" >> $@.tmp ; done
222 endif
223         echo "    } while( 0 );" >> $@.tmp
224         echo "" >> $@.tmp
225         mv -f $@.tmp $@
226
227 # These dependencies are mandatory
228 $(SOURCES): include/vlc_symbols.h
229 $(SOURCES_libvlc): src/misc/modules_plugin.h src/misc/modules_builtin.h $(LIB_intl)
230
231 ###############################################################################
232 # Optional getopt
233 ###############################################################################
234
235 EXTRA_DIST += \
236         extras/GNUgetopt/COPYING \
237         extras/GNUgetopt/getopt.c \
238         extras/GNUgetopt/getopt.h \
239         extras/GNUgetopt/getopt1.c
240
241 if BUILD_GETOPT
242 SOURCES_libgetopt = extras/GNUgetopt/getopt.c extras/GNUgetopt/getopt1.c
243 endif
244
245 ###############################################################################
246 # Optional libintl - FIXME, bad dependencies
247 ###############################################################################
248
249 intl/libintl.a: FORCE
250         cd intl && $(MAKE)
251
252 if BUILD_INTL
253 LIB_intl = intl/libintl.a
254 endif
255
256 ###############################################################################
257 # MacOS X project
258 ###############################################################################
259
260 EXTRA_DIST += \
261         extras/MacOSX/Resources/English.lproj/MainMenu.nib/classes.nib \
262         extras/MacOSX/Resources/English.lproj/MainMenu.nib/info.nib \
263         extras/MacOSX/Resources/English.lproj/MainMenu.nib/objects.nib \
264         extras/MacOSX/Resources/English.lproj/InfoPlist.strings \
265         extras/MacOSX/Resources/divx.icns \
266         extras/MacOSX/Resources/generic.icns \
267         extras/MacOSX/Resources/mpeg.icns \
268         extras/MacOSX/Resources/mpeg1.icns \
269         extras/MacOSX/Resources/mpeg2.icns \
270         extras/MacOSX/Resources/mpeg4.icns \
271         extras/MacOSX/Resources/vlc.icns \
272         extras/MacOSX/Resources/pause.png \
273         extras/MacOSX/Resources/play.png \
274         extras/MacOSX/Resources/stop.png \
275         extras/MacOSX/Resources/stepf.png \
276         extras/MacOSX/Resources/stepr.png \
277         extras/MacOSX/vlc.pbproj/project.pbxproj
278
279 ###############################################################################
280 # Building libvlc
281 ###############################################################################
282
283 bin_SCRIPTS = vlc-config
284
285 lib_LIBRARIES += lib/libvlc.a $(LIBRARIES_libvlc_pic)
286
287 lib_libvlc_a_SOURCES = $(SOURCES_libvlc)
288 lib_libvlc_a_CFLAGS = $(CPPFLAGS_default) -D__VLC__ $(CFLAGS_default) @CFLAGS_vlc@
289 lib_libvlc_a_CXXFLAGS = $(CPPFLAGS_default) -D__VLC__ $(CXXFLAGS_default)
290
291 lib_libvlc_pic_a_SOURCES = $(SOURCES_libvlc)
292 lib_libvlc_pic_a_CFLAGS = $(CPPFLAGS_pic) -D__VLC__ $(CFLAGS_pic) @CFLAGS_vlc@
293 lib_libvlc_pic_a_CXXFLAGS = $(CPPFLAGS_pic) -D__VLC__ $(CXXFLAGS_pic)
294
295 if HAVE_BEOS
296 SOURCES_libvlc_beos = src/misc/beos_specific.cpp
297 endif
298 if HAVE_DARWIN
299 SOURCES_libvlc_darwin = src/misc/darwin_specific.c
300 endif
301 if HAVE_WIN32
302 SOURCES_libvlc_win32 = src/misc/win32_specific.c
303 endif
304 if BUILD_MOZILLA
305 LIBRARIES_libvlc_pic = lib/libvlc_pic.a
306 endif
307
308 EXTRA_DIST += \
309         src/misc/beos_specific.cpp \
310         src/misc/darwin_specific.c \
311         src/misc/win32_specific.c
312
313 SOURCES_libvlc = \
314         src/libvlc.c \
315         src/libvlc.h \
316         src/interface/interface.c \
317         src/interface/intf_eject.c \
318         src/playlist/playlist.c \
319         src/input/input.c \
320         src/input/input_ext-plugins.c \
321         src/input/input_ext-dec.c \
322         src/input/input_ext-intf.c \
323         src/input/input_dec.c \
324         src/input/input_programs.c \
325         src/input/input_clock.c \
326         src/input/input_info.c \
327         src/video_output/video_output.c \
328         src/video_output/vout_pictures.c \
329         src/video_output/vout_pictures.h \
330         src/video_output/video_text.c \
331         src/video_output/video_text.h \
332         src/video_output/vout_subpictures.c \
333         src/audio_output/common.c \
334         src/audio_output/dec.c \
335         src/audio_output/filters.c \
336         src/audio_output/input.c \
337         src/audio_output/mixer.c \
338         src/audio_output/output.c \
339         src/audio_output/intf.c \
340         src/stream_output/stream_output.c \
341         src/misc/mtime.c \
342         src/misc/modules.c \
343         src/misc/threads.c \
344         src/misc/cpu.c \
345         src/misc/configuration.c \
346         src/misc/netutils.c \
347         src/misc/iso_lang.c \
348         src/misc/iso-639.def \
349         src/misc/messages.c \
350         src/misc/objects.c \
351         src/misc/variables.c \
352         src/misc/error.c \
353         src/misc/extras.c \
354         $(SOURCES_libvlc_win32) \
355         $(SOURCES_libvlc_beos) \
356         $(SOURCES_libvlc_darwin)
357
358 ###############################################################################
359 # Building vlc
360 ###############################################################################
361
362 bin_PROGRAMS += vlc
363
364 vlc_SOURCES = src/vlc.c $(SOURCES_libgetopt)
365
366 # @AUTOMAKE_SUCKS@ gets expanded to $(L_builtin) $(LDFLAGS_builtin)
367 # but we don't write it directly, otherwise automake will go amok and eat all
368 # the memory because of its 2^N crap algorithm. So we fool him. Nuahaha.
369 vlc_LDADD = lib/libvlc.a $(LDFLAGS_vlc) \
370             $(DATA_win32_rc) $(LIB_intl) @AUTOMAKE_SUCKS@
371 vlc_CFLAGS = $(CPPFLAGS_default) $(CFLAGS_default)
372
373 # We use DEPENDENCIES_vlc instead of vlc_DEPENDENCIES because of an
374 # old automake-1.5 bug (automake/279).
375 DEPENDENCIES_vlc = lib/libvlc.a $(L_builtin) $(DATA_win32_rc) $(LIB_intl)
376
377 vlc$(EXEEXT): $(vlc_OBJECTS) $(DEPENDENCIES_vlc)
378         @rm -f vlc$(EXEEXT)
379         $(LINK) $(vlc_LDFLAGS) $(vlc_OBJECTS) $(vlc_LDADD) $(LIBS)
380 if HAVE_BEOS
381         xres -o $@ ./share/vlc_beos.rsrc
382         mimeset -f $@
383 endif
384
385 # Install the symlinks
386 install-exec-local:
387         for i in dummy $(ALIASES) ; do if test "x$$i" != "xdummy" ; then \
388                 rm -f $(DESTDIR)$(bindir)/$$i && \
389                 ln -s vlc $(DESTDIR)$(bindir)/$$i ; \
390         fi ; done
391
392 if HAVE_DARWIN
393 # Create the MacOS X app
394 vlc_app_DATA = vlc.app
395 vlc_appdir = $(bindir)
396 vlc.app: vlc $(PLUGIN_FILES)
397         rm -Rf vlc.app
398         cd extras/MacOSX ; pbxbuild | grep -v '^[ \t]' | grep -v "^$$"
399         cp -r extras/MacOSX/build/vlc.bundle ./vlc.app
400         $(INSTALL) -d vlc.app/Contents/MacOS
401         $(INSTALL) vlc vlc.app/Contents/MacOS/
402         $(INSTALL) -d vlc.app/Contents/MacOS/modules
403         for i in dummy $(PLUGIN_FILES) ; do if test "x$$i" != "xdummy" ; then \
404                 $(INSTALL) $$i vlc.app/Contents/MacOS/modules/ ; \
405         fi ; done
406         $(INSTALL) -d vlc.app/Contents/MacOS/share
407         $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
408 endif
409
410 if HAVE_WIN32
411 DATA_win32_rc = $(noinst_share_vlc_win32_rc_DATA)
412 noinst_share_vlc_win32_rc_DATA = share/vlc_win32_rc.$(OBJEXT)
413 noinst_share_vlc_win32_rcdir = $(libdir)
414 share/vlc_win32_rc.$(OBJEXT): share/vlc_win32_rc.rc
415         $(WINDRES) -i $< -o $@
416 endif
417
418 ###############################################################################
419 # Building the Mozilla plugin
420 ###############################################################################
421
422 noinst_LIBRARIES += $(noinst_LIBRARIES_mozilla)
423
424 MOSTLYCLEANFILES += $(LIBRARIES_mozilla)
425
426 EXTRA_DIST += $(SOURCES_mozilla) mozilla/vlcintf.idl
427
428 BUILT_SOURCES += $(BUILT_SOURCES_mozilla)
429
430 SOURCES_mozilla = \
431         mozilla/vlcshell.cpp \
432         mozilla/vlcplugin.cpp \
433         mozilla/vlcplugin.h \
434         mozilla/vlcpeer.cpp \
435         mozilla/vlcpeer.h \
436         mozilla/classinfo.h \
437         $(SOURCES_mozilla_win32) \
438         $(SOURCES_mozilla_unix)
439
440 # Under Win32, Mozilla plugins need to be named NP******.DLL, but under Unix
441 # the common naming scheme is lib******plugin.so. Also, we need npwin.cpp
442 # under Win32 and npunix.c under Unix.
443 if HAVE_WIN32
444 LIBRARIES_mozilla = mozilla/npvlc$(LIBEXT)
445 SOURCES_mozilla_win32 = mozilla/npwin.cpp
446 CPPFLAGS_mozilla_EXTRA = -DXP_WIN -DXP_WIN32
447 else
448 LIBRARIES_mozilla = mozilla/libvlcplugin$(LIBEXT)
449 SOURCES_mozilla_unix = mozilla/npunix.c
450 endif
451
452 if BUILD_MOZILLA
453 if UNTRUE
454 noinst_LIBRARIES_mozilla = mozilla/libplugin.a
455 endif
456
457 mozilla_libplugin_a_SOURCES = $(SOURCES_mozilla) $(BUILT_SOURCES_mozilla) \
458                               $(SOURCES_libgetopt)
459 mozilla_libplugin_a_CFLAGS = $(CPPFLAGS_pic) $(CFLAGS_pic) \
460                              $(CPPFLAGS_mozilla) $(CFLAGS_mozilla) \
461                              $(CPPFLAGS_mozilla_EXTRA)
462 mozilla_libplugin_a_CXXFLAGS = $(CPPFLAGS_pic) $(CXXFLAGS_pic) \
463                                $(CPPFLAGS_mozilla) $(CXXFLAGS_mozilla) \
464                                $(CPPFLAGS_mozilla_EXTRA)
465 mozilla_libplugin_a_DEPENDENCIES = lib/libvlc_pic.a $(L_builtin_pic) $(DATA_npvlc_rc)
466
467 BUILT_SOURCES_mozilla = mozilla/vlcintf.h
468 $(SOURCES_mozilla): mozilla/vlcintf.h
469
470 mozilla_plugin_DATA = $(LIBRARIES_mozilla)
471 mozilla_plugindir = $(libdir)/mozilla/plugins
472 $(LIBRARIES_mozilla): $(mozilla_libplugin_a_OBJECTS) \
473                       $(mozilla_libplugin_a_DEPENDENCIES) \
474                       $(L_builtin_pic)
475         $(CXXLINK) $(mozilla_libplugin_a_OBJECTS) $(DATA_npvlc_rc) \
476                 lib/libvlc_pic.a $(L_builtin_pic) -shared $(LDFLAGS) \
477                 $(LDFLAGS_vlc) $(LDFLAGS_mozilla) $(LDFLAGS_builtin_pic)
478
479 mozilla_vlcintf_xpt_DATA = mozilla/vlcintf.xpt
480 mozilla_vlcintf_xptdir = $(libdir)/mozilla/components
481 mozilla/vlcintf.xpt: Makefile mozilla/vlcintf.idl
482         $(XPIDL) -I/usr/share/idl/mozilla -m typelib \
483                 -o mozilla/vlcintf mozilla/vlcintf.idl
484
485 mozilla/vlcintf.h: Makefile mozilla/vlcintf.idl
486         $(XPIDL) -I/usr/share/idl/mozilla -m header \
487                 -o mozilla/vlcintf mozilla/vlcintf.idl
488
489 if HAVE_WIN32
490 DATA_npvlc_rc = $(noinst_mozilla_npvlc_rc_DATA)
491 noinst_mozilla_npvlc_rc_DATA = mozilla/npvlc_rc.$(OBJEXT)
492 noinst_mozilla_npvlc_rcdir = $(libdir)
493 mozilla/npvlc_rc.$(OBJEXT): mozilla/npvlc_rc.rc
494         $(WINDRES) -i $< -o $@
495 endif
496 endif
497
498 ###############################################################################
499 # Modules
500 ###############################################################################
501 MOSTLYCLEANFILES += $(PLUGIN_FILES)
502 PLUGIN_FILES =
503
504 libvlcdir = $(libdir)/vlc
505
506 include Modules.am
507
508 ###############################################################################
509 # Force rule
510 ###############################################################################
511 FORCE: