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