all: updated mozilla MacOS X bundle, Safari can 'see' it now (didn't run it though)
[vlc.git] / mozilla / Makefile.am
1 ###############################################################################
2 # Building the Mozilla plugin
3 ###############################################################################
4
5 noinst_LIBRARIES = $(noinst_LIBRARIES_mozilla)
6                                              
7 MOSTLYCLEANFILES = $(LIBRARIES_mozilla) $(npvlc_DATA) $(DATA_npvlc_rsrc) $(vlcintf_xpt_DATA)
8 EXTRA_DIST = $(SOURCES_mozilla) $(DIST_rsrc) $(DIST_misc)
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_support) \
19         $(NULL)
20
21 DIST_rsrc = \
22         $(SOURCES_rsrc) \
23         $(NULL)
24
25 DIST_misc = \
26         vlcintf.idl \
27         $(NULL)
28
29 if BUILD_MOZILLA
30
31 # Under Win32, Mozilla plugins need to be named NP******.DLL, but under Unix
32 # the common naming scheme is lib******plugin.so. Also, we need npwin.cpp
33 # under Win32 and npunix.c under Unix.
34 if HAVE_WIN32
35
36 LIBRARIES_libvlc = $(top_builddir)/lib/libvlc.a
37
38 npvlc_DATA = npvlc$(LIBEXT)
39 npvlcdir = $(libdir)
40
41 SOURCES_support = support/npwin.cpp
42 SOURCES_rsrc = npvlc_rc.rc
43 CPPFLAGS_mozilla_EXTRA = -DXP_WIN -DXP_WIN32
44
45 DATA_npvlc_rc = $(noinst_npvlc_rc_DATA)
46 noinst_npvlc_rc_DATA = npvlc_rc.$(OBJEXT)
47 noinst_npvlc_rcdir = $(libdir)
48 npvlc_rc.$(OBJEXT): npvlc_rc.rc
49         $(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 $@
50 LDFLAGS_npvlc = -shared $(LIBRARIES_libvlc) `$(VLC_CONFIG) --libs mozilla vlc builtin`
51
52 else
53 if HAVE_DARWIN
54
55 LIBRARIES_libvlc = $(top_builddir)/lib/libvlc.a
56
57 npvlc_DATA = npvlc$(LIBEXT)
58 npvlcdir = $(libdir)
59
60 BUNDLE_mozilla = VLC\ Plugin.plugin
61 SOURCES_support = support/npmac.cpp
62 SOURCES_rsrc = vlc.r
63
64 CPPFLAGS_mozilla_EXTRA = -I. -I$(top_builddir) -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
65
66 DATA_npvlc_rsrc = $(noinst_npvlc_rsrc_DATA)
67 noinst_npvlc_rsrc_DATA = npvlc.rsrc
68 noinst_npvlc_rsrcdir = $(libdir)
69 npvlc.rsrc: $(srcdir)/vlc.r
70         /Developer/Tools/Rez -useDF /Developer/Headers/FlatCarbon/Types.r $< -o $@
71 LDFLAGS_npvlc = -arch ppc -bundle -read_only_relocs suppress $(LIBRARIES_libvlc) -dylib `$(VLC_CONFIG) --libs mozilla vlc builtin $(pic)`
72
73 DATA_bundle = $(noinst_bundle_DATA)
74 noinst_bundle_DATA = VLC\ Plugin.plugin
75 noinst_bundledir = $(libdir)
76
77 VLC\ Plugin.plugin: npvlc.rsrc npvlc.dylib
78         rm -rf "$@"
79         mkdir -p "./$@/Contents/MacOS"
80         cp npvlc.dylib "./$@/Contents/MacOS/VLC Plugin"
81         mkdir -p ./"$@"/Contents/Resources
82         cp npvlc.rsrc "./$@/Contents/Resources/VLC Plugin.rsrc"
83         cp -r $(top_srcdir)/extras/MacOSX/plugin/English.lproj "./$@/Contents/Resources/"
84         cp $(top_srcdir)/extras/MacOSX/plugin/Info.plist "./$@/Contents/Info.plist"
85         (cd $(top_builddir)/VLC.app/Contents/MacOS/; tar cf - modules)| \
86         (cd "./$@/Contents/MacOS"; tar xf -)
87
88 else
89
90 LIBRARIES_libvlc = $(top_builddir)/lib/libvlc_pic.a
91
92 npvlc_DATA = libvlcplugin$(LIBEXT)
93 npvlcdir = $(libdir)/mozilla/plugins
94
95 SOURCES_support = support/npunix.c
96
97 LDFLAGS_npvlc = -shared $(LIBRARIES_libvlc) `$(VLC_CONFIG) --libs mozilla vlc builtin $(pic)`
98
99 endif
100 endif
101
102 noinst_LIBRARIES_mozilla = libnpvlc.a
103
104 libnpvlc_a_SOURCES = $(SOURCES_mozilla)
105 libnpvlc_a_CFLAGS = `$(VLC_CONFIG) --cflags mozilla $(pic)` \
106                      $(CPPFLAGS_mozilla_EXTRA)
107 libnpvlc_a_CXXFLAGS = `$(VLC_CONFIG) --cxxflags mozilla $(pic)` \
108                        $(CPPFLAGS_mozilla_EXTRA)
109 libnpvlc_a_DEPENDENCIES = $(DATA_npvlc_rc)
110
111 BUILT_SOURCES_mozilla = vlcintf.h
112 $(SOURCES_mozilla): vlcintf.h
113
114 $(npvlc_DATA): $(libnpvlc_a_OBJECTS) \
115                       $(libnpvlc_a_DEPENDENCIES) stamp-pic
116         $(CXXLINK) $(libnpvlc_a_OBJECTS) $(DATA_npvlc_rc) \
117          $(LDFLAGS_npvlc)
118
119 vlcintf_xpt_DATA = vlcintf.xpt
120 vlcintf_xptdir = $(libdir)/mozilla/components
121 vlcintf.xpt: vlcintf.idl
122         $(XPIDL) $(XPIDL_INCL) \
123           -m typelib -o vlcintf $(srcdir)/vlcintf.idl
124
125 vlcintf.h: vlcintf.idl
126         $(XPIDL) $(XPIDL_INCL) \
127           -m header -o vlcintf $(srcdir)/vlcintf.idl
128
129 endif
130
131 ###############################################################################
132 # Stamp rules
133 ###############################################################################
134 clean-local: clean-stamp clean-bundle
135
136 clean-bundle:
137         rm -rf ./VLC\ Plugin.plugin
138
139 clean-stamp:
140         rm -f stamp-pic
141
142 stamp-pic: FORCE
143         @for dep in "" `$(VLC_CONFIG) --target builtin $(pic)`; do \
144           if test "$${dep}" -nt "$(LIBRARIES_mozilla)"; then \
145             rm -f $@; \
146             break; \
147           fi; \
148         done
149         @if test ! -f $@; then printf "" > $@; fi
150
151 ###############################################################################
152 # Force rule
153 ###############################################################################
154 FORCE: