* Makefile.am:
[vlc.git] / Makefile.am
1 ###############################################################################
2 # Automake targets and declarations
3 ###############################################################################
4
5 NULL =
6
7 # SUBDIRS stores the directories where a "make" is required when building
8 # something. DIST_SUBDIRS stores the directories where nothing is built but
9 # which have makefiles with distribution information.
10 SUBDIRS = intl modules . share po m4
11 DIST_SUBDIRS = $(SUBDIRS) src debian doc ipkg lib autotools
12
13 EXTRA_DIST = \
14         HACKING \
15         INSTALL.win32 \
16         MAINTAINERS \
17         README.MacOSX.rtf \
18         bootstrap \
19         install-win32 \
20         src/extras/COPYING \
21         toolbox \
22         vlc-config.in.in \
23         vlc.ebuild \
24         vlc.spec \
25         vlc.spec.redhat \
26         $(NULL)
27
28 BUILT_SOURCES =
29 SUFFIXES = 
30
31 # Tell aclocal to use -I m4. Wonder if it really works.
32 ACLOCAL_AMFLAGS = -I m4
33
34 # XXX: these flags could be set in configure.ac, but we set them here
35 # because old versions of automake don't support them in configure.ac.
36 AUTOMAKE_OPTIONS = dist-bzip2 subdir-objects
37
38 ###############################################################################
39 # Headers
40 ###############################################################################
41
42 BUILT_SOURCES += \
43         include/vlc_symbols.h \
44         src/misc/modules_builtin.h \
45         src/misc/modules_plugin.h \
46         $(NULL)
47
48 pkgincludedir = $(includedir)/vlc
49
50 dist_pkginclude_HEADERS = \
51         include/vlc/vlc.h \
52         include/vlc/aout.h \
53         include/vlc/vout.h \
54         include/vlc/sout.h \
55         include/vlc/decoder.h \
56         include/vlc/input.h \
57         include/vlc/intf.h \
58         $(NULL)
59
60 noinst_HEADERS = $(HEADERS_include) $(HEADERS_include_built)
61
62 HEADERS_include = \
63         include/aout_internal.h \
64         include/audio_output.h \
65         include/beos_specific.h \
66         include/configuration.h \
67         include/darwin_specific.h \
68         include/codecs.h \
69         include/encoder.h \
70         include/input_ext-dec.h \
71         include/input_ext-intf.h \
72         include/input_ext-plugins.h \
73         include/intf_eject.h \
74         include/iso_lang.h \
75         include/httpd.h \
76         include/main.h \
77         include/mmx.h \
78         include/modules.h \
79         include/modules_inner.h \
80         include/mtime.h \
81         include/network.h \
82         include/os_specific.h \
83         include/stream_control.h \
84         include/stream_output.h \
85         include/announce.h \
86         include/variables.h \
87         include/video_output.h \
88         include/vlc_common.h \
89         include/vlc_config.h \
90         include/vlc_cpu.h \
91         include/vlc_error.h \
92         include/vlc_interface.h \
93         include/vlc_messages.h \
94         include/vlc_objects.h \
95         include/vlc_playlist.h \
96         include/vlc_threads.h \
97         include/vlc_threads_funcs.h \
98         include/vlc_video.h \
99         include/vout_synchro.h \
100         include/win32_specific.h \
101         include/osd.h \
102         $(NULL)
103
104 HEADERS_include_built = \
105         include/vlc_symbols.h \
106         $(NULL)
107
108 include/vlc_symbols.h: Makefile $(HEADERS_include)
109         $(srcdir)/toolbox --update-includes
110
111 src/misc/modules_plugin.h: Makefile src/misc/modules_plugin.h.in $(HEADERS_include)
112         $(srcdir)/toolbox --update-includes
113
114 src/misc/modules_builtin.h: Makefile src/misc/modules_builtin.h.in
115         $(srcdir)/toolbox --update-includes
116
117 # These dependencies are mandatory
118 $(SOURCES): include/vlc_symbols.h
119 $(SOURCES_libvlc): src/misc/modules_plugin.h src/misc/modules_builtin.h $(LIB_intl)
120
121 ###############################################################################
122 # Optional libintl - FIXME, bad dependencies
123 ###############################################################################
124
125 intl/libintl.a: FORCE
126         cd $(top_builddir)/intl && $(MAKE) $(AM_MAKEFLAGS)
127
128 if BUILD_INTL
129 LIB_intl = intl/libintl.a
130 endif
131
132 ###############################################################################
133 # MacOS X project
134 ###############################################################################
135
136 EXTRA_DIST += \
137         extras/MacOSX/Resources/English.lproj/MainMenu.nib/classes.nib \
138         extras/MacOSX/Resources/English.lproj/MainMenu.nib/info.nib \
139         extras/MacOSX/Resources/English.lproj/MainMenu.nib/objects.nib \
140         extras/MacOSX/Resources/English.lproj/InfoPlist.strings \
141         extras/MacOSX/Resources/English.lproj/vlc.scriptTerminology \
142         extras/MacOSX/Resources/a52.icns \
143         extras/MacOSX/Resources/aac.icns \
144         extras/MacOSX/Resources/asf.icns \
145         extras/MacOSX/Resources/asx.icns \
146         extras/MacOSX/Resources/avi.icns \
147         extras/MacOSX/Resources/bin.icns \
148         extras/MacOSX/Resources/cue.icns \
149         extras/MacOSX/Resources/dat.icns \
150         extras/MacOSX/Resources/divx.icns \
151         extras/MacOSX/Resources/dv.icns \
152         extras/MacOSX/Resources/generic.icns \
153         extras/MacOSX/Resources/m3u.icns \
154         extras/MacOSX/Resources/mov.icns \
155         extras/MacOSX/Resources/mp3.icns \
156         extras/MacOSX/Resources/mp4.icns \
157         extras/MacOSX/Resources/mpeg.icns \
158         extras/MacOSX/Resources/mpeg1.icns \
159         extras/MacOSX/Resources/mpeg2.icns \
160         extras/MacOSX/Resources/mpeg4.icns \
161         extras/MacOSX/Resources/mpg.icns \
162         extras/MacOSX/Resources/ogg.icns \
163         extras/MacOSX/Resources/ogm.icns \
164         extras/MacOSX/Resources/pls.icns \
165         extras/MacOSX/Resources/srt.icns \
166         extras/MacOSX/Resources/sub.icns \
167         extras/MacOSX/Resources/vlc.icns \
168         extras/MacOSX/Resources/vob.icns \
169         extras/MacOSX/Resources/wma.icns \
170         extras/MacOSX/Resources/wmv.icns \
171         extras/MacOSX/Resources/back.png \
172         extras/MacOSX/Resources/begin.png \
173         extras/MacOSX/Resources/end.png \
174         extras/MacOSX/Resources/forw.png \
175         extras/MacOSX/Resources/list.png \
176         extras/MacOSX/Resources/pause.png \
177         extras/MacOSX/Resources/play.png \
178         extras/MacOSX/Resources/prefs.png \
179         extras/MacOSX/Resources/slow.png \
180         extras/MacOSX/Resources/stop.png \
181         extras/MacOSX/Resources/vlc_hg.png \
182         extras/MacOSX/Resources/about_bg.png \
183         extras/MacOSX/Resources/vlc.scriptSuite \
184         extras/MacOSX/Resources/README \
185         extras/MacOSX/vlc.pbproj/project.pbxproj \
186         extras/MacOSX/macosx-dmg \
187         $(NULL)
188
189 ###############################################################################
190 # MS Visual Studio and eMbedded Visual Studio projects
191 ###############################################################################
192
193 EXTRA_DIST += \
194         msvc/vlc.dsw \
195         msvc/libvlc.dsp.in \
196         msvc/plugins.dsp.in \
197         msvc/vlc.dsp.in \
198         msvc/config.h.in \
199         msvc/modules_builtin_msvc.h \
200         evc/vlc.vcw \
201         evc/libvlc.vcp.in \
202         evc/vlc.vcp.in \
203         evc/plugins.vcp.in \
204         evc/vlc.c \
205         evc/config.h.in \
206         evc/modules_builtin_evc.h \
207         $(NULL)
208
209 dist-hook:
210         mv $(distdir)/vlc.ebuild $(distdir)/vlc-${VERSION}.ebuild
211         cd $(distdir) && $(srcdir)/toolbox --update-vc
212
213 ###############################################################################
214 # Building libvlc
215 ###############################################################################
216
217 bin_SCRIPTS = vlc-config
218
219 lib_LIBRARIES = lib/libvlc.a $(LIBRARIES_libvlc_pic)
220
221 lib_libvlc_a_SOURCES = $(SOURCES_libvlc)
222 dist_lib_libvlc_a_SOURCES = src/misc/modules_plugin.h
223 lib_libvlc_a_CFLAGS = `$(VLC_CONFIG) --cflags vlc`
224 lib_libvlc_a_CXXFLAGS = `$(VLC_CONFIG) --cxxflags vlc`
225 lib_libvlc_a_OBJCFLAGS = `$(VLC_CONFIG) --objcflags vlc`
226
227 lib_libvlc_pic_a_SOURCES = $(SOURCES_libvlc)
228 lib_libvlc_pic_a_CFLAGS = `$(VLC_CONFIG) --cflags vlc pic`
229 lib_libvlc_pic_a_CXXFLAGS = `$(VLC_CONFIG) --cxxflags vlc pic`
230 lib_libvlc_pic_a_OBJCFLAGS = `$(VLC_CONFIG) --objcflags vlc pic`
231
232 if HAVE_BEOS
233 OPT_SOURCES_libvlc_beos = $(SOURCES_libvlc_beos)
234 endif
235 if HAVE_DARWIN
236 OPT_SOURCES_libvlc_darwin = $(SOURCES_libvlc_darwin)
237 endif
238 if HAVE_WIN32
239 OPT_SOURCES_libvlc_win32 = $(SOURCES_libvlc_win32)
240 endif
241 if BUILD_DIRENT
242 OPT_SOURCES_libvlc_dirent = $(SOURCES_libvlc_dirent)
243 endif
244 if BUILD_GETOPT
245 OPT_SOURCES_libvlc_getopt = $(SOURCES_libvlc_getopt)
246 endif
247 if BUILD_MOZILLA
248 LIBRARIES_libvlc_pic = lib/libvlc_pic.a
249 endif
250
251 EXTRA_DIST += \
252         $(SOURCES_libvlc_beos) \
253         $(SOURCES_libvlc_darwin) \
254         $(SOURCES_libvlc_win32) \
255         $(SOURCES_libvlc_dirent) \
256         $(SOURCES_libvlc_getopt) \
257         $(NULL)
258
259 SOURCES_libvlc_beos = \
260         src/misc/beos_specific.cpp \
261         $(NULL)
262
263 SOURCES_libvlc_darwin = \
264         src/misc/darwin_specific.m \
265         $(NULL)
266
267 SOURCES_libvlc_win32 = \
268         src/misc/win32_specific.c \
269         $(NULL)
270
271 SOURCES_libvlc_dirent = \
272         src/extras/dirent.c \
273         src/extras/dirent.h \
274         $(NULL)
275
276 SOURCES_libvlc_getopt = \
277         src/extras/getopt.c \
278         src/extras/getopt.h \
279         src/extras/getopt1.c \
280         $(NULL)
281
282 SOURCES_libvlc_common = \
283         src/libvlc.c \
284         src/libvlc.h \
285         src/interface/interface.c \
286         src/interface/intf_eject.c \
287         src/playlist/playlist.c \
288         src/input/input.c \
289         src/input/input_ext-plugins.c \
290         src/input/input_ext-dec.c \
291         src/input/input_ext-intf.c \
292         src/input/input_dec.c \
293         src/input/input_programs.c \
294         src/input/input_clock.c \
295         src/input/input_info.c \
296         src/video_output/video_output.c \
297         src/video_output/vout_pictures.c \
298         src/video_output/vout_pictures.h \
299         src/video_output/video_text.c \
300         src/video_output/video_text.h \
301         src/video_output/vout_subpictures.c \
302         src/video_output/vout_synchro.c \
303         src/audio_output/common.c \
304         src/audio_output/dec.c \
305         src/audio_output/filters.c \
306         src/audio_output/input.c \
307         src/audio_output/mixer.c \
308         src/audio_output/output.c \
309         src/audio_output/intf.c \
310         src/stream_output/stream_output.c \
311         src/stream_output/announce.c \
312         src/misc/mtime.c \
313         src/misc/modules.c \
314         src/misc/threads.c \
315         src/misc/cpu.c \
316         src/misc/configuration.c \
317         src/misc/iso_lang.c \
318         src/misc/iso-639_def.h \
319         src/misc/messages.c \
320         src/misc/objects.c \
321         src/misc/variables.c \
322         src/misc/error.c \
323         src/extras/libc.c \
324         $(NULL)
325
326 SOURCES_libvlc = \
327         $(SOURCES_libvlc_common) \
328         $(OPT_SOURCES_libvlc_beos) \
329         $(OPT_SOURCES_libvlc_darwin) \
330         $(OPT_SOURCES_libvlc_win32) \
331         $(OPT_SOURCES_libvlc_dirent) \
332         $(OPT_SOURCES_libvlc_getopt) \
333         $(NULL)
334
335 ###############################################################################
336 # Building vlc
337 ###############################################################################
338
339 bin_PROGRAMS = vlc
340
341 vlc_SOURCES = src/vlc.c
342
343 vlc_LDFLAGS = `$(VLC_CONFIG) --libs vlc builtin`
344 vlc_LDADD = lib/libvlc.a $(DATA_win32_rc) $(LIB_intl)
345 vlc_CFLAGS = `$(VLC_CONFIG) --cflags vlc`
346
347 # We use DEPENDENCIES_vlc instead of vlc_DEPENDENCIES because of an
348 # old automake-1.5 bug (automake/279).
349 DEPENDENCIES_vlc = lib/libvlc.a $(DATA_win32_rc) $(LIB_intl)
350
351 vlc$(EXEEXT): $(vlc_OBJECTS) $(DEPENDENCIES_vlc) stamp-builtin
352         @rm -f $(top_builddir)/vlc$(EXEEXT)
353         case `$(VLC_CONFIG) --linkage vlc builtin` in \
354           c++) $(CXXLINK) $(vlc_OBJECTS) $(vlc_LDADD) $(vlc_LDFLAGS) $(LIBS) ;; \
355           objc) $(OBJCLINK) $(vlc_OBJECTS) $(vlc_LDADD) $(vlc_LDFLAGS) $(LIBS) ;; \
356           c|*) $(LINK) $(vlc_OBJECTS) $(vlc_LDADD) $(vlc_LDFLAGS) $(LIBS) ;; \
357         esac
358
359 if HAVE_BEOS
360         xres -o $@ $(srcdir)/share/vlc_beos.rsrc
361         mimeset -f $@
362         rm -Rf $(srcdir)/locale ; mkdir -p "$(srcdir)/locale"
363         for i in $(ALL_LINGUAS); do \
364           mkdir -p "$(srcdir)/locale/$${i}/LC_MESSAGES" ; \
365           cp "$(srcdir)/po/$${i}.gmo" \
366             "$(srcdir)/locale/$${i}/LC_MESSAGES/vlc.mo" || true ; \
367         done
368 endif
369
370 # Install the modules and the symlinks
371 install-exec-local:
372         for i in "" `$(VLC_CONFIG) --target plugin` ; do if test -n "$$i" ; then \
373           $(INSTALL) -m 755 "$$i$(LIBEXT)" "$(DESTDIR)$(libdir)/vlc/`echo $$i | cut -f1 -d/`" ; \
374         fi ; done
375         for i in "" `$(VLC_CONFIG) --target builtin` `$(VLC_CONFIG) --target builtin pic` ; do if test -n "$$i" ; then \
376           $(INSTALL) -m 644 "$$i" "$(DESTDIR)$(libdir)/vlc" ; \
377         fi ; done
378         for i in "" $(ALIASES) ; do if test -n "$$i" ; then \
379           rm -f "$(DESTDIR)$(bindir)/$$i" && \
380           ln -s vlc "$(DESTDIR)$(bindir)/$$i" ; \
381         fi ; done
382
383 if HAVE_DARWIN
384 # Create the MacOS X app
385 vlc_app_DATA = VLC.app
386 vlc_appdir = $(bindir)
387 VLC.app: vlc
388         rm -Rf VLC.app
389         cd $(srcdir)/extras/MacOSX && pbxbuild -target vlc | grep -v '^\([ \t]\|$$\)'
390         cp -r $(srcdir)/extras/MacOSX/build/vlc.bundle $(srcdir)/VLC.app
391         $(INSTALL) -d $(srcdir)/VLC.app/Contents/MacOS
392         $(INSTALL) vlc $(srcdir)/VLC.app/Contents/MacOS/VLC
393         $(INSTALL) -d $(srcdir)/VLC.app/Contents/MacOS/modules
394         for i in "" `$(VLC_CONFIG) --target plugin` ; do \
395           if test -n "$$i" ; then $(INSTALL) "$(srcdir)/$$i$(LIBEXT)" \
396             "$(srcdir)/VLC.app/Contents/MacOS/modules" ; \
397           fi ; done
398         $(INSTALL) -d $(srcdir)/VLC.app/Contents/MacOS/share
399         $(INSTALL) -m 644 $(srcdir)/share/*.psf $(srcdir)/share/*.rle \
400           $(srcdir)/VLC.app/Contents/MacOS/share
401         $(INSTALL) -d $(srcdir)/VLC.app/Contents/MacOS/locale
402         for i in $(ALL_LINGUAS); do \
403           mkdir -p $(srcdir)/VLC.app/Contents/MacOS/locale/$${i}/LC_MESSAGES ; \
404           cp $(srcdir)/po/$${i}.gmo $(srcdir)/VLC.app/Contents/MacOS/locale/$${i}/LC_MESSAGES/vlc.mo || true ; \
405           mkdir -p $(srcdir)/VLC.app/Contents/Resources/$${i}.lproj ; \
406           ln -sf ../English.lproj/InfoPlist.strings $(srcdir)/VLC.app/Contents/Resources/$${i}.lproj ; \
407           ln -sf ../English.lproj/MainMenu.nib $(srcdir)/VLC.app/Contents/Resources/$${i}.lproj ; \
408           ln -sf ../English.lproj/vlc.scriptTerminology $(srcdir)/VLC.app/Contents/Resources/$${i}.lproj ; \
409         done
410         printf "APPLVLC#" >| $(srcdir)/VLC.app/Contents/PkgInfo
411 endif
412
413 if HAVE_WIN32
414 DATA_win32_rc = $(noinst_share_vlc_win32_rc_DATA)
415 noinst_share_vlc_win32_rc_DATA = share/vlc_win32_rc.$(OBJEXT)
416 noinst_share_vlc_win32_rcdir = $(libdir)
417 share/vlc_win32_rc.$(OBJEXT): share/vlc_win32_rc.rc
418         $(WINDRES) --include-dir $(srcdir)/share -i $< -o $@
419 endif
420
421 ###############################################################################
422 # Building architecture-specific binary packages
423 ###############################################################################
424
425 # XXX: this rule is probably only useful to you if you have exactly
426 # the same setup as me. Contact sam@zoy.org if you need to use it.
427 #
428 # Check that tmp isn't in the way
429 package-win32:
430         @if test -e "$(srcdir)/tmp"; then \
431           echo "Error: please remove $(srcdir)/tmp, it is in the way"; \
432           false; \
433         else \
434           echo "OK."; mkdir -p "$(srcdir)/tmp"; \
435         fi
436 # Create installation script
437         cp "$(srcdir)/install-win32" "$(srcdir)/tmp/nsi"
438 # Copy relevant files
439         cp "$(top_builddir)/vlc$(EXEEXT)" "$(srcdir)/tmp/"
440         $(STRIP) "$(srcdir)/tmp/vlc$(EXEEXT)"
441         cp "$(srcdir)/INSTALL.win32" "$(srcdir)/tmp/INSTALL.txt"
442         unix2dos "$(srcdir)/tmp/INSTALL.txt"
443         for file in AUTHORS MAINTAINERS THANKS NEWS COPYING README ; \
444           do cp "$(srcdir)/$$file" "$(srcdir)/tmp/$${file}.txt" ; \
445           unix2dos "$(srcdir)/tmp/$${file}.txt" ; done
446
447         mkdir -p "$(srcdir)/tmp/plugins"
448         for i in "" `$(VLC_CONFIG) --target plugin` ; do \
449           if test -n "$$i" ; then \
450             $(INSTALL) "$(srcdir)/$$i$(LIBEXT)" "$(srcdir)/tmp/plugins/" ; \
451           fi ; done
452
453         for i in "" $(srcdir)/tmp/plugins/*$(LIBEXT) ; \
454           do if test -n "$$i" ; then $(STRIP) "$$i" ; fi ; done
455
456         mkdir -p "$(srcdir)/tmp/share"
457         cp $(srcdir)/share/*.rle $(srcdir)/tmp/share/ ;
458
459         mkdir $(srcdir)/tmp/locale
460         for i in $(ALL_LINGUAS); do \
461           mkdir -p "$(srcdir)/tmp/locale/$${i}/LC_MESSAGES" ; \
462           cp "$(srcdir)/po/$${i}.gmo" \
463             "$(srcdir)/tmp/locale/$${i}/LC_MESSAGES/vlc.mo" || true ; \
464         done
465
466         mkdir -p $(srcdir)/tmp/skins/default
467         for i in $(srcdir)/share/skins/default/*.*; do \
468           cp $$i $(srcdir)/tmp/skins/default/ || true ; \
469         done
470         for i in $(srcdir)/doc/skins/*.txt; do \
471           cp $$i $(srcdir)/tmp/skins/ || true ; \
472         done
473
474 # Create package 
475         wine ~/.wine/fake_windows/Program\ Files/NSIS/makensis.exe -- /DVERSION=${VERSION} $(srcdir)/tmp/nsi
476 # Clean up
477         rm -Rf $(srcdir)/tmp
478
479 package-beos:
480 # Check that tmp isn't in the way
481         @if test -e $(srcdir)/tmp; then \
482           echo "Error: please remove $(srcdir)/tmp, it is in the way"; \
483           false; \
484         else \
485           echo "OK."; mkdir $(srcdir)/tmp; \
486         fi
487
488 # Copy relevant files
489         mkdir -p $(srcdir)/tmp/vlc
490         cd $(srcdir) && \
491           cp vlc AUTHORS COPYING ChangeLog README THANKS NEWS tmp/vlc/
492 # We cannot use ${PLUGIN_FILES}, it looks like it is too long for the BeOS shell...
493         if [ `find $(srcdir)/modules -name "lib*_plugin.so" | wc -l` -gt 0 ]; then \
494           mkdir -p $(srcdir)/tmp/vlc/plugins; \
495           find $(srcdir)/modules -name "lib*_plugin.so" | xargs -i{} cp {} $(srcdir)/tmp/vlc/plugins/; \
496         fi
497         for i in $(ALL_LINGUAS); do \
498           mkdir -p $(srcdir)/tmp/vlc/locale/$${i}/LC_MESSAGES ; \
499           cp $(srcdir)/po/$${i}.gmo $(srcdir)/tmp/vlc/locale/$${i}/LC_MESSAGES/vlc.mo || true ; \
500         done
501         mkdir -p $(srcdir)/tmp/vlc/share
502         cp $(srcdir)/share/*.rle $(srcdir)/tmp/vlc/share/
503
504 # Create package with debug symbols
505         mimeset -f $(srcdir)/tmp/vlc/* $(srcdir)/tmp/vlc/*/*
506         mv $(srcdir)/tmp/vlc $(srcdir)/tmp/vlc-${VERSION}
507         (cd $(srcdir)/tmp ; zip -9 -r vlc-${VERSION}-BeOS-debug.zip vlc-${VERSION} )
508         mv $(srcdir)/tmp/vlc-${VERSION}-BeOS-debug.zip $(srcdir)/
509
510 # Create package without debug symbols
511         strip $(srcdir)/tmp/vlc-${VERSION}/vlc
512         if [ -d $(srcdir)/tmp/vlc-${VERSION}/plugins ]; then \
513           strip $(srcdir)/tmp/vlc-${VERSION}/plugins/lib*_plugin.so; \
514         fi
515         xres -o $(srcdir)/tmp/vlc-${VERSION}/vlc $(srcdir)/share/vlc_beos.rsrc
516         mimeset -f $(srcdir)/tmp/vlc-${VERSION}/* $(srcdir)/tmp/vlc-${VERSION}/*/*
517         (cd $(srcdir)/tmp ; zip -9 -r vlc-${VERSION}-BeOS.zip vlc-${VERSION} )
518         mv $(srcdir)/tmp/vlc-${VERSION}-BeOS.zip $(srcdir)/
519
520 # Clean up
521         rm -Rf $(srcdir)/tmp
522
523 package-macosx:
524 # Check that tmp isn't in the way
525         @if test -e "$(srcdir)/tmp"; then \
526           echo "Error: please remove $(srcdir)/tmp, it is in the way"; \
527           false; \
528         else \
529           echo "OK."; mkdir -p "$(srcdir)/tmp"; \
530         fi
531
532 # Copy relevant files 
533         cp -R "$(srcdir)/VLC.app" "$(srcdir)/tmp/"
534         cd "$(srcdir)" && cp AUTHORS COPYING ChangeLog README README.MacOSX.rtf THANKS NEWS tmp/
535
536 # Create disk image 
537         $(srcdir)/extras/MacOSX/macosx-dmg 18 "vlc-${VERSION}" $(srcdir)/tmp/* 
538
539 # Clean up
540         rm -Rf $(srcdir)/tmp
541
542 ###############################################################################
543 # Building the Mozilla plugin
544 ###############################################################################
545
546 noinst_LIBRARIES = $(noinst_LIBRARIES_mozilla)
547
548 MOSTLYCLEANFILES = $(LIBRARIES_mozilla)
549
550 EXTRA_DIST += $(SOURCES_mozilla) mozilla/vlcintf.idl
551
552 BUILT_SOURCES += $(BUILT_SOURCES_mozilla)
553
554 SOURCES_mozilla = \
555         mozilla/vlcshell.cpp \
556         mozilla/vlcplugin.cpp \
557         mozilla/vlcplugin.h \
558         mozilla/vlcpeer.cpp \
559         mozilla/vlcpeer.h \
560         mozilla/support/classinfo.h \
561         $(SOURCES_mozilla_win32) \
562         $(SOURCES_mozilla_macosx) \
563         $(SOURCES_mozilla_unix) \
564         $(NULL)
565
566 # Under Win32, Mozilla plugins need to be named NP******.DLL, but under Unix
567 # the common naming scheme is lib******plugin.so. Also, we need npwin.cpp
568 # under Win32 and npunix.c under Unix.
569 if HAVE_WIN32
570 LIBRARIES_mozilla = mozilla/npvlc$(LIBEXT)
571 SOURCES_mozilla_win32 = mozilla/support/npwin.cpp
572 CPPFLAGS_mozilla_EXTRA = -DXP_WIN -DXP_WIN32
573 else
574 if HAVE_DARWIN
575 # We don't define LIBRARIES_mozilla because we'll be using project builder
576 SOURCES_mozilla_macosx = mozilla/support/npmac.cpp
577 else
578 LIBRARIES_mozilla = mozilla/libvlcplugin$(LIBEXT)
579 SOURCES_mozilla_unix = mozilla/support/npunix.c
580 endif
581 endif
582
583 if BUILD_MOZILLA
584 if UNTRUE
585 noinst_LIBRARIES_mozilla = mozilla/libplugin.a
586 endif
587
588 mozilla_libplugin_a_SOURCES = $(SOURCES_mozilla)
589 mozilla_libplugin_a_CFLAGS = `$(VLC_CONFIG) --cflags mozilla pic` \
590                              $(CPPFLAGS_mozilla_EXTRA) -Imozilla
591 mozilla_libplugin_a_CXXFLAGS = `$(VLC_CONFIG) --cxxflags mozilla pic` \
592                                $(CPPFLAGS_mozilla_EXTRA) -Imozilla
593 mozilla_libplugin_a_DEPENDENCIES = lib/libvlc_pic.a $(DATA_npvlc_rc)
594
595 BUILT_SOURCES_mozilla = mozilla/vlcintf.h
596 $(SOURCES_mozilla): mozilla/vlcintf.h
597
598 mozilla_plugin_DATA = $(LIBRARIES_mozilla)
599 mozilla_plugindir = $(libdir)/mozilla/plugins
600 $(LIBRARIES_mozilla): $(mozilla_libplugin_a_OBJECTS) \
601                       $(mozilla_libplugin_a_DEPENDENCIES) stamp-pic
602         $(CXXLINK) $(mozilla_libplugin_a_OBJECTS) $(DATA_npvlc_rc) \
603           lib/libvlc_pic.a -shared \
604           `$(VLC_CONFIG) --libs vlc mozilla builtin pic`
605
606 mozilla_vlcintf_xpt_DATA = mozilla/vlcintf.xpt
607 mozilla_vlcintf_xptdir = $(libdir)/mozilla/components
608 mozilla/vlcintf.xpt: mozilla/vlcintf.idl
609         $(XPIDL) -I/usr/share/idl/mozilla -m typelib \
610           -o mozilla/vlcintf $(srcdir)/mozilla/vlcintf.idl
611
612 mozilla/vlcintf.h: mozilla/vlcintf.idl
613         $(XPIDL) -I/usr/share/idl/mozilla -m header \
614           -o mozilla/vlcintf $(srcdir)/mozilla/vlcintf.idl
615
616 if HAVE_WIN32
617 DATA_npvlc_rc = $(noinst_mozilla_npvlc_rc_DATA)
618 noinst_mozilla_npvlc_rc_DATA = mozilla/npvlc_rc.$(OBJEXT)
619 noinst_mozilla_npvlc_rcdir = $(libdir)
620 mozilla/npvlc_rc.$(OBJEXT): mozilla/npvlc_rc.rc
621         $(WINDRES) --include-dir $(srcdir)/mozilla -i $< -o $@
622 endif
623 endif
624
625 ###############################################################################
626 # Stamp rules
627 ###############################################################################
628 clean: clean-stamps
629 clean-stamp:
630         rm -f stamp-builtin stamp-pic
631
632 stamp-builtin: FORCE
633         @for dep in "" `$(VLC_CONFIG) --target builtin`; do \
634           if test "$${dep}" -nt "$(top_builddir)/vlc$(EXEEXT)"; then \
635             rm -f $@; \
636             break; \
637           fi; \
638         done
639         @if test ! -f $@; then printf "" > $@; fi
640
641 stamp-pic: FORCE
642         @for dep in "" `$(VLC_CONFIG) --target builtin pic`; do \
643           if test "$${dep}" -nt "$(LIBRARIES_mozilla)"; then \
644             rm -f $@; \
645             break; \
646           fi; \
647         done
648         @if test ! -f $@; then printf "" > $@; fi
649
650 ###############################################################################
651 # Force rule
652 ###############################################################################
653 FORCE: