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