VirtualBox

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

Last change on this file since 106061 was 106061, checked in by vboxsync, 3 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.4 KB
Line 
1# $Id: Makefile.kmk 106061 2024-09-16 14:03:52Z vboxsync $
2## @file
3# Sub-Makefile for Java bindings
4#
5
6#
7# Copyright (C) 2010-2024 Oracle and/or its affiliates.
8#
9# This file is part of VirtualBox base platform packages, as
10# available from https://www.virtualbox.org.
11#
12# This program is free software; you can redistribute it and/or
13# modify it under the terms of the GNU General Public License
14# as published by the Free Software Foundation, in version 3 of the
15# License.
16#
17# This program is distributed in the hope that it will be useful, but
18# WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20# General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
23# along with this program; if not, see <https://www.gnu.org/licenses>.
24#
25# SPDX-License-Identifier: GPL-3.0-only
26#
27
28SUB_DEPTH = ../../../..
29include $(KBUILD_PATH)/subheader.kmk
30
31#
32# Globals
33#
34VBOX_JXPCOM_SRC := $(PATH_SUB_CURRENT)
35
36VBOX_JXPCOM_TARGET := $(PATH_TARGET)/vboxjxpcom-gen
37VBOX_JXPCOM_JDEST := $(VBOX_JXPCOM_TARGET)/jdest
38
39VBOX_GLUE_XSLT_DIR := $(PATH_ROOT)/src/VBox/Main/glue
40
41ifndef VBOX_ONLY_SDK
42 #
43 # VBoxJXpcom - Java<->XPCOM native library
44 #
45 DLLS += VBoxJXpcom
46
47 VBoxJXpcom_TEMPLATE = XPComDll
48 VBoxJXpcom_CXXFLAGS = -Wno-write-strings
49 VBoxJXpcom_DEFS = \
50 EXPORT_XPTI_API \
51 EXPORT_XPT_API \
52 VBOX_WITH_XPCOM
53 VBoxJXpcom_NAME = libvboxjxpcom
54 VBoxJXpcom_DLLSUFF.darwin = .jnilib
55 VBoxJXpcom_INCS = \
56 src \
57 $(VBOX_JAVA_INC) \
58 $(VBOX_PATH_XPCOM_SRC)/xpcom/glue \
59 $(VBOX_PATH_XPCOM_SRC)/xpcom/build \
60 $(VBOX_JXPCOM_JDEST)
61 VBoxJXpcom_INCS.darwin += \
62 $(VBOX_JAVA_INC)/darwin
63 VBoxJXpcom_SOURCES = \
64 src/nsAppFileLocProviderProxy.cpp \
65 src/nsJavaWrapper.cpp \
66 src/nsJavaXPCOMBindingUtils.cpp \
67 src/nsJavaXPTCStub.cpp \
68 src/nsJavaXPTCStubWeakRef.cpp \
69 src/nsJavaXPCOMGlue.cpp \
70 src/nsJavaInterfaces.cpp
71 VBoxJXpcom_LIBS = \
72 $(PATH_STAGE_LIB)/VBoxCOM$(VBOX_SUFF_LIB) \
73 $(PATH_STAGE_BIN)/VBoxXPCOM$(VBOX_SUFF_DLL)
74
75 #VBoxJXpcom_ORDERDEPS = $(VBOX_JXPCOM_GENH)
76 #VBoxJXpcom_CLEAN = $(VBOX_JXPCOM_GENH)
77 VBOX_JXPCOM_GENH = \
78 $(VBOX_JXPCOM_JDEST)/org_mozilla_xpcom_internal_XPCOMImpl.h \
79 $(VBOX_JXPCOM_JDEST)/org_mozilla_xpcom_internal_GREImpl.h \
80 $(VBOX_JXPCOM_JDEST)/org_mozilla_xpcom_internal_MozillaImpl.h \
81 $(VBOX_JXPCOM_JDEST)/org_mozilla_xpcom_internal_XPCOMJavaProxy.h \
82 $(VBOX_JXPCOM_JDEST)/org_mozilla_xpcom_internal_JavaXPCOMMethods.h \
83 $(VBOX_JXPCOM_JDEST)/org_mozilla_xpcom_ProfileLock.h
84
85endif # !VBOX_ONLY_SDK
86
87#
88# Install JAR files
89#
90INSTALLS += VBoxJXpcom-inst-jar
91
92VBOX_JXPCOM_JAR = $(VBoxJXpcom-inst-jar_0_OUTDIR)/vboxjxpcom.jar
93VBOX_JXPCOM_NSERROR = $(VBOX_JXPCOM_GEN)/java/XPCOMError.java
94ifndef VBOX_WITH_JAVA_SUPPORT_IN_XPIDL
95 VBOX_JXPCOM_GEN = $(VBOX_JXPCOM_TARGET)/jxpcomgen
96else
97 VBOX_JXPCOM_GEN = $(VBOX_JXPCOM_TARGET)/jxpcomgen-idl
98endif
99
100VBoxJXpcom-inst-jar_INST = $(INST_SDK)bindings/xpcom/java/
101VBoxJXpcom-inst-jar_MODE = a+r,u+w
102VBoxJXpcom-inst-jar_SOURCES = \
103 $(VBOX_JXPCOM_JAR)
104VBoxJXpcom-inst-jar_CLEAN = \
105 $(VBOX_JXPCOM_JAR) \
106 $(VBOX_JXPCOM_NSERROR) \
107 $(VBOX_JXPCOM_GEN)/jxpcomgen.list \
108 $(VBOX_JXPCOM_GEN)/jxpcomglue.list \
109 $(wildcard \
110 $(VBOX_JXPCOM_GEN)/java/*.java \
111 $(VBOX_JXPCOM_GEN)/java/glue/*.java \
112 $(VBOX_JXPCOM_JDEST)/*.class \
113 $(VBOX_JXPCOM_JDEST)/*/*.class \
114 $(VBOX_JXPCOM_JDEST)/*/*/*.class \
115 $(VBOX_JXPCOM_JDEST)/*/*/*/*.class \
116 $(VBOX_JXPCOM_JDEST)/*/*/*/*/*.class \
117 $(VBOX_JXPCOM_JDEST)/*/*/*/*/*/*.class \
118 )
119VBoxJXpcom-inst-jar_BLDDIRS += $(VBOX_JXPCOM_GEN)/java $(VBOX_JXPCOM_GEN)/java/glue $(VBOX_JXPCOM_GEN)/java/interfaces
120
121#
122# For VBoxJXpcom, not currently used.
123#
124$(VBOX_JXPCOM_GENH): $$(VBOX_JXPCOM_JAR)
125 $(call MSG_L1,Generating $@ from $<)
126 $(QUIET)$(VBOX_JAVAH) -classpath $(VBOX_JXPCOM_JDEST) -d $(VBOX_JXPCOM_JDEST) \
127 org.mozilla.xpcom.internal.XPCOMImpl \
128 org.mozilla.xpcom.internal.GREImpl \
129 org.mozilla.xpcom.internal.MozillaImpl \
130 org.mozilla.xpcom.internal.XPCOMJavaProxy \
131 org.mozilla.xpcom.ProfileLock \
132 org.mozilla.xpcom.internal.JavaXPCOMMethods
133
134#
135# Generate error constants.
136#
137$(VBOX_JXPCOM_NSERROR): $(VBOX_PATH_XPCOM_SRC)/xpcom/base/nsError.h $(VBOX_JXPCOM_SRC)/tools/gen-nsError.pl | $(VBOX_JXPCOM_GEN)/java/
138 $(call MSG_L1,Generating $@)
139 $(QUIET)perl $(VBOX_JXPCOM_SRC)/tools/gen-nsError.pl < $< > $@
140
141ifndef VBOX_WITH_JAVA_SUPPORT_IN_XPIDL
142 #
143 # Generate .java interface files from .xidl
144 #
145
146 $(VBOX_JXPCOM_GEN)/jxpcomgen.list: \
147 $(VBOX_XIDL_FILE) \
148 $(VBOX_FILESPLIT) \
149 $(VBOX_JXPCOM_SRC)/tools/genjifaces.xsl \
150 | $(VBOX_JXPCOM_GEN)/java/interfaces/
151 $(call MSG_L1,Generating Java interface files)
152 $(QUIET)$(RM) -f $(wildcard $(VBOX_JXPCOM_GEN)/java/interfaces/*.java)
153 $(QUIET)$(VBOX_XSLTPROC) \
154 -o $(VBOX_JXPCOM_GEN)/java/interfaces/merged.file $(VBOX_JXPCOM_SRC)/tools/genjifaces.xsl $<
155 $(QUIET)$(VBOX_FILESPLIT) $(VBOX_JXPCOM_GEN)/java/interfaces/merged.file $(VBOX_JXPCOM_GEN)/java/interfaces
156 $(QUIET)echo $(VBOX_JXPCOM_GEN)/java/interfaces/*.java > $@
157
158else # VBOX_WITH_JAVA_SUPPORT_IN_XPIDL
159 #
160 # Generate .java interface files from the XPCOM and VirtualBox IDL files.
161 #
162 # Note! There is not a 1:1 relationship between input and output files here, unfortunately.
163 # Note! VBOX_JXPCOM_NSERROR shares the output directory with us.
164 #
165 $(VBOX_JXPCOM_GEN)/jxpcomgen.list: \
166 $(VBOX_PATH_SDK)/bindings/xpcom/idl/VirtualBox_XPCOM.idl \
167 $$(addprefix $(VBOX_PATH_XPCOM_SRC)/,$$(XPCOM_IDLFILES)) \
168 $(VBOX_XPIDL) \
169 | $(VBOX_JXPCOM_GEN)/java/
170 $(call MSG_L1,Generating XPCOM Java interface files from IDL)
171 $(QUIET)$(RM) -f $(filter-out %/XPCOMError.java, $(wildcard $(VBOX_JXPCOM_GEN)/java/*.java))
172 $(foreach idl, $(VBOX_PATH_SDK)/bindings/xpcom/idl/VirtualBox_XPCOM.idl $(addprefix $(VBOX_PATH_XPCOM_SRC)/,$(XPCOM_IDLFILES))\
173 , $(NLTAB)$(QUIET)$(VBOX_XPIDL) -m java $(XPIDL_INCS) -e $(VBOX_JXPCOM_GEN)/java/$(basename $(notdir $(idl))).java $(idl) )
174 $(QUIET)echo $(VBOX_JXPCOM_GEN)/java/*.java > $@
175endif # VBOX_WITH_JAVA_SUPPORT_IN_XPIDL
176
177$(VBOX_JXPCOM_GEN)/jxpcomglue.list: \
178 $(VBOX_XIDL_FILE) \
179 $(VBOX_GLUE_XSLT_DIR)/glue-java.xsl \
180 $(VBOX_FILESPLIT) \
181 | $(VBOX_JXPCOM_GEN)/java/glue/
182 $(call MSG_L1,Generating Java glue files from XIDL)
183 $(QUIET)$(RM) -f $(wildcard $(VBOX_JXPCOM_GEN)/java/glue/*.java)
184 $(QUIET)$(VBOX_XSLTPROC) \
185 --stringparam filelistonly "" \
186 --stringparam G_vboxApiSuffix $(VBOX_API_SUFFIX) \
187 --stringparam G_vboxGlueStyle xpcom \
188 --stringparam G_vboxDirPrefix "" \
189 -o $(VBOX_JXPCOM_GEN)/java/glue/merged.file $(VBOX_GLUE_XSLT_DIR)/glue-java.xsl $<
190 $(QUIET)$(VBOX_FILESPLIT) $(VBOX_JXPCOM_GEN)/java/glue/merged.file $(VBOX_JXPCOM_GEN)/java/glue/
191 $(QUIET)echo $(VBOX_JXPCOM_GEN)/java/glue/*.java > $@
192
193#
194# Compile the all java code into a JAR file.
195#
196VBOX_JXPCOM_JSRC = $(VBOX_JXPCOM_SRC)/src/org/mozilla/xpcom
197VBOX_JXPCOM_JAR_SRC = \
198 $(VBOX_JXPCOM_JSRC)/IXPCOM.java \
199 $(VBOX_JXPCOM_JSRC)/Mozilla.java \
200 $(VBOX_JXPCOM_JSRC)/VersionComparator.java \
201 $(VBOX_JXPCOM_JSRC)/GREVersionRange.java \
202 $(VBOX_JXPCOM_JSRC)/IAppFileLocProvider.java \
203 $(VBOX_JXPCOM_JSRC)/ProfileLock.java \
204 $(VBOX_JXPCOM_JSRC)/IGRE.java \
205 $(VBOX_JXPCOM_JSRC)/IJavaXPCOMUtils.java \
206 $(VBOX_JXPCOM_JSRC)/XPCOMException.java \
207 $(VBOX_JXPCOM_JSRC)/IMozilla.java \
208 $(VBOX_JXPCOM_JSRC)/XPCOMInitializationException.java \
209 $(VBOX_JXPCOM_JSRC)/INIParser.java \
210 $(VBOX_JXPCOM_JSRC)/internal/GREImpl.java \
211 $(VBOX_JXPCOM_JSRC)/internal/JavaXPCOMMethods.java \
212 $(VBOX_JXPCOM_JSRC)/internal/MozillaImpl.java \
213 $(VBOX_JXPCOM_JSRC)/internal/XPCOMImpl.java \
214 $(VBOX_JXPCOM_JSRC)/internal/XPCOMJavaProxyBase.java \
215 $(VBOX_JXPCOM_JSRC)/internal/XPCOMJavaProxy.java
216
217$$(VBOX_JXPCOM_JAR): $(VBOX_JXPCOM_JAR_SRC) $(VBOX_JXPCOM_GEN)/jxpcomgen.list $(VBOX_JXPCOM_GEN)/jxpcomglue.list $(VBOX_JXPCOM_NSERROR) $(VBOX_JXPCOM_MGR) | $$(dir $$@)
218 $(call MSG_TOOL,javac,$(notdir $@),jxpcomgen.list,)
219 $(QUIET)$(RM) -Rf $(VBOX_JXPCOM_JDEST)
220 $(QUIET)$(MKDIR) -p $(VBOX_JXPCOM_JDEST)
221 $(QUIET)$(VBOX_JAVAC) $(VBOX_JAVAC_OPTS) @$(VBOX_JXPCOM_GEN)/jxpcomgen.list \
222 -d $(VBOX_JXPCOM_JDEST) -classpath $(VBOX_JXPCOM_JDEST)
223 $(call MSG_TOOL,javac,$(notdir $@),...,)
224 $(QUIET)$(VBOX_JAVAC) $(VBOX_JAVAC_OPTS) \
225 $(VBOX_JXPCOM_JAR_SRC) \
226 $(VBOX_JXPCOM_NSERROR) \
227 @$(VBOX_JXPCOM_GEN)/jxpcomglue.list \
228 -d $(VBOX_JXPCOM_JDEST) -classpath $(VBOX_JXPCOM_JDEST)
229 $(call MSG_LINK,$(notdir $@),$@)
230 $(QUIET)$(VBOX_JAR) cf $@ -C $(VBOX_JXPCOM_JDEST) .
231
232include $(FILE_KBUILD_SUB_FOOTER)
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