1 | # $Id: Makefile.kmk 29110 2010-05-05 20:28:28Z 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 | VBOX_JXPCOM_SRC := $(PATH_SUB_CURRENT)
|
---|
22 |
|
---|
23 | ifeq ($(KBUILD_TARGET), darwin)
|
---|
24 | VBOX_JAVA_HOME = /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0
|
---|
25 | VBOX_JAVAC = $(VBOX_JAVA_HOME)/Commands/javac
|
---|
26 | VBOX_JAVAH = $(VBOX_JAVA_HOME)/Commands/javah
|
---|
27 | VBOX_JAR = $(VBOX_JAVA_HOME)/Commands/jar
|
---|
28 | VBOX_JAVA_INC = $(VBOX_JAVA_HOME)/Headers
|
---|
29 | else
|
---|
30 | ifeq ($(KBUILD_TARGET), linux)
|
---|
31 | VBOX_JAVA_HOME ?= /usr/lib/jvm/java-1.5.0-sun
|
---|
32 | endif
|
---|
33 | ifeq ($(KBUILD_TARGET), solaris)
|
---|
34 | # VBOX_JAVA_HOME ?= /usr/jdk/jdk1.5.0
|
---|
35 | VBOX_JAVA_HOME ?= /usr/java
|
---|
36 | endif
|
---|
37 | VBOX_JAVAC = $(VBOX_JAVA_HOME)/bin/javac
|
---|
38 | VBOX_JAVAH = $(VBOX_JAVA_HOME)/bin/javah
|
---|
39 | VBOX_JAR = $(VBOX_JAVA_HOME)/bin/jar
|
---|
40 | # correct for targets we care about
|
---|
41 | VBOX_MD_OS = $(KBUILD_TARGET)
|
---|
42 | VBOX_JAVA_INC = $(VBOX_JAVA_HOME)/include \
|
---|
43 | $(VBOX_JAVA_HOME)/include/$(VBOX_MD_OS)
|
---|
44 | endif
|
---|
45 |
|
---|
46 | VBOX_JXPCOM_TARGET = $(PATH_TARGET)/vboxjxpcom
|
---|
47 | VBOX_JXPCOM_JDEST := $(VBOX_JXPCOM_TARGET)/jdest
|
---|
48 |
|
---|
49 | VBOX_JXPCOM_GENH = \
|
---|
50 | $(VBOX_JXPCOM_JDEST)/org_mozilla_xpcom_internal_XPCOMImpl.h \
|
---|
51 | $(VBOX_JXPCOM_JDEST)/org_mozilla_xpcom_internal_GREImpl.h \
|
---|
52 | $(VBOX_JXPCOM_JDEST)/org_mozilla_xpcom_internal_MozillaImpl.h \
|
---|
53 | $(VBOX_JXPCOM_JDEST)/org_mozilla_xpcom_internal_XPCOMJavaProxy.h \
|
---|
54 | $(VBOX_JXPCOM_JDEST)/org_mozilla_xpcom_internal_JavaXPCOMMethods.h \
|
---|
55 | $(VBOX_JXPCOM_JDEST)/org_mozilla_xpcom_ProfileLock.h
|
---|
56 |
|
---|
57 | VBoxJXpcom_TEMPLATE = XPCOM
|
---|
58 | VBoxJXpcom_CXXFLAGS = -Wno-write-strings
|
---|
59 | VBoxJXpcom_DEFS = \
|
---|
60 | EXPORT_XPTI_API \
|
---|
61 | EXPORT_XPT_API \
|
---|
62 | VBOX_WITH_XPCOM
|
---|
63 | VBoxJXpcom_DEFS.darwin = XP_MACOSX
|
---|
64 | VBoxJXpcom_NAME = libvboxjxpcom
|
---|
65 | VBoxJXpcom_DLLSUFF.darwin = .jnilib
|
---|
66 | VBoxJXpcom_INCS = \
|
---|
67 | src \
|
---|
68 | $(VBOX_JAVA_INC) \
|
---|
69 | $(VBOX_PATH_XPCOM_SRC)/xpcom/glue \
|
---|
70 | $(VBOX_PATH_XPCOM_SRC)/xpcom/build \
|
---|
71 | $(VBOX_JXPCOM_JDEST)
|
---|
72 | VBoxJXpcom_SOURCES = \
|
---|
73 | src/nsAppFileLocProviderProxy.cpp \
|
---|
74 | src/nsJavaWrapper.cpp \
|
---|
75 | src/nsJavaXPCOMBindingUtils.cpp \
|
---|
76 | src/nsJavaXPTCStub.cpp \
|
---|
77 | src/nsJavaXPTCStubWeakRef.cpp \
|
---|
78 | src/nsJavaXPCOMGlue.cpp \
|
---|
79 | src/nsJavaInterfaces.cpp
|
---|
80 | VBoxJXpcom_LIBS = \
|
---|
81 | $(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB) \
|
---|
82 | $(PATH_BIN)/VBoxXPCOM$(VBOX_SUFF_DLL)
|
---|
83 |
|
---|
84 | src/nsJavaInterfaces.cpp_DEPS = $(VBOX_JXPCOM_GENH)
|
---|
85 |
|
---|
86 | DLLS += VBoxJXpcom
|
---|
87 |
|
---|
88 | #
|
---|
89 | # genjifaces
|
---|
90 | #
|
---|
91 | BLDPROGS += genjifaces
|
---|
92 | TEMPLATE_XPCOMEXEBLD = XPCOM Build executable
|
---|
93 | TEMPLATE_XPCOMEXEBLD_EXTENDS = XPCOMBLDPROG
|
---|
94 | TEMPLATE_XPCOMEXEBLD_EXTENDS_BY = appending
|
---|
95 | TEMPLATE_XPCOMEXEBLD_CXXFLAGS = $(TEMPLATE_XPCOM_CXXFLAGS)
|
---|
96 | TEMPLATE_XPCOMEXEBLD_INCS = \
|
---|
97 | $(TEMPLATE_XPCOM_INCS) \
|
---|
98 | $(VBOX_PATH_XPCOM_SRC) \
|
---|
99 | $(VBOX_PATH_XPCOM_SRC)/xpcom/build \
|
---|
100 | $(VBOX_PATH_XPCOM_SRC)/xpcom/ds
|
---|
101 | TEMPLATE_XPCOMEXEBLD_DEFS = VBOX_WITH_XPCOM
|
---|
102 | TEMPLATE_XPCOMEXEBLD_LIBS = $(VBoxXPCOM_LIBS) $(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB)
|
---|
103 | TEMPLATE_XPCOMEXEBLD_INCS.darwin = $(TEMPLATE_XPCOM_INCS.darwin)
|
---|
104 | TEMPLATE_XPCOMEXEBLD_LDFLAGS.darwin = \
|
---|
105 | -framework CoreServices \
|
---|
106 | -framework CoreFoundation \
|
---|
107 | -framework Foundation \
|
---|
108 | -framework AppKit \
|
---|
109 | -framework Carbon
|
---|
110 |
|
---|
111 | ifeq ($(KBUILD_TARGET),darwin)
|
---|
112 | define preprocess_exebld
|
---|
113 | $(shell install_name_tool -change $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxRT.dylib $(PATH_BIN)/VBoxRT$(VBOX_SUFF_DLL) $(1))
|
---|
114 | endef
|
---|
115 | else
|
---|
116 | define preprocess_exebld
|
---|
117 | endef
|
---|
118 | endif
|
---|
119 |
|
---|
120 | genjifaces_TEMPLATE = XPCOMEXEBLD
|
---|
121 | genjifaces_INCS = \
|
---|
122 | src
|
---|
123 | genjifaces_DEFS = \
|
---|
124 | EXPORT_XPTI_API \
|
---|
125 | EXPORT_XPT_API
|
---|
126 |
|
---|
127 | genjifaces_SOURCES = \
|
---|
128 | ../xpcom/build/nsStringAPI.cpp \
|
---|
129 | ../xpcom/build/nsXPComInit.cpp \
|
---|
130 | tools/genifaces/GenerateJavaInterfaces.cpp \
|
---|
131 | src/nsFileStreams.cpp
|
---|
132 | genjifaces_INST = $(INST_BIN)
|
---|
133 | GENJIFACES_BIN := $(PATH_BIN)/genjifaces$(HOSTSUFF_EXE)
|
---|
134 |
|
---|
135 | #
|
---|
136 | # Install JAR files
|
---|
137 | #
|
---|
138 | INSTALLS += VBoxJXpcom-inst-jar
|
---|
139 |
|
---|
140 | VBOX_JXPCOM_JAR = $(VBOX_JXPCOM_TARGET)/vboxjxpcom.jar
|
---|
141 | VBOX_JXPCOM_JSRC = $(VBOX_JXPCOM_SRC)/src/org/mozilla/xpcom
|
---|
142 | VBOX_JXPCOM_JGEN = $(PATH_TARGET)/vboxjgen
|
---|
143 |
|
---|
144 | VBoxJXpcom-inst-jar_INST = $(INST_SDK)bindings/xpcom/java
|
---|
145 | VBoxJXpcom-inst-jar_SOURCES = $(VBOX_JXPCOM_JAR)
|
---|
146 |
|
---|
147 | JXPCOM_JAR_SRC= $(VBOX_JXPCOM_JSRC)/IXPCOM.java \
|
---|
148 | $(VBOX_JXPCOM_JSRC)/Mozilla.java \
|
---|
149 | $(VBOX_JXPCOM_JSRC)/VersionComparator.java \
|
---|
150 | $(VBOX_JXPCOM_JSRC)/GREVersionRange.java \
|
---|
151 | $(VBOX_JXPCOM_JSRC)/IAppFileLocProvider.java \
|
---|
152 | $(VBOX_JXPCOM_JSRC)/ProfileLock.java \
|
---|
153 | $(VBOX_JXPCOM_JSRC)/IGRE.java \
|
---|
154 | $(VBOX_JXPCOM_JSRC)/IJavaXPCOMUtils.java \
|
---|
155 | $(VBOX_JXPCOM_JSRC)/XPCOMException.java \
|
---|
156 | $(VBOX_JXPCOM_JSRC)/IMozilla.java \
|
---|
157 | $(VBOX_JXPCOM_JSRC)/XPCOMInitializationException.java \
|
---|
158 | $(VBOX_JXPCOM_JSRC)/INIParser.java \
|
---|
159 | $(VBOX_JXPCOM_JSRC)/internal/GREImpl.java \
|
---|
160 | $(VBOX_JXPCOM_JSRC)/internal/JavaXPCOMMethods.java \
|
---|
161 | $(VBOX_JXPCOM_JSRC)/internal/MozillaImpl.java \
|
---|
162 | $(VBOX_JXPCOM_JSRC)/internal/XPCOMImpl.java \
|
---|
163 | $(VBOX_JXPCOM_JSRC)/internal/XPCOMJavaProxyBase.java \
|
---|
164 | $(VBOX_JXPCOM_JSRC)/internal/XPCOMJavaProxy.java
|
---|
165 |
|
---|
166 | VBOX_JXPCOM_GEN = $(VBOX_JXPCOM_TARGET)/jxpcomgen
|
---|
167 |
|
---|
168 | VBOX_JXPCOM_NSERROR = $(VBOX_JXPCOM_GEN)/java/XPCOMError.java
|
---|
169 | VBOX_JXPCOM_MGR = $(VBOX_JXPCOM_SRC)/src/org/virtualbox/VirtualBoxManager.java
|
---|
170 |
|
---|
171 | $(VBOX_JXPCOM_GENH): $(VBOX_JXPCOM_JAR)
|
---|
172 | $(VBOX_JAVAH) -classpath $(VBOX_JXPCOM_JDEST) -d $(VBOX_JXPCOM_JDEST) \
|
---|
173 | org.mozilla.xpcom.internal.XPCOMImpl \
|
---|
174 | org.mozilla.xpcom.internal.GREImpl \
|
---|
175 | org.mozilla.xpcom.internal.MozillaImpl \
|
---|
176 | org.mozilla.xpcom.internal.XPCOMJavaProxy \
|
---|
177 | org.mozilla.xpcom.ProfileLock \
|
---|
178 | org.mozilla.xpcom.internal.JavaXPCOMMethods
|
---|
179 |
|
---|
180 | $(VBOX_JXPCOM_GEN):
|
---|
181 | $(QUIET)$(MKDIR) -p $(VBOX_JXPCOM_GEN)
|
---|
182 |
|
---|
183 | $(VBOX_JXPCOM_GEN)/java:
|
---|
184 | $(QUIET)$(MKDIR) -p $(VBOX_JXPCOM_GEN)/java
|
---|
185 |
|
---|
186 | $(VBOX_JXPCOM_NSERROR): $(VBOX_PATH_XPCOM_SRC)/xpcom/base/nsError.h $(VBOX_JXPCOM_SRC)/tools/gen-nsError.pl $(VBOX_JXPCOM_GEN)/java
|
---|
187 | perl $(VBOX_JXPCOM_SRC)/tools/gen-nsError.pl < $< > $@
|
---|
188 |
|
---|
189 | $(VBOX_JXPCOM_GEN)/jxpcomgen.list: $(GENJIFACES_BIN) $(PATH_TARGET)/VBox-xpcom-xpt-files/VBoxXPCOMBase.xpt $(VBOX_JXPCOM_GEN)
|
---|
190 | $(QUIET)echo Generating Java interface files
|
---|
191 | $(QUIET)$(MKDIR) -p $(VBOX_JXPCOM_GEN)/java
|
---|
192 | $(call preprocess_exebld,$(GENJIFACES_BIN))
|
---|
193 | $(GENJIFACES_BIN) -d $(VBOX_JXPCOM_GEN)/java
|
---|
194 | $(QUIET)echo $$(ls $(VBOX_JXPCOM_GEN)/java/*.java) > $@
|
---|
195 |
|
---|
196 | $(VBOX_JXPCOM_JAR): $(JXPCOM_JAR_SRC) $(VBOX_JXPCOM_GEN)/jxpcomgen.list $(VBOX_JXPCOM_NSERROR) $(VBOX_JXPCOM_MGR)
|
---|
197 | $(QUIET)$(RM) -Rf $(VBOX_JXPCOM_JDEST)
|
---|
198 | $(QUIET)$(MKDIR) -p $(VBOX_JXPCOM_JDEST)
|
---|
199 | $(VBOX_JAVAC) @$ $(VBOX_JXPCOM_GEN)/jxpcomgen.list \
|
---|
200 | -d $(VBOX_JXPCOM_JDEST) -classpath $(VBOX_JXPCOM_JDEST)
|
---|
201 | $(VBOX_JAVAC) $(JXPCOM_JAR_SRC) \
|
---|
202 | $(VBOX_JXPCOM_NSERROR) $(VBOX_JXPCOM_MGR) \
|
---|
203 | -d $(VBOX_JXPCOM_JDEST) -classpath $(VBOX_JXPCOM_JDEST)
|
---|
204 | $(VBOX_JAR) cf $@ -C $(VBOX_JXPCOM_TARGET)/jdest .
|
---|
205 |
|
---|
206 |
|
---|
207 | ifdef VBOX_ONLY_SDK
|
---|
208 | #
|
---|
209 | # Install sample code.
|
---|
210 | #
|
---|
211 | INSTALLS += jxpcomsample
|
---|
212 | jxpcomsample_INST = $(INST_SDK)bindings/xpcom/java
|
---|
213 | jxpcomsample_MODE = a+rx,u+w
|
---|
214 | jxpcomsample_SOURCES = \
|
---|
215 | tests/TestVBox.java=>samples/TestVBox.java \
|
---|
216 | tests/Makefile=>samples/Makefiles
|
---|
217 | endif
|
---|
218 |
|
---|
219 | include $(KBUILD_PATH)/subfooter.kmk
|
---|