blob: 43ffd221bc364456b60a584fb8f0b1fc43baf935 [file] [log] [blame]
jat@google.com2a2909f2010-10-11 18:02:47 +00001# Copyright 2010 Google Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
jat@google.com134be542009-08-03 15:30:11 +000015include ../config.mk
16
jat@google.com2a2909f2010-10-11 18:02:47 +000017ifeq ($(OS),mac)
18RUN_PATH_FLAG = -executable_path
19DLL_SUFFIX = .dylib
conroy@google.com7c8d59f2011-01-27 17:50:46 +000020DLLFLAGS = -bundle $(ARCHCFLAGS) -mmacosx-version-min=10.5
conroy@google.com3842d012010-10-20 17:40:04 +000021CFLAGS += -DXP_MACOSX $(ARCHCFLAGS)
22CXXFLAGS += -DXP_MACOSX $(ARCHCFLAGS)
jat@google.com2a2909f2010-10-11 18:02:47 +000023# Mac puts multiple architectures into the same files
24TARGET_PLATFORM = Darwin-gcc3
conroy@google.com3842d012010-10-20 17:40:04 +000025CHROME_PATH ?= /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome
conroy@google.com88069782010-11-23 13:51:12 +000026PLATFORM_DIR_SUFFIX = gwtDev.plugin/Contents/MacOS/
jat@google.com2a2909f2010-10-11 18:02:47 +000027else
28ifeq ($(OS),linux)
29RUN_PATH_FLAG = -rpath-link
30DLL_SUFFIX = .so
31DLLFLAGS = -shared -m$(FLAG32BIT)
32TARGET_PLATFORM = Linux_$(ARCH)-gcc3
conroy@google.com3842d012010-10-20 17:40:04 +000033CHROME_PATH ?= /opt/google/chrome/chrome
jat@google.com2a2909f2010-10-11 18:02:47 +000034else
jat@google.com2a2909f2010-10-11 18:02:47 +000035endif
36endif
jat@google.com134be542009-08-03 15:30:11 +000037
jat@google.com134be542009-08-03 15:30:11 +000038
jat@google.com2a2909f2010-10-11 18:02:47 +000039export FLAG32BIT
jat@google.com134be542009-08-03 15:30:11 +000040
conroy@google.com3842d012010-10-20 17:40:04 +000041CFLAGS += -DBROWSER_NPAPI -DXP_UNIX -fshort-wchar
jat@google.com2a2909f2010-10-11 18:02:47 +000042CXXFLAGS = $(CXXONLYFLAGS) $(CFLAGS)
43DIR = $(shell pwd)
jat@google.com134be542009-08-03 15:30:11 +000044
jat@google.com2a2909f2010-10-11 18:02:47 +000045DEPEND = g++ -MM -MT'$$(OBJ_OUTDIR)/$(patsubst %.cpp,%.o,$(src))' \
46 -I. -I../common $(src)
jat@google.com134be542009-08-03 15:30:11 +000047
jat@google.com2a2909f2010-10-11 18:02:47 +000048COMMON = ../common/libcommon$(FLAG32BIT).a
jat@google.com328318e2009-11-11 00:59:43 +000049
jat@google.com2a2909f2010-10-11 18:02:47 +000050OBJ_OUTDIR = build/$(TARGET_PLATFORM)
51EXTENSION_OUTDIR = prebuilt/gwt-dev-plugin
52PLATFORM_DIR = $(EXTENSION_OUTDIR)/$(TARGET_PLATFORM)
conroy@google.com88069782010-11-23 13:51:12 +000053PLATFORM_DIR_SUFFIX ?= ""
jat@google.com328318e2009-11-11 00:59:43 +000054
jat@google.com2a2909f2010-10-11 18:02:47 +000055INSTALLER_CRX = prebuilt/gwt-dev-plugin.crx
56DLL = $(OBJ_OUTDIR)/libGwtDevPlugin$(DLL_SUFFIX)
conroy@google.com3842d012010-10-20 17:40:04 +000057GWTDEV_CRX_PEM ?= $(CURDIR)/gwt-dev-plugin.pem
58CHROME_COMMAND = $(CHROME_PATH) --pack-extension=$(CURDIR)/$(EXTENSION_OUTDIR) --no-message-box --user-data-dir=$(CURDIR)/$(OBJ_OUTDIR)/user-data --pack-extension-key=$(GWTDEV_CRX_PEM)
jat@google.com134be542009-08-03 15:30:11 +000059
jat@google.com2a2909f2010-10-11 18:02:47 +000060#DLLFLAGS +=
jat@google.com134be542009-08-03 15:30:11 +000061
conroy@google.com3842d012010-10-20 17:40:04 +000062VERSION ?= 1.0.$(shell ./getversion)
63ifeq ($(VERSION), 1.0.)
64$(error You must specify the version if you are not in an svn checkout)
65endif
jat@google.com2a2909f2010-10-11 18:02:47 +000066
67.PHONY: default all crx lib common clean depend install install-platform \
conroy@google.com88069782010-11-23 13:51:12 +000068 versioned-files devmodeoptions
jat@google.com2a2909f2010-10-11 18:02:47 +000069
conroy@google.com88069782010-11-23 13:51:12 +000070default:: lib versioned-files devmodeoptions
jat@google.com2a2909f2010-10-11 18:02:47 +000071
72all:: common lib install-platform crx
73
74lib:: $(OBJ_OUTDIR) $(EXTENSION_OUTDIR) $(DLL)
75crx:: $(EXTENSION_OUTDIR) $(INSTALLER_CRX)
76
77linuxplatforms:
78 $(MAKE) lib ARCH=x86
79 $(MAKE) lib ARCH=x86_64
80
81macplatforms:
82 $(MAKE) lib
83
84HDRS = \
85 LocalObjectTable.h \
86 NPVariantWrapper.h \
87 Plugin.h \
88 ScriptableInstance.h \
89 mozincludes.h \
90 JavaObject.h
91
92SRCS = \
93 main.cpp \
94 Plugin.cpp \
95 LocalObjectTable.cpp \
96 JavaObject.cpp \
97 npn_bindings.cpp \
98 ScriptableInstance.cpp
99
100OBJS = $(patsubst %.cpp,$(OBJ_OUTDIR)/%.o,$(SRCS))
101
102$(OBJS): $(OBJ_OUTDIR)
103
104$(OBJ_OUTDIR)::
105 @mkdir -p $@
106
conroy@google.com3842d012010-10-20 17:40:04 +0000107$(INSTALLER_CRX): $(GWTDEV_CRX_PEM) $(EXTENSION_OUTDIR) versioned-files
108 $(shell $(CHROME_COMMAND))
jat@google.com134be542009-08-03 15:30:11 +0000109
jat@google.com328318e2009-11-11 00:59:43 +0000110versioned-files::
111 sed -e s/GWT_DEV_PLUGIN_VERSION/$(VERSION)/ manifest-template.json >prebuilt/gwt-dev-plugin/manifest.json
jat@google.com2a2909f2010-10-11 18:02:47 +0000112 #sed -e s/GWT_DEV_PLUGIN_VERSION/$(VERSION)/ updates-template.xml >prebuilt/updates.xml
jat@google.com328318e2009-11-11 00:59:43 +0000113
jat@google.com2a2909f2010-10-11 18:02:47 +0000114$(DLL): $(OBJS) $(COMMON)
115 $(CXX) -m$(FLAG32BIT) -o $@ $(OBJS) $(COMMON) $(DLLFLAGS)
116 @mkdir -p $(PLATFORM_DIR)
conroy@google.com88069782010-11-23 13:51:12 +0000117 cp $(DLL) $(PLATFORM_DIR)/$(PLATFORM_DIR_SUFFIX)
jat@google.com134be542009-08-03 15:30:11 +0000118
jat@google.com2a2909f2010-10-11 18:02:47 +0000119$(OBJ_OUTDIR)/%.o: %.cpp
120 $(CXX) $(CXXFLAGS) -c -o $@ -I. -I../common $<
jat@google.com134be542009-08-03 15:30:11 +0000121
jat@google.com2a2909f2010-10-11 18:02:47 +0000122common $(COMMON):
123 (cd ../common && $(MAKE))
jat@google.com134be542009-08-03 15:30:11 +0000124
jat@google.com2a2909f2010-10-11 18:02:47 +0000125clean:
126 rm -rf build
jat@google.com134be542009-08-03 15:30:11 +0000127
conroy@google.com88069782010-11-23 13:51:12 +0000128devmodeoptions:
129 (ant -f DevModeOptions/build.xml prebuilt)
130
jat@google.com2a2909f2010-10-11 18:02:47 +0000131depend: $(OBJ_OUTDIR)
132 ($(foreach src,$(SRCS),$(DEPEND)) true) >>Makefile
jat@google.com134be542009-08-03 15:30:11 +0000133# makedepend -- $(CFLAGS) -- $(SRCS)
134
135# DO NOT DELETE
jat@google.com2a2909f2010-10-11 18:02:47 +0000136$(OBJ_OUTDIR)/main.o $(OBJ_OUTDIR)/Plugin.o \
137 $(OBJ_OUTDIR)/LocalObjectTable.o $(OBJ_OUTDIR)/JavaObject.o \
138 $(OBJ_OUTDIR)/npn_bindings.cpp $(OBJ_OUTDIR)/ScriptableInstance.o: \
139 main.cpp ../common/Debug.h ../common/Platform.h ../common/DebugLevel.h \
140 mozincludes.h npapi/npapi.h npapi/nphostapi.h npapi/npapi.h \
141 npapi/npruntime.h npapi/npruntime.h NPObjectWrapper.h Plugin.h \
142 ../common/HostChannel.h ../common/Debug.h ../common/ByteOrder.h \
143 ../common/Socket.h ../common/Message.h ../common/ReturnMessage.h \
144 ../common/BrowserChannel.h ../common/Value.h ../common/SessionHandler.h \
145 ../common/LoadModuleMessage.h ../common/HostChannel.h LocalObjectTable.h \
146 ../common/SessionHandler.h ../common/HashMap.h ScriptableInstance.h \
147 ../common/scoped_ptr/scoped_ptr.h
148$(OBJ_OUTDIR)/main.o $(OBJ_OUTDIR)/Plugin.o \
149 $(OBJ_OUTDIR)/LocalObjectTable.o $(OBJ_OUTDIR)/JavaObject.o \
150 $(OBJ_OUTDIR)/npn_bindings.cpp $(OBJ_OUTDIR)/ScriptableInstance.o: \
151 Plugin.cpp Plugin.h ../common/Debug.h ../common/Platform.h \
152 ../common/DebugLevel.h mozincludes.h npapi/npapi.h npapi/nphostapi.h \
153 npapi/npapi.h npapi/npruntime.h npapi/npruntime.h NPObjectWrapper.h \
154 ../common/HostChannel.h ../common/Debug.h ../common/ByteOrder.h \
155 ../common/Socket.h ../common/Message.h ../common/ReturnMessage.h \
156 ../common/BrowserChannel.h ../common/Value.h ../common/SessionHandler.h \
157 ../common/LoadModuleMessage.h ../common/HostChannel.h LocalObjectTable.h \
158 ../common/SessionHandler.h ../common/HashMap.h ScriptableInstance.h \
159 ../common/InvokeMessage.h ../common/ReturnMessage.h \
160 ../common/ServerMethods.h ../common/scoped_ptr/scoped_ptr.h \
161 NPVariantWrapper.h ../common/Platform.h ../common/Value.h JavaObject.h
162$(OBJ_OUTDIR)/main.o $(OBJ_OUTDIR)/Plugin.o \
163 $(OBJ_OUTDIR)/LocalObjectTable.o $(OBJ_OUTDIR)/JavaObject.o \
164 $(OBJ_OUTDIR)/npn_bindings.cpp $(OBJ_OUTDIR)/ScriptableInstance.o: \
165 LocalObjectTable.cpp mozincludes.h npapi/npapi.h npapi/nphostapi.h \
166 npapi/npapi.h npapi/npruntime.h npapi/npruntime.h NPObjectWrapper.h \
167 LocalObjectTable.h ../common/Debug.h ../common/Platform.h \
168 ../common/DebugLevel.h
169$(OBJ_OUTDIR)/main.o $(OBJ_OUTDIR)/Plugin.o \
170 $(OBJ_OUTDIR)/LocalObjectTable.o $(OBJ_OUTDIR)/JavaObject.o \
171 $(OBJ_OUTDIR)/npn_bindings.cpp $(OBJ_OUTDIR)/ScriptableInstance.o: \
172 JavaObject.cpp ../common/Debug.h ../common/Platform.h \
173 ../common/DebugLevel.h JavaObject.h mozincludes.h npapi/npapi.h \
174 npapi/nphostapi.h npapi/npapi.h npapi/npruntime.h npapi/npruntime.h \
175 NPObjectWrapper.h Plugin.h ../common/HostChannel.h ../common/Debug.h \
176 ../common/ByteOrder.h ../common/Socket.h ../common/Message.h \
177 ../common/ReturnMessage.h ../common/BrowserChannel.h ../common/Value.h \
178 ../common/SessionHandler.h ../common/LoadModuleMessage.h \
179 ../common/HostChannel.h LocalObjectTable.h ../common/SessionHandler.h \
180 ../common/HashMap.h ScriptableInstance.h NPVariantWrapper.h \
181 ../common/Platform.h ../common/Value.h
182$(OBJ_OUTDIR)/main.o $(OBJ_OUTDIR)/Plugin.o \
183 $(OBJ_OUTDIR)/LocalObjectTable.o $(OBJ_OUTDIR)/JavaObject.o \
184 $(OBJ_OUTDIR)/npn_bindings.cpp $(OBJ_OUTDIR)/ScriptableInstance.o: \
185 npn_bindings.cpp ../common/Debug.h ../common/Platform.h \
186 ../common/DebugLevel.h mozincludes.h npapi/npapi.h npapi/nphostapi.h \
187 npapi/npapi.h npapi/npruntime.h npapi/npruntime.h NPObjectWrapper.h
188$(OBJ_OUTDIR)/main.o $(OBJ_OUTDIR)/Plugin.o \
189 $(OBJ_OUTDIR)/LocalObjectTable.o $(OBJ_OUTDIR)/JavaObject.o \
190 $(OBJ_OUTDIR)/npn_bindings.cpp $(OBJ_OUTDIR)/ScriptableInstance.o: \
191 ScriptableInstance.cpp ScriptableInstance.h ../common/Debug.h \
192 ../common/Platform.h ../common/DebugLevel.h mozincludes.h npapi/npapi.h \
193 npapi/nphostapi.h npapi/npapi.h npapi/npruntime.h npapi/npruntime.h \
194 NPObjectWrapper.h ../common/HostChannel.h ../common/Debug.h \
195 ../common/ByteOrder.h ../common/Socket.h ../common/Message.h \
196 ../common/ReturnMessage.h ../common/BrowserChannel.h ../common/Value.h \
197 ../common/SessionHandler.h ../common/LoadModuleMessage.h \
198 ../common/HostChannel.h LocalObjectTable.h ../common/SessionHandler.h \
199 ../common/HashMap.h ../common/InvokeMessage.h ../common/ReturnMessage.h \
200 ../common/ServerMethods.h ../common/AllowedConnections.h \
201 ../common/scoped_ptr/scoped_ptr.h NPVariantWrapper.h \
202 ../common/Platform.h ../common/Value.h Plugin.h JavaObject.h