Makefile.am 5.42 KB
Newer Older
1
2
3
4
5
6
7
###############################################################################
# Building the Mozilla plugin
###############################################################################

noinst_LIBRARIES = $(noinst_LIBRARIES_mozilla)
	                                     
MOSTLYCLEANFILES = $(LIBRARIES_mozilla)
gbazin's avatar
   
gbazin committed
8
EXTRA_DIST = $(SOURCES_mozilla) $(DIST_rsrc) vlcintf.idl
9
10
11
12
13
14
15
16
17
18
19
20
21
22
BUILT_SOURCES = $(BUILT_SOURCES_mozilla)

SOURCES_mozilla = \
	vlcshell.cpp \
	vlcplugin.cpp \
	vlcplugin.h \
	vlcpeer.cpp \
	vlcpeer.h \
	support/classinfo.h \
	$(SOURCES_win32) \
	$(SOURCES_macosx) \
	$(SOURCES_unix) \
	$(NULL)

gbazin's avatar
   
gbazin committed
23
24
25
26
DIST_rsrc = \
	npvlc_rc.rc \
	$(NULL)

27
28
29
30
31
32
33
# Under Win32, Mozilla plugins need to be named NP******.DLL, but under Unix
# the common naming scheme is lib******plugin.so. Also, we need npwin.cpp
# under Win32 and npunix.c under Unix.
if HAVE_WIN32
LIBRARIES_mozilla = npvlc$(LIBEXT)
SOURCES_win32 = support/npwin.cpp
CPPFLAGS_mozilla_EXTRA = -DXP_WIN -DXP_WIN32
34
LIBRARIES_libvlc = $(top_builddir)/lib/libvlc.a
35
36
else
if HAVE_DARWIN
37
38
39
40
# We don't define LIBRARIES_mozilla because we'll be using project builder, or not...
BUNDLE_mozilla = VLC\ Plugin.plugin
vlc_moz_FLAGS = `$(VLC_CONFIG) --libs vlc builtin pic mozilla`
moz_CFLAGS = `$(MOZILLA_CONFIG) --cflags plugin java nspr/obsolete nspr oji xpcom xpconnect`
41
moz_plugin_FLAGS = -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
42
43
pic = pic
LIBRARIES_libvlc = $(top_builddir)/lib/libvlc_pic.a
44

45
46
47
else
LIBRARIES_mozilla = libvlcplugin$(LIBEXT)
SOURCES_unix = support/npunix.c
48
49
pic = pic
LIBRARIES_libvlc = $(top_builddir)/lib/libvlc_pic.a
50
51
52
53
54
55
56
57
58
endif
endif

if BUILD_MOZILLA
if UNTRUE
noinst_LIBRARIES_mozilla = libplugin.a
endif

libplugin_a_SOURCES = $(SOURCES_mozilla)
59
libplugin_a_CFLAGS = `$(VLC_CONFIG) --cflags mozilla $(pic)` \
60
	             $(CPPFLAGS_mozilla_EXTRA) -Imozilla
61
libplugin_a_CXXFLAGS = `$(VLC_CONFIG) --cxxflags mozilla $(pic)` \
62
63
64
65
66
67
	               $(CPPFLAGS_mozilla_EXTRA) -Imozilla
libplugin_a_DEPENDENCIES = $(DATA_npvlc_rc)

BUILT_SOURCES_mozilla = vlcintf.h
$(SOURCES_mozilla): vlcintf.h

68
plugin_DATA = $(LIBRARIES_mozilla) $(BUNDLE_mozilla)
69
70
plugindir = $(libdir)/mozilla/plugins
$(LIBRARIES_mozilla): $(libplugin_a_OBJECTS) \
71
	              $(libplugin_a_DEPENDENCIES) stamp-pic
72
	$(CXXLINK) $(libplugin_a_OBJECTS) $(DATA_npvlc_rc) \
73
74
	  $(LIBRARIES_libvlc) -shared \
	  `$(VLC_CONFIG) --libs vlc mozilla builtin $(pic)`
75
76
77
78

vlcintf_xpt_DATA = vlcintf.xpt
vlcintf_xptdir = $(libdir)/mozilla/components
vlcintf.xpt: vlcintf.idl
gbazin's avatar
   
gbazin committed
79
80
	$(XPIDL) $(XPIDL_INCL) -I/usr/share/idl/mozilla \
	  -I/usr/lib/mozilla/include/idl \
81
82
83
	  -m typelib -o vlcintf $(srcdir)/vlcintf.idl

vlcintf.h: vlcintf.idl
gbazin's avatar
   
gbazin committed
84
85
	$(XPIDL) $(XPIDL_INCL) -I/usr/share/idl/mozilla \
	  -I/usr/lib/mozilla/include/idl \
86
87
88
89
90
91
92
	  -m header -o vlcintf $(srcdir)/vlcintf.idl

if HAVE_WIN32
DATA_npvlc_rc = $(noinst_npvlc_rc_DATA)
noinst_npvlc_rc_DATA = npvlc_rc.$(OBJEXT)
noinst_npvlc_rcdir = $(libdir)
npvlc_rc.$(OBJEXT): npvlc_rc.rc
93
	$(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 $@
94
95
96
endif
if HAVE_DARWIN
VLC\ Plugin.plugin:
97
98
99
100
101
102
103
104
105
106
107
108
109
110
	rm -rf ./VLC\ Plugin.plugin
	mkdir -p ./VLC\ Plugin.plugin/Contents/MacOS
	mkdir -p ./VLC\ Plugin.plugin/Contents/Resources
	/usr/bin/g++3 $(moz_plugin_FLAGS) $(srcdir)/vlcplugin.cpp -o ./libplugin_a-vlcplugin.o
	/usr/bin/g++3 $(moz_plugin_FLAGS) $(srcdir)/vlcshell.cpp -o ./libplugin_a-vlcshell.o
	/usr/bin/g++3 $(moz_plugin_FLAGS) $(srcdir)/vlcpeer.cpp -o ./libplugin_a-vlcpeer.o
	/usr/bin/g++3 $(moz_plugin_FLAGS) $(srcdir)/support/npmac.cpp -o ./libplugin_a-npmac.o
	/usr/bin/g++3 ./libplugin_a-vlcplugin.o ./libplugin_a-vlcshell.o ./libplugin_a-vlcpeer.o ./libplugin_a-npmac.o -o ./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)
	cp $(top_srcdir)/extras/MacOSX/plugin/Info.plist ./VLC\ Plugin.plugin/Contents/Info.plist
	cp $(top_srcdir)/extras/MacOSX/plugin/pbdevelopment.plist ./VLC\ Plugin.plugin/Contents/pbdevelopment.plist
	cp -r $(top_srcdir)/extras/MacOSX/plugin/English.lproj ./VLC\ Plugin.plugin/Contents/Resources/
	Rez /Developer/Headers/FlatCarbon/Types.r $(srcdir)/vlc.r -o ./VLC\ Plugin.plugin/Contents/Resources/Vlc\ Plugin.rsrc
	mkdir ./VLC\ Plugin.plugin/Contents/MacOS/modules
	cp -r $(top_builddir)/VLC.app/Contents/MacOS/modules/* ./VLC\ Plugin.plugin/Contents/MacOS/modules/
111
112
113
114
115
116
endif
endif

###############################################################################
# Stamp rules
###############################################################################
117
clean: clean-stamp clean-bundle
118
119
120
121
clean-stamp:
	rm -f stamp-pic

stamp-pic: FORCE
122
	@for dep in "" `$(VLC_CONFIG) --target builtin $(pic)`; do \
123
124
125
126
127
128
129
	  if test "$${dep}" -nt "$(LIBRARIES_mozilla)"; then \
	    rm -f $@; \
	    break; \
	  fi; \
	done
	@if test ! -f $@; then printf "" > $@; fi

130
clean-bundle:
131
	rm -rf ./VLC\ Plugin.plugin
132

133
134
135
136
###############################################################################
# Force rule
###############################################################################
FORCE: