ff7f441ba02f29fb1b4a4369ac3eae4c53d4f726
[vlc.git] / 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) $(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 /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/$@"
81         mkdir -p ./"$@"/Contents/Resources
82         ditto -rsrcFork npvlc.rsrc "./$@/Contents/MacOS/$@.rsrc"
83         cp $(top_srcdir)/extras/MacOSX/plugin/Info.plist "./$@/Contents/Info.plist"
84         cp $(top_srcdir)/extras/MacOSX/plugin/pbdevelopment.plist "./$@/Contents/pbdevelopment.plist"
85         cp -r $(top_srcdir)/extras/MacOSX/plugin/English.lproj "./$@/Contents/Resources/"
86         (cd $(top_builddir)/VLC.app/Contents/MacOS/; tar cf - modules)| \
87         (cd "./$@/Contents/MacOS"; tar xf -)
88
89 else
90
91 LIBRARIES_libvlc = $(top_builddir)/lib/libvlc_pic.a
92
93 npvlc_DATA = libvlcplugin$(LIBEXT)
94 npvlcdir = $(libdir)/mozilla/plugins
95
96 SOURCES_support = support/npunix.c
97
98 LDFLAGS_npvlc = -shared $(LIBRARIES_libvlc) `$(VLC_CONFIG) --libs mozilla vlc builtin $(pic)`
99
100 endif
101 endif
102
103 noinst_LIBRARIES_mozilla = libnpvlc.a
104
105 libnpvlc_a_SOURCES = $(SOURCES_mozilla)
106 libnpvlc_a_CFLAGS = `$(VLC_CONFIG) --cflags mozilla $(pic)` \
107                      $(CPPFLAGS_mozilla_EXTRA)
108 libnpvlc_a_CXXFLAGS = `$(VLC_CONFIG) --cxxflags mozilla $(pic)` \
109                        $(CPPFLAGS_mozilla_EXTRA)
110 libnpvlc_a_DEPENDENCIES = $(DATA_npvlc_rc)
111
112 BUILT_SOURCES_mozilla = vlcintf.h
113 $(SOURCES_mozilla): vlcintf.h
114
115 $(npvlc_DATA): $(libnpvlc_a_OBJECTS) \
116                       $(libnpvlc_a_DEPENDENCIES) stamp-pic
117         $(CXXLINK) $(libnpvlc_a_OBJECTS) $(DATA_npvlc_rc) \
118          $(LDFLAGS_npvlc)
119
120 vlcintf_xpt_DATA = vlcintf.xpt
121 vlcintf_xptdir = $(libdir)/mozilla/components
122 vlcintf.xpt: vlcintf.idl
123         $(XPIDL) $(XPIDL_INCL) \
124           -m typelib -o vlcintf $(srcdir)/vlcintf.idl
125
126 vlcintf.h: vlcintf.idl
127         $(XPIDL) $(XPIDL_INCL) \
128           -m header -o vlcintf $(srcdir)/vlcintf.idl
129
130 endif
131
132 ###############################################################################
133 # Stamp rules
134 ###############################################################################
135 clean-local: clean-stamp clean-bundle
136
137 clean-bundle:
138         rm -rf ./VLC\ Plugin.plugin
139
140 clean-stamp:
141         rm -f stamp-pic
142
143 stamp-pic: FORCE
144         @for dep in "" `$(VLC_CONFIG) --target builtin $(pic)`; do \
145           if test "$${dep}" -nt "$(LIBRARIES_mozilla)"; then \
146             rm -f $@; \
147             break; \
148           fi; \
149         done
150         @if test ! -f $@; then printf "" > $@; fi
151
152 ###############################################################################
153 # Force rule
154 ###############################################################################
155 FORCE: