1 | # $Id: Makefile.kmk 99040 2023-03-18 21:03:42Z vboxsync $
|
---|
2 | ## @file
|
---|
3 | # Sub-Makefile for Java bindings
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (C) 2010-2023 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 |
|
---|
28 | SUB_DEPTH = ../../../..
|
---|
29 | include $(KBUILD_PATH)/subheader.kmk
|
---|
30 |
|
---|
31 | #
|
---|
32 | # Globals
|
---|
33 | #
|
---|
34 | VBOX_JXPCOM_SRC := $(PATH_SUB_CURRENT)
|
---|
35 |
|
---|
36 | VBOX_JXPCOM_TARGET := $(PATH_TARGET)/vboxjxpcom-gen
|
---|
37 | VBOX_JXPCOM_JDEST := $(VBOX_JXPCOM_TARGET)/jdest
|
---|
38 |
|
---|
39 | VBOX_GLUE_XSLT_DIR := $(PATH_ROOT)/src/VBox/Main/glue
|
---|
40 |
|
---|
41 | ifndef 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_SOURCES = \
|
---|
62 | src/nsAppFileLocProviderProxy.cpp \
|
---|
63 | src/nsJavaWrapper.cpp \
|
---|
64 | src/nsJavaXPCOMBindingUtils.cpp \
|
---|
65 | src/nsJavaXPTCStub.cpp \
|
---|
66 | src/nsJavaXPTCStubWeakRef.cpp \
|
---|
67 | src/nsJavaXPCOMGlue.cpp \
|
---|
68 | src/nsJavaInterfaces.cpp
|
---|
69 | VBoxJXpcom_LIBS = \
|
---|
70 | $(PATH_STAGE_LIB)/VBoxCOM$(VBOX_SUFF_LIB) \
|
---|
71 | $(PATH_STAGE_BIN)/VBoxXPCOM$(VBOX_SUFF_DLL)
|
---|
72 |
|
---|
73 | #VBoxJXpcom_ORDERDEPS = $(VBOX_JXPCOM_GENH)
|
---|
74 | #VBoxJXpcom_CLEAN = $(VBOX_JXPCOM_GENH)
|
---|
75 | VBOX_JXPCOM_GENH = \
|
---|
76 | $(VBOX_JXPCOM_JDEST)/org_mozilla_xpcom_internal_XPCOMImpl.h \
|
---|
77 | $(VBOX_JXPCOM_JDEST)/org_mozilla_xpcom_internal_GREImpl.h \
|
---|
78 | $(VBOX_JXPCOM_JDEST)/org_mozilla_xpcom_internal_MozillaImpl.h \
|
---|
79 | $(VBOX_JXPCOM_JDEST)/org_mozilla_xpcom_internal_XPCOMJavaProxy.h \
|
---|
80 | $(VBOX_JXPCOM_JDEST)/org_mozilla_xpcom_internal_JavaXPCOMMethods.h \
|
---|
81 | $(VBOX_JXPCOM_JDEST)/org_mozilla_xpcom_ProfileLock.h
|
---|
82 |
|
---|
83 | endif # !VBOX_ONLY_SDK
|
---|
84 |
|
---|
85 | #
|
---|
86 | # Install JAR files
|
---|
87 | #
|
---|
88 | INSTALLS += VBoxJXpcom-inst-jar
|
---|
89 |
|
---|
90 | VBOX_JXPCOM_JAR = $(VBoxJXpcom-inst-jar_0_OUTDIR)/vboxjxpcom.jar
|
---|
91 | VBOX_JXPCOM_NSERROR = $(VBOX_JXPCOM_GEN)/java/XPCOMError.java
|
---|
92 | ifndef VBOX_WITH_JAVA_SUPPORT_IN_XPIDL
|
---|
93 | VBOX_JXPCOM_GEN = $(VBOX_JXPCOM_TARGET)/jxpcomgen
|
---|
94 | else
|
---|
95 | VBOX_JXPCOM_GEN = $(VBOX_JXPCOM_TARGET)/jxpcomgen-idl
|
---|
96 | endif
|
---|
97 |
|
---|
98 | VBoxJXpcom-inst-jar_INST = $(INST_SDK)bindings/xpcom/java/
|
---|
99 | VBoxJXpcom-inst-jar_MODE = a+r,u+w
|
---|
100 | VBoxJXpcom-inst-jar_SOURCES = \
|
---|
101 | $(VBOX_JXPCOM_JAR)
|
---|
102 | VBoxJXpcom-inst-jar_CLEAN = \
|
---|
103 | $(VBOX_JXPCOM_JAR) \
|
---|
104 | $(VBOX_JXPCOM_NSERROR) \
|
---|
105 | $(VBOX_JXPCOM_GEN)/jxpcomgen.list \
|
---|
106 | $(VBOX_JXPCOM_GEN)/jxpcomglue.list \
|
---|
107 | $(wildcard \
|
---|
108 | $(VBOX_JXPCOM_GEN)/java/*.java \
|
---|
109 | $(VBOX_JXPCOM_GEN)/java/glue/*.java \
|
---|
110 | $(VBOX_JXPCOM_JDEST)/*.class \
|
---|
111 | $(VBOX_JXPCOM_JDEST)/*/*.class \
|
---|
112 | $(VBOX_JXPCOM_JDEST)/*/*/*.class \
|
---|
113 | $(VBOX_JXPCOM_JDEST)/*/*/*/*.class \
|
---|
114 | $(VBOX_JXPCOM_JDEST)/*/*/*/*/*.class \
|
---|
115 | $(VBOX_JXPCOM_JDEST)/*/*/*/*/*/*.class \
|
---|
116 | )
|
---|
117 | VBoxJXpcom-inst-jar_BLDDIRS += $(VBOX_JXPCOM_GEN)/java $(VBOX_JXPCOM_GEN)/java/glue $(VBOX_JXPCOM_GEN)/java/interfaces
|
---|
118 |
|
---|
119 | #
|
---|
120 | # For VBoxJXpcom, not currently used.
|
---|
121 | #
|
---|
122 | $(VBOX_JXPCOM_GENH): $$(VBOX_JXPCOM_JAR)
|
---|
123 | $(call MSG_L1,Generating $@ from $<)
|
---|
124 | $(QUIET)$(VBOX_JAVAH) -classpath $(VBOX_JXPCOM_JDEST) -d $(VBOX_JXPCOM_JDEST) \
|
---|
125 | org.mozilla.xpcom.internal.XPCOMImpl \
|
---|
126 | org.mozilla.xpcom.internal.GREImpl \
|
---|
127 | org.mozilla.xpcom.internal.MozillaImpl \
|
---|
128 | org.mozilla.xpcom.internal.XPCOMJavaProxy \
|
---|
129 | org.mozilla.xpcom.ProfileLock \
|
---|
130 | org.mozilla.xpcom.internal.JavaXPCOMMethods
|
---|
131 |
|
---|
132 | #
|
---|
133 | # Generate error constants.
|
---|
134 | #
|
---|
135 | $(VBOX_JXPCOM_NSERROR): $(VBOX_PATH_XPCOM_SRC)/xpcom/base/nsError.h $(VBOX_JXPCOM_SRC)/tools/gen-nsError.pl | $(VBOX_JXPCOM_GEN)/java/
|
---|
136 | $(call MSG_L1,Generating $@)
|
---|
137 | $(QUIET)perl $(VBOX_JXPCOM_SRC)/tools/gen-nsError.pl < $< > $@
|
---|
138 |
|
---|
139 | ifndef VBOX_WITH_JAVA_SUPPORT_IN_XPIDL
|
---|
140 | #
|
---|
141 | # Generate .java interface files from .xidl
|
---|
142 | #
|
---|
143 |
|
---|
144 | $(VBOX_JXPCOM_GEN)/jxpcomgen.list: \
|
---|
145 | $(VBOX_XIDL_FILE) \
|
---|
146 | $(VBOX_FILESPLIT) \
|
---|
147 | $(VBOX_JXPCOM_SRC)/tools/genjifaces.xsl \
|
---|
148 | | $(VBOX_JXPCOM_GEN)/java/interfaces/
|
---|
149 | $(call MSG_L1,Generating Java interface files)
|
---|
150 | $(QUIET)$(RM) -f $(wildcard $(VBOX_JXPCOM_GEN)/java/interfaces/*.java)
|
---|
151 | $(QUIET)$(VBOX_XSLTPROC) \
|
---|
152 | -o $(VBOX_JXPCOM_GEN)/java/interfaces/merged.file $(VBOX_JXPCOM_SRC)/tools/genjifaces.xsl $<
|
---|
153 | $(QUIET)$(VBOX_FILESPLIT) $(VBOX_JXPCOM_GEN)/java/interfaces/merged.file $(VBOX_JXPCOM_GEN)/java/interfaces
|
---|
154 | $(QUIET)echo $(VBOX_JXPCOM_GEN)/java/interfaces/*.java > $@
|
---|
155 |
|
---|
156 | else # VBOX_WITH_JAVA_SUPPORT_IN_XPIDL
|
---|
157 | #
|
---|
158 | # Generate .java interface files from the XPCOM and VirtualBox IDL files.
|
---|
159 | #
|
---|
160 | # Note! There is not a 1:1 relationship between input and output files here, unfortunately.
|
---|
161 | # Note! VBOX_JXPCOM_NSERROR shares the output directory with us.
|
---|
162 | #
|
---|
163 | $(VBOX_JXPCOM_GEN)/jxpcomgen.list: \
|
---|
164 | $(VBOX_PATH_SDK)/bindings/xpcom/idl/VirtualBox_XPCOM.idl \
|
---|
165 | $$(addprefix $(VBOX_PATH_XPCOM_SRC)/,$$(XPCOM_IDLFILES)) \
|
---|
166 | $(VBOX_XPIDL) \
|
---|
167 | | $(VBOX_JXPCOM_GEN)/java/
|
---|
168 | $(call MSG_L1,Generating XPCOM Java interface files from IDL)
|
---|
169 | $(QUIET)$(RM) -f $(filter-out %/XPCOMError.java, $(wildcard $(VBOX_JXPCOM_GEN)/java/*.java))
|
---|
170 | $(foreach idl, $(VBOX_PATH_SDK)/bindings/xpcom/idl/VirtualBox_XPCOM.idl $(addprefix $(VBOX_PATH_XPCOM_SRC)/,$(XPCOM_IDLFILES))\
|
---|
171 | , $(NLTAB)$(QUIET)$(VBOX_XPIDL) -m java $(XPIDL_INCS) -e $(VBOX_JXPCOM_GEN)/java/$(basename $(notdir $(idl))).java $(idl) )
|
---|
172 | $(QUIET)echo $(VBOX_JXPCOM_GEN)/java/*.java > $@
|
---|
173 | endif # VBOX_WITH_JAVA_SUPPORT_IN_XPIDL
|
---|
174 |
|
---|
175 | $(VBOX_JXPCOM_GEN)/jxpcomglue.list: \
|
---|
176 | $(VBOX_XIDL_FILE) \
|
---|
177 | $(VBOX_GLUE_XSLT_DIR)/glue-java.xsl \
|
---|
178 | $(VBOX_FILESPLIT) \
|
---|
179 | | $(VBOX_JXPCOM_GEN)/java/glue/
|
---|
180 | $(call MSG_L1,Generating Java glue files from XIDL)
|
---|
181 | $(QUIET)$(RM) -f $(wildcard $(VBOX_JXPCOM_GEN)/java/glue/*.java)
|
---|
182 | $(QUIET)$(VBOX_XSLTPROC) \
|
---|
183 | --stringparam filelistonly "" \
|
---|
184 | --stringparam G_vboxApiSuffix $(VBOX_API_SUFFIX) \
|
---|
185 | --stringparam G_vboxGlueStyle xpcom \
|
---|
186 | --stringparam G_vboxDirPrefix "" \
|
---|
187 | -o $(VBOX_JXPCOM_GEN)/java/glue/merged.file $(VBOX_GLUE_XSLT_DIR)/glue-java.xsl $<
|
---|
188 | $(QUIET)$(VBOX_FILESPLIT) $(VBOX_JXPCOM_GEN)/java/glue/merged.file $(VBOX_JXPCOM_GEN)/java/glue/
|
---|
189 | $(QUIET)echo $(VBOX_JXPCOM_GEN)/java/glue/*.java > $@
|
---|
190 |
|
---|
191 | #
|
---|
192 | # Compile the all java code into a JAR file.
|
---|
193 | #
|
---|
194 | VBOX_JXPCOM_JSRC = $(VBOX_JXPCOM_SRC)/src/org/mozilla/xpcom
|
---|
195 | VBOX_JXPCOM_JAR_SRC = \
|
---|
196 | $(VBOX_JXPCOM_JSRC)/IXPCOM.java \
|
---|
197 | $(VBOX_JXPCOM_JSRC)/Mozilla.java \
|
---|
198 | $(VBOX_JXPCOM_JSRC)/VersionComparator.java \
|
---|
199 | $(VBOX_JXPCOM_JSRC)/GREVersionRange.java \
|
---|
200 | $(VBOX_JXPCOM_JSRC)/IAppFileLocProvider.java \
|
---|
201 | $(VBOX_JXPCOM_JSRC)/ProfileLock.java \
|
---|
202 | $(VBOX_JXPCOM_JSRC)/IGRE.java \
|
---|
203 | $(VBOX_JXPCOM_JSRC)/IJavaXPCOMUtils.java \
|
---|
204 | $(VBOX_JXPCOM_JSRC)/XPCOMException.java \
|
---|
205 | $(VBOX_JXPCOM_JSRC)/IMozilla.java \
|
---|
206 | $(VBOX_JXPCOM_JSRC)/XPCOMInitializationException.java \
|
---|
207 | $(VBOX_JXPCOM_JSRC)/INIParser.java \
|
---|
208 | $(VBOX_JXPCOM_JSRC)/internal/GREImpl.java \
|
---|
209 | $(VBOX_JXPCOM_JSRC)/internal/JavaXPCOMMethods.java \
|
---|
210 | $(VBOX_JXPCOM_JSRC)/internal/MozillaImpl.java \
|
---|
211 | $(VBOX_JXPCOM_JSRC)/internal/XPCOMImpl.java \
|
---|
212 | $(VBOX_JXPCOM_JSRC)/internal/XPCOMJavaProxyBase.java \
|
---|
213 | $(VBOX_JXPCOM_JSRC)/internal/XPCOMJavaProxy.java
|
---|
214 |
|
---|
215 | $$(VBOX_JXPCOM_JAR): $(VBOX_JXPCOM_JAR_SRC) $(VBOX_JXPCOM_GEN)/jxpcomgen.list $(VBOX_JXPCOM_GEN)/jxpcomglue.list $(VBOX_JXPCOM_NSERROR) $(VBOX_JXPCOM_MGR) | $$(dir $$@)
|
---|
216 | $(call MSG_TOOL,javac,$(notdir $@),jxpcomgen.list,)
|
---|
217 | $(QUIET)$(RM) -Rf $(VBOX_JXPCOM_JDEST)
|
---|
218 | $(QUIET)$(MKDIR) -p $(VBOX_JXPCOM_JDEST)
|
---|
219 | $(QUIET)$(VBOX_JAVAC) $(VBOX_JAVAC_OPTS) @$(VBOX_JXPCOM_GEN)/jxpcomgen.list \
|
---|
220 | -d $(VBOX_JXPCOM_JDEST) -classpath $(VBOX_JXPCOM_JDEST)
|
---|
221 | $(call MSG_TOOL,javac,$(notdir $@),...,)
|
---|
222 | $(QUIET)$(VBOX_JAVAC) $(VBOX_JAVAC_OPTS) \
|
---|
223 | $(VBOX_JXPCOM_JAR_SRC) \
|
---|
224 | $(VBOX_JXPCOM_NSERROR) \
|
---|
225 | @$(VBOX_JXPCOM_GEN)/jxpcomglue.list \
|
---|
226 | -d $(VBOX_JXPCOM_JDEST) -classpath $(VBOX_JXPCOM_JDEST)
|
---|
227 | $(call MSG_LINK,$(notdir $@),$@)
|
---|
228 | $(QUIET)$(VBOX_JAR) cf $@ -C $(VBOX_JXPCOM_JDEST) .
|
---|
229 |
|
---|
230 | include $(FILE_KBUILD_SUB_FOOTER)
|
---|