Makefile.am 4.87 KB
Newer Older
1 2 3 4
###############################################################################
# Building the Mozilla plugin
###############################################################################

5
noinst_LIBRARIES = $(noinst_LIBRARIES_mozilla)
6 7
	                                     
MOSTLYCLEANFILES = $(LIBRARIES_mozilla)
8
EXTRA_DIST = $(SOURCES_mozilla) $(DIST_rsrc) $(DIST_misc)
9 10 11 12 13 14 15 16 17
BUILT_SOURCES = $(BUILT_SOURCES_mozilla)

SOURCES_mozilla = \
	vlcshell.cpp \
	vlcplugin.cpp \
	vlcplugin.h \
	vlcpeer.cpp \
	vlcpeer.h \
	support/classinfo.h \
18
	$(SOURCES_support) \
19 20
	$(NULL)

Gildas Bazin's avatar
 
Gildas Bazin committed
21
DIST_rsrc = \
22 23 24 25 26
	$(SOURCES_rsrc) \
	$(NULL)

DIST_misc = \
	vlcintf.idl \
Gildas Bazin's avatar
 
Gildas Bazin committed
27 28
	$(NULL)

29 30 31 32
# 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
33

34
LIBRARIES_libvlc = $(top_builddir)/lib/libvlc.a
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49

npvlc_DATA = npvlc$(LIBEXT)
npvlcdir = $(libdir)

SOURCES_support = support/npwin.cpp
SOURCES_rsrc = npvlc_rc.rc
CPPFLAGS_mozilla_EXTRA = -DXP_WIN -DXP_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
	$(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 $@
LDFLAGS_npvlc = -shared $(LIBRARIES_libvlc) `$(VLC_CONFIG) --libs mozilla vlc builtin`

50 51
else
if HAVE_DARWIN
52 53 54 55 56 57 58

LIBRARIES_libvlc = $(top_builddir)/lib/libvlc.a

npvlc_DATA = $(noinst_npvlc_DATA)
noinst_npvlc_DATA = npvlc$(LIBEXT)
noinst_npvlcdir = $(libdir)

59
BUNDLE_mozilla = VLC\ Plugin.plugin
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
SOURCES_support = support/npmac.cpp
SOURCES_rsrc = vlc.r

DATA_bundle = $(noinst_bundle_DATA)
noinst_bundle_DATA = VLC\ Plugin.plugin
noinst_bundledir = $(libdir)

VLC\ Plugin.plugin: npvlc.rsrc npvlc.dylib
	rm -rf "$@"
	mkdir -p "./$@/Contents/MacOS"
	cp npvlc.dylib "./$@/Contents/MacOS/$@"
	mkdir -p ./"$@"/Contents/Resources
	cp npvlc.rsrc "./$@/Contents/MacOS/$@.rsrc"
	cp $(top_srcdir)/extras/MacOSX/plugin/Info.plist "./$@/Contents/Info.plist"
	cp $(top_srcdir)/extras/MacOSX/plugin/pbdevelopment.plist "./$@/Contents/pbdevelopment.plist"
	cp -r $(top_srcdir)/extras/MacOSX/plugin/English.lproj "./$@/Contents/Resources/"
	(cd $(top_builddir)/VLC.app/Contents/MacOS/; tar cf - modules)| \
	(cd "./$@/Contents/MacOS"; tar xf -)

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

DATA_npvlc_rsrc = $(noinst_npvlc_rsrc_DATA)
noinst_npvlc_rsrc_DATA = npvlc.rsrc
noinst_npvlc_rsrcdir = $(libdir)
npvlc.rsrc: $(srcdir)/vlc.r
	/Developer/Tools/Rez /Developer/Headers/FlatCarbon/Types.r $< -o $@
LDFLAGS_npvlc = -arch ppc -bundle -read_only_relocs suppress $(LIBRARIES_libvlc) -dylib `$(VLC_CONFIG) --libs mozilla vlc builtin $(pic)`
87

88
else
89

90
LIBRARIES_libvlc = $(top_builddir)/lib/libvlc_pic.a
91 92 93 94 95 96 97
npvlc_DATA = libvlcplugin$(LIBEXT)
npvlcdir = $(libdir)/mozilla/plugins

SOURCES_support = support/npunix.c

LDFLAGS_npvlc = -shared $(LIBRARIES_libvlc) `$(VLC_CONFIG) --libs mozilla vlc builtin $(pic)`

98 99 100 101
endif
endif

if BUILD_MOZILLA
102 103 104 105 106 107 108 109 110

noinst_LIBRARIES_mozilla = libnpvlc.a

libnpvlc_a_SOURCES = $(SOURCES_mozilla)
libnpvlc_a_CFLAGS = `$(VLC_CONFIG) --cflags mozilla $(pic)` \
	             $(CPPFLAGS_mozilla_EXTRA)
libnpvlc_a_CXXFLAGS = `$(VLC_CONFIG) --cxxflags mozilla $(pic)` \
	               $(CPPFLAGS_mozilla_EXTRA)
libnpvlc_a_DEPENDENCIES = $(DATA_npvlc_rc)
111 112 113 114

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

115 116 117 118
npvlc$(LIBEXT): $(libnpvlc_a_OBJECTS) \
	              $(libnpvlc_a_DEPENDENCIES) stamp-pic
	$(CXXLINK) $(libnpvlc_a_OBJECTS) $(DATA_npvlc_rc) \
	 $(LDFLAGS_npvlc)
119 120 121 122

vlcintf_xpt_DATA = vlcintf.xpt
vlcintf_xptdir = $(libdir)/mozilla/components
vlcintf.xpt: vlcintf.idl
123
	$(XPIDL) $(XPIDL_INCL) \
124 125 126
	  -m typelib -o vlcintf $(srcdir)/vlcintf.idl

vlcintf.h: vlcintf.idl
127
	$(XPIDL) $(XPIDL_INCL) \
128 129
	  -m header -o vlcintf $(srcdir)/vlcintf.idl

130

131 132 133 134 135
endif

###############################################################################
# Stamp rules
###############################################################################
136 137 138 139 140
clean-local: clean-stamp clean-bundle

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

141 142 143 144
clean-stamp:
	rm -f stamp-pic

stamp-pic: FORCE
145
	@for dep in "" `$(VLC_CONFIG) --target builtin $(pic)`; do \
146 147 148 149 150 151 152 153 154 155 156
	  if test "$${dep}" -nt "$(LIBRARIES_mozilla)"; then \
	    rm -f $@; \
	    break; \
	  fi; \
	done
	@if test ! -f $@; then printf "" > $@; fi

###############################################################################
# Force rule
###############################################################################
FORCE: