VirtualBox

source: vbox/trunk/src/libs/xpcom18a4/java/Makefile.kmk@ 29233

Last change on this file since 29233 was 29231, checked in by vboxsync, 15 years ago

bridge: tests reworked

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 10.0 KB
Line 
1# $Id: Makefile.kmk 29231 2010-05-07 19:42:03Z vboxsync $
2## @file
3# Sub-Makefile for Java bindings
4#
5
6#
7# Copyright (C) 2010 Oracle Corporation
8#
9# This file is part of VirtualBox Open Source Edition (OSE), as
10# available from http://www.virtualbox.org. This file is free software;
11# you can redistribute it and/or modify it under the terms of the GNU
12# General Public License (GPL) as published by the Free Software
13# Foundation, in version 2 as it comes in the "COPYING" file of the
14# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16#
17
18SUB_DEPTH = ../../../..
19include $(KBUILD_PATH)/subheader.kmk
20
21ifndef VBOX_ONLY_SDK
22
23#
24# Globals
25#
26VBOX_JXPCOM_SRC := $(PATH_SUB_CURRENT)
27
28ifeq ($(KBUILD_TARGET), darwin)
29 VBOX_JAVA_HOME = /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0
30 VBOX_JAVAC = $(VBOX_JAVA_HOME)/Commands/javac
31 VBOX_JAVAH = $(VBOX_JAVA_HOME)/Commands/javah
32 VBOX_JAR = $(VBOX_JAVA_HOME)/Commands/jar
33 VBOX_JAVA_INC = $(VBOX_JAVA_HOME)/Headers
34else
35 ifeq ($(KBUILD_TARGET), linux)
36 VBOX_JAVA_HOME ?= /usr/lib/jvm/java-1.5.0-sun
37 endif
38 ifeq ($(KBUILD_TARGET), solaris)
39 # VBOX_JAVA_HOME ?= /usr/jdk/jdk1.5.0
40 VBOX_JAVA_HOME ?= /usr/java
41 endif
42 VBOX_JAVAC = $(VBOX_JAVA_HOME)/bin/javac
43 VBOX_JAVAH = $(VBOX_JAVA_HOME)/bin/javah
44 VBOX_JAR = $(VBOX_JAVA_HOME)/bin/jar
45 # correct for targets we care about
46 VBOX_MD_OS = $(KBUILD_TARGET)
47 VBOX_JAVA_INC = $(VBOX_JAVA_HOME)/include \
48 $(VBOX_JAVA_HOME)/include/$(VBOX_MD_OS)
49endif
50JAVAC_OPTS = -source 1.4 -target 1.4
51
52
53VBOX_JXPCOM_TARGET := $(PATH_TARGET)/vboxjxpcom-gen
54VBOX_JXPCOM_JDEST := $(VBOX_JXPCOM_TARGET)/jdest
55
56#
57# VBoxJXpcom - missing description.
58#
59DLLS += VBoxJXpcom
60
61VBoxJXpcom_TEMPLATE = XPCOM
62VBoxJXpcom_CXXFLAGS = -Wno-write-strings
63VBoxJXpcom_DEFS = \
64 EXPORT_XPTI_API \
65 EXPORT_XPT_API \
66 VBOX_WITH_XPCOM
67#VBoxJXpcom_DEFS.darwin = XP_MACOSX - already in TEMPLATE_XPCOM_DEFS.darwin ...
68VBoxJXpcom_NAME = libvboxjxpcom
69VBoxJXpcom_DLLSUFF.darwin = .jnilib
70VBoxJXpcom_INCS = \
71 src \
72 $(VBOX_JAVA_INC) \
73 $(VBOX_PATH_XPCOM_SRC)/xpcom/glue \
74 $(VBOX_PATH_XPCOM_SRC)/xpcom/build \
75 $(VBOX_JXPCOM_JDEST)
76VBoxJXpcom_SOURCES = \
77 src/nsAppFileLocProviderProxy.cpp \
78 src/nsJavaWrapper.cpp \
79 src/nsJavaXPCOMBindingUtils.cpp \
80 src/nsJavaXPTCStub.cpp \
81 src/nsJavaXPTCStubWeakRef.cpp \
82 src/nsJavaXPCOMGlue.cpp \
83 src/nsJavaInterfaces.cpp
84VBoxJXpcom_LIBS = \
85 $(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB) \
86 $(PATH_BIN)/VBoxXPCOM$(VBOX_SUFF_DLL)
87
88#VBoxJXpcom_ORDERDEPS = $(VBOX_JXPCOM_GENH)
89#VBoxJXpcom_CLEAN = $(VBOX_JXPCOM_GENH)
90VBOX_JXPCOM_GENH = \
91 $(VBOX_JXPCOM_JDEST)/org_mozilla_xpcom_internal_XPCOMImpl.h \
92 $(VBOX_JXPCOM_JDEST)/org_mozilla_xpcom_internal_GREImpl.h \
93 $(VBOX_JXPCOM_JDEST)/org_mozilla_xpcom_internal_MozillaImpl.h \
94 $(VBOX_JXPCOM_JDEST)/org_mozilla_xpcom_internal_XPCOMJavaProxy.h \
95 $(VBOX_JXPCOM_JDEST)/org_mozilla_xpcom_internal_JavaXPCOMMethods.h \
96 $(VBOX_JXPCOM_JDEST)/org_mozilla_xpcom_ProfileLock.h
97
98
99ifndef VBOX_WITH_JAVA_SUPPORT_IN_XPIDL
100 #
101 # genjifaces - using VBoxXPCOM and associates.
102 #
103 PROGRAMS += genjifaces
104 TEMPLATE_XPCOMEXEBLD = XPCOM Build executable
105 TEMPLATE_XPCOMEXEBLD_EXTENDS = XPCOMBLDPROG
106 TEMPLATE_XPCOMEXEBLD_EXTENDS_BY = appending
107 TEMPLATE_XPCOMEXEBLD_CXXFLAGS = $(TEMPLATE_XPCOM_CXXFLAGS)
108 TEMPLATE_XPCOMEXEBLD_INCS = \
109 $(TEMPLATE_XPCOM_INCS) \
110 $(VBOX_PATH_XPCOM_SRC) \
111 $(VBOX_PATH_XPCOM_SRC)/xpcom/build \
112 $(VBOX_PATH_XPCOM_SRC)/xpcom/ds
113 TEMPLATE_XPCOMEXEBLD_DEFS = VBOX_WITH_XPCOM
114 TEMPLATE_XPCOMEXEBLD_LIBS = $(VBoxXPCOM_LIBS) $(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB)
115 # This is OK on Linux even with hardening
116 TEMPLATE_XPCOMEXEBLD_LIBS.linux = $(PATH_BIN)/VBoxXPCOM$(VBOX_SUFF_DLL)
117 TEMPLATE_XPCOMEXEBLD_LIBS.solaris = $(PATH_BIN)/VBoxXPCOM$(VBOX_SUFF_DLL)
118 TEMPLATE_XPCOMEXEBLD_INCS.darwin = $(TEMPLATE_XPCOM_INCS.darwin)
119 TEMPLATE_XPCOMEXEBLD_LDFLAGS.darwin = \
120 -framework CoreServices \
121 -framework CoreFoundation \
122 -framework Foundation \
123 -framework AppKit \
124 -framework Carbon
125 TEMPLATE_XPCOMEXEBLD_LDFLAGS.linux = '$(VBOX_GCC_RPATH_OPT)$$(VBOX_ORIGIN)'
126
127 ifeq ($(KBUILD_TARGET),darwin)
128 define preprocess_exebld
129 $(shell install_name_tool -change $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxRT.dylib $(PATH_BIN)/VBoxRT.dylib $(1))
130 endef
131 else
132 define preprocess_exebld
133 endef
134 endif
135
136 genjifaces_TEMPLATE = XPCOMEXEBLD
137 genjifaces_INCS = \
138 src
139 genjifaces_DEFS = \
140 EXPORT_XPTI_API \
141 EXPORT_XPT_API
142
143 genjifaces_SOURCES = \
144 ../xpcom/build/nsStringAPI.cpp \
145 ../xpcom/build/nsXPComInit.cpp \
146 tools/genifaces/GenerateJavaInterfaces.cpp \
147 src/nsFileStreams.cpp
148 genjifaces_INST = $(INST_BIN)
149 genjifaces_DEPS = $(PATH_TARGET)/VBox-xpcom-idl-timestamp
150 GENJIFACES_BIN := $(PATH_BIN)/genjifaces$(HOSTSUFF_EXE)
151endif # !VBOX_WITH_JAVA_SUPPORT_IN_XPIDL
152
153#
154# Install JAR files
155#
156INSTALLS += VBoxJXpcom-inst-jar
157
158VBOX_JXPCOM_JAR = $(VBoxJXpcom-inst-jar_0_OUTDIR)/vboxjxpcom.jar
159VBOX_JXPCOM_NSERROR = $(VBOX_JXPCOM_GEN)/java/XPCOMError.java
160ifndef VBOX_WITH_JAVA_SUPPORT_IN_XPIDL
161VBOX_JXPCOM_GEN = $(VBOX_JXPCOM_TARGET)/jxpcomgen
162else
163VBOX_JXPCOM_GEN = $(VBOX_JXPCOM_TARGET)/jxpcomgen-idl
164endif
165
166VBoxJXpcom-inst-jar_INST = $(INST_SDK)bindings/xpcom/java/
167VBoxJXpcom-inst-jar_SOURCES = \
168 $(VBOX_JXPCOM_JAR)
169VBoxJXpcom-inst-jar_CLEAN = \
170 $(VBOX_JXPCOM_JAR) \
171 $(VBOX_JXPCOM_NSERROR) \
172 $(VBOX_JXPCOM_GEN)/jxpcomgen.list \
173 $(wildcard \
174 $(VBOX_JXPCOM_GEN)/java/*.java \
175 $(VBOX_JXPCOM_JDEST)/*.class \
176 $(VBOX_JXPCOM_JDEST)/*/*.class \
177 $(VBOX_JXPCOM_JDEST)/*/*/*.class \
178 $(VBOX_JXPCOM_JDEST)/*/*/*/*.class \
179 $(VBOX_JXPCOM_JDEST)/*/*/*/*/*.class \
180 $(VBOX_JXPCOM_JDEST)/*/*/*/*/*/*.class \
181 )
182VBoxJXpcom-inst-jar_BLDDIRS += $(VBOX_JXPCOM_GEN)/java
183
184
185#
186# For VBoxJXpcom, not currently used.
187#
188$(VBOX_JXPCOM_GENH): $$(VBOX_JXPCOM_JAR)
189 $(VBOX_JAVAH) -classpath $(VBOX_JXPCOM_JDEST) -d $(VBOX_JXPCOM_JDEST) \
190 org.mozilla.xpcom.internal.XPCOMImpl \
191 org.mozilla.xpcom.internal.GREImpl \
192 org.mozilla.xpcom.internal.MozillaImpl \
193 org.mozilla.xpcom.internal.XPCOMJavaProxy \
194 org.mozilla.xpcom.ProfileLock \
195 org.mozilla.xpcom.internal.JavaXPCOMMethods
196
197#
198# Generate error constants.
199#
200$(VBOX_JXPCOM_NSERROR): $(VBOX_PATH_XPCOM_SRC)/xpcom/base/nsError.h $(VBOX_JXPCOM_SRC)/tools/gen-nsError.pl | $(VBOX_JXPCOM_GEN)/java/
201 perl $(VBOX_JXPCOM_SRC)/tools/gen-nsError.pl < $< > $@
202
203ifndef VBOX_WITH_JAVA_SUPPORT_IN_XPIDL
204#
205# Generate .java interface files from XPCOM's typelib.
206#
207VBOX_TEMP_HOME=$(shell echo /tmp/vboxhome$$$$)
208$(VBOX_JXPCOM_GEN)/jxpcomgen.list: $(GENJIFACES_BIN) $(PATH_TARGET)/VBox-xpcom-xpt-files/VBoxXPCOMBase.xpt | $(VBOX_JXPCOM_GEN)/java/
209 $(QUIET)echo Generating Java interface files
210 $(call preprocess_exebld,$(GENJIFACES_BIN))
211 $(QUIET) $(MKDIR) -p $(VBOX_TEMP_HOME)
212 VBOX_USER_HOME=$(VBOX_TEMP_HOME) $(GENJIFACES_BIN) -d $(VBOX_JXPCOM_GEN)/java
213 $(QUIET) rm -rf $(VBOX_TEMP_HOME)
214 $(QUIET)echo $$(ls $(VBOX_JXPCOM_GEN)/java/*.java) > $@
215
216else # VBOX_WITH_JAVA_SUPPORT_IN_XPIDL
217#
218# Generate .java interface files from the XPCOM and VirtualBox IDL files.
219#
220# Note! There is not a 1:1 relationship between input and output files here, unfortunately.
221# Note! VBOX_JXPCOM_NSERROR shares the output directory with us.
222#
223$(VBOX_JXPCOM_GEN)/jxpcomgen.list: \
224 $(VBOX_PATH_SDK)/bindings/xpcom/idl/VirtualBox_XPCOM.idl \
225 $$(addprefix $(VBOX_PATH_XPCOM_SRC)/,$$(XPCOM_IDLFILES)) \
226 $(VBOX_XPIDL) \
227 | $(VBOX_JXPCOM_GEN)/java/
228 $(call MSG_L1,Generating Java interface files from IDL)
229 $(QUIET)$(RM) -f $(filter-out %/XPCOMError.java, $(wildcard $(VBOX_JXPCOM_GEN)/java/*.java))
230 $(foreach idl, $(VBOX_PATH_SDK)/bindings/xpcom/idl/VirtualBox_XPCOM.idl $(addprefix $(VBOX_PATH_XPCOM_SRC)/,$(XPCOM_IDLFILES))\
231 , $(NLTAB)$(QUIET)$(VBOX_XPIDL) -m java $(XPIDL_INCS) -e $(VBOX_JXPCOM_GEN)/java/$(basename $(notdir $(idl))).java $(idl) )
232 $(QUIET)echo $(VBOX_JXPCOM_GEN)/java/*.java > $@
233endif # VBOX_WITH_JAVA_SUPPORT_IN_XPIDL
234
235#
236# Compile the all java code into a JAR file.
237#
238VBOX_JXPCOM_JSRC = $(VBOX_JXPCOM_SRC)/src/org/mozilla/xpcom
239VBOX_JXPCOM_JAR_SRC = \
240 $(VBOX_JXPCOM_JSRC)/IXPCOM.java \
241 $(VBOX_JXPCOM_JSRC)/Mozilla.java \
242 $(VBOX_JXPCOM_JSRC)/VersionComparator.java \
243 $(VBOX_JXPCOM_JSRC)/GREVersionRange.java \
244 $(VBOX_JXPCOM_JSRC)/IAppFileLocProvider.java \
245 $(VBOX_JXPCOM_JSRC)/ProfileLock.java \
246 $(VBOX_JXPCOM_JSRC)/IGRE.java \
247 $(VBOX_JXPCOM_JSRC)/IJavaXPCOMUtils.java \
248 $(VBOX_JXPCOM_JSRC)/XPCOMException.java \
249 $(VBOX_JXPCOM_JSRC)/IMozilla.java \
250 $(VBOX_JXPCOM_JSRC)/XPCOMInitializationException.java \
251 $(VBOX_JXPCOM_JSRC)/INIParser.java \
252 $(VBOX_JXPCOM_JSRC)/internal/GREImpl.java \
253 $(VBOX_JXPCOM_JSRC)/internal/JavaXPCOMMethods.java \
254 $(VBOX_JXPCOM_JSRC)/internal/MozillaImpl.java \
255 $(VBOX_JXPCOM_JSRC)/internal/XPCOMImpl.java \
256 $(VBOX_JXPCOM_JSRC)/internal/XPCOMJavaProxyBase.java \
257 $(VBOX_JXPCOM_JSRC)/internal/XPCOMJavaProxy.java
258VBOX_JXPCOM_MGR = \
259 $(VBOX_JXPCOM_SRC)/src/org/virtualbox/VirtualBoxManager.java \
260 $(VBOX_JXPCOM_SRC)/src/org/virtualbox/VBoxObjectBase.java
261
262$$(VBOX_JXPCOM_JAR): $(VBOX_JXPCOM_JAR_SRC) $(VBOX_JXPCOM_GEN)/jxpcomgen.list $(VBOX_JXPCOM_NSERROR) $(VBOX_JXPCOM_MGR) | $$(dir $$@)
263 $(call MSG_TOOL,javac,$(notdir $@),jxpcomgen.list,)
264 $(QUIET)$(RM) -Rf $(VBOX_JXPCOM_JDEST)
265 $(QUIET)$(MKDIR) -p $(VBOX_JXPCOM_JDEST)
266 $(VBOX_JAVAC) $(JAVAC_OPTS) @$ $(VBOX_JXPCOM_GEN)/jxpcomgen.list \
267 -d $(VBOX_JXPCOM_JDEST) -classpath $(VBOX_JXPCOM_JDEST)
268 $(call MSG_TOOL,javac,$(notdir $@),...,)
269 $(VBOX_JAVAC) $(JAVAC_OPTS) \
270 $(VBOX_JXPCOM_JAR_SRC) \
271 $(VBOX_JXPCOM_NSERROR) \
272 $(VBOX_JXPCOM_MGR) \
273 -d $(VBOX_JXPCOM_JDEST) -classpath $(VBOX_JXPCOM_JDEST)
274 $(call MSG_LINK,$(notdir $@),$@)
275 $(VBOX_JAR) cf $@ -C $(VBOX_JXPCOM_JDEST) .
276
277else # VBOX_ONLY_SDK
278 #
279 # Install sample code.
280 #
281 INSTALLS += jxpcomsample
282 jxpcomsample_INST = $(INST_SDK)bindings/xpcom/java
283 jxpcomsample_MODE = a+rx,u+w
284 jxpcomsample_SOURCES = \
285 tests/TestVBox.java=>samples/TestVBox.java \
286 tests/Makefile=>samples/Makefile
287endif # VBOX_ONLY_SDK
288
289include $(KBUILD_PATH)/subfooter.kmk
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette