]> git.sesse.net Git - vlc/blob - mozilla/Makefile.am
Make Mozilla plugin scriptable (e.g. so that the Javascript 'onclick'
[vlc] / mozilla / Makefile.am
1 ###############################################################################
2 # Building the Mozilla plugin
3 ###############################################################################
4
5 noinst_LIBRARIES = $(noinst_LIBRARIES_mozilla)
6                                              
7 MOSTLYCLEANFILES = $(LIBRARIES_mozilla)
8 EXTRA_DIST = $(SOURCES_mozilla) $(DIST_rsrc) vlcintf.idl
9 BUILT_SOURCES = $(BUILT_SOURCES_mozilla)
10
11 SOURCES_mozilla = \
12         vlcshell.cpp \
13         vlcplugin.cpp \
14         vlcplugin.h \
15         vlcpeer.cpp \
16         vlcpeer.h \
17         support/classinfo.h \
18         $(SOURCES_win32) \
19         $(SOURCES_macosx) \
20         $(SOURCES_unix) \
21         $(NULL)
22
23 DIST_rsrc = \
24         npvlc_rc.rc \
25         $(NULL)
26
27 # Under Win32, Mozilla plugins need to be named NP******.DLL, but under Unix
28 # the common naming scheme is lib******plugin.so. Also, we need npwin.cpp
29 # under Win32 and npunix.c under Unix.
30 if HAVE_WIN32
31 LIBRARIES_mozilla = npvlc$(LIBEXT)
32 SOURCES_win32 = support/npwin.cpp
33 CPPFLAGS_mozilla_EXTRA = -DXP_WIN -DXP_WIN32
34 LIBRARIES_libvlc = $(top_builddir)/lib/libvlc.a
35 else
36 if HAVE_DARWIN
37 # We don't define LIBRARIES_mozilla because we'll be using project builder, or not...
38 BUNDLE_mozilla = VLC\ Plugin.plugin
39
40 vlc_moz_FLAGS = `$(VLC_CONFIG) --libs vlc builtin pic mozilla`
41 moz_CFLAGS = `$(MOZILLA_CONFIG) --cflags plugin java nspr/obsolete nspr oji xpcom xpconnect`
42 moz_plugin_FLAGS = -I$(srcdir)/../include -c -F/System/Library/Frameworks/CoreFoundation.framework $(moz_CFLAGS) -I/Developer/Headers/FlatCarbon -arch ppc -fno-common -fpascal-strings -O0 -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -DXP_MACOSX=1 -DNO_X11=1 -DUSE_SYSTEM_CONSOLE=1 -pipe -fmessage-length=0 -g -include mozilla-config.h
43 pic = pic
44 LIBRARIES_libvlc = $(top_builddir)/lib/libvlc_pic.a
45
46 else
47 LIBRARIES_mozilla = libvlcplugin$(LIBEXT)
48 SOURCES_unix = support/npunix.c
49 pic = pic
50 LIBRARIES_libvlc = $(top_builddir)/lib/libvlc_pic.a
51 endif
52 endif
53
54 if BUILD_MOZILLA
55 if UNTRUE
56 noinst_LIBRARIES_mozilla = libplugin.a
57 endif
58
59 libplugin_a_SOURCES = $(SOURCES_mozilla)
60 libplugin_a_CFLAGS = `$(VLC_CONFIG) --cflags mozilla $(pic)` \
61                      $(CPPFLAGS_mozilla_EXTRA) -Imozilla
62 libplugin_a_CXXFLAGS = `$(VLC_CONFIG) --cxxflags mozilla $(pic)` \
63                        $(CPPFLAGS_mozilla_EXTRA) -Imozilla
64 libplugin_a_DEPENDENCIES = $(DATA_npvlc_rc)
65
66 BUILT_SOURCES_mozilla = vlcintf.h
67 $(SOURCES_mozilla): vlcintf.h
68
69 plugin_DATA = $(LIBRARIES_mozilla) $(BUNDLE_mozilla)
70 plugindir = $(libdir)/mozilla/plugins
71 $(LIBRARIES_mozilla): $(libplugin_a_OBJECTS) \
72                       $(libplugin_a_DEPENDENCIES) stamp-pic
73         $(CXXLINK) $(libplugin_a_OBJECTS) $(DATA_npvlc_rc) \
74           $(LIBRARIES_libvlc) -shared \
75           `$(VLC_CONFIG) --libs vlc mozilla builtin $(pic)`
76
77 vlcintf_xpt_DATA = vlcintf.xpt
78 vlcintf_xptdir = $(libdir)/mozilla/components
79 vlcintf.xpt: vlcintf.idl
80         $(XPIDL) $(XPIDL_INCL) -I/usr/share/idl/mozilla \
81           -I/usr/lib/mozilla/include/idl \
82           -m typelib -o vlcintf $(srcdir)/vlcintf.idl
83
84 vlcintf.h: vlcintf.idl
85         $(XPIDL) $(XPIDL_INCL) -I/usr/share/idl/mozilla \
86           -I/usr/lib/mozilla/include/idl \
87           -m header -o vlcintf $(srcdir)/vlcintf.idl
88
89 if HAVE_WIN32
90 DATA_npvlc_rc = $(noinst_npvlc_rc_DATA)
91 noinst_npvlc_rc_DATA = npvlc_rc.$(OBJEXT)
92 noinst_npvlc_rcdir = $(libdir)
93 npvlc_rc.$(OBJEXT): npvlc_rc.rc
94         $(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 $(srcdir) -i $< -o $@
95 endif
96 if HAVE_DARWIN
97 VLC\ Plugin.plugin:
98         rm -rf $(srcdir)/VLC\ Plugin.plugin
99         mkdir -p $(srcdir)/VLC\ Plugin.plugin/Contents/MacOS
100         mkdir -p $(srcdir)/VLC\ Plugin.plugin/Contents/Resources
101         /usr/bin/g++3 $(moz_plugin_FLAGS) $(srcdir)/vlcplugin.cpp -o $(srcdir)/libplugin_a-vlcplugin.o
102         /usr/bin/g++3 $(moz_plugin_FLAGS) $(srcdir)/vlcshell.cpp -o $(srcdir)/libplugin_a-vlcshell.o
103         /usr/bin/g++3 $(moz_plugin_FLAGS) $(srcdir)/vlcpeer.cpp -o $(srcdir)/libplugin_a-vlcpeer.o
104         /usr/bin/g++3 $(moz_plugin_FLAGS) $(srcdir)/support/npmac.cpp -o $(srcdir)/libplugin_a-npmac.o
105         /usr/bin/g++3 $(srcdir)/libplugin_a-vlcplugin.o $(srcdir)/libplugin_a-vlcshell.o $(srcdir)/libplugin_a-vlcpeer.o $(srcdir)/libplugin_a-npmac.o -o $(srcdir)/VLC\ Plugin.plugin/Contents/MacOS/VLC\ Plugin -L/usr/lib -F/System/Library/Frameworks/CoreFoundation.framework -framework CoreFoundation -arch ppc -bundle -read_only_relocs suppress $(LIBRARIES_libvlc) -dylib $(vlc_moz_FLAGS)
106         cp $(top_srcdir)/extras/MacOSX/plugin/Info.plist $(srcdir)/VLC\ Plugin.plugin/Contents/Info.plist
107         cp $(top_srcdir)/extras/MacOSX/plugin/pbdevelopment.plist $(srcdir)/VLC\ Plugin.plugin/Contents/pbdevelopment.plist
108         cp -r $(top_srcdir)/extras/MacOSX/plugin/English.lproj $(srcdir)/VLC\ Plugin.plugin/Contents/Resources/
109         Rez /Developer/Headers/FlatCarbon/Types.r $(srcdir)/vlc.r -o $(srcdir)/VLC\ Plugin.plugin/Contents/Resources/Vlc\ Plugin.rsrc
110         mkdir $(srcdir)/VLC\ Plugin.plugin/Contents/MacOS/modules
111         cp -r $(top_srcdir)/VLC.app/Contents/MacOS/modules/* $(srcdir)/VLC\ Plugin.plugin/Contents/MacOS/modules/
112 endif
113 endif
114
115 ###############################################################################
116 # Stamp rules
117 ###############################################################################
118 clean: clean-stamp clean-bundle
119 clean-stamp:
120         rm -f stamp-pic
121
122 stamp-pic: FORCE
123         @for dep in "" `$(VLC_CONFIG) --target builtin $(pic)`; do \
124           if test "$${dep}" -nt "$(LIBRARIES_mozilla)"; then \
125             rm -f $@; \
126             break; \
127           fi; \
128         done
129         @if test ! -f $@; then printf "" > $@; fi
130
131 clean-bundle:
132         rm -rf $(srcdir)/VLC\ Plugin.plugin
133
134 ###############################################################################
135 # Force rule
136 ###############################################################################
137 FORCE: