1 | # $Id: Makefile.kmk 29115 2010-05-05 21:44:53Z 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 | #VBoxJXpcom_ORDERDEPS = $(VBOX_JXPCOM_GENH)
|
---|
85 |
|
---|
86 | DLLS += VBoxJXpcom
|
---|
87 |
|
---|
88 | #
|
---|
89 | # genjifaces
|
---|
90 | #
|
---|
91 | PROGRAMS += 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.dylib $(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_DEPS = $(PATH_TARGET)/VBox-xpcom-idl-timestamp
|
---|
134 | GENJIFACES_BIN := $(PATH_BIN)/genjifaces$(HOSTSUFF_EXE)
|
---|
135 |
|
---|
136 | #
|
---|
137 | # Install JAR files
|
---|
138 | #
|
---|
139 | INSTALLS += VBoxJXpcom-inst-jar
|
---|
140 |
|
---|
141 | VBOX_JXPCOM_JAR = $(VBOX_JXPCOM_TARGET)/vboxjxpcom.jar
|
---|
142 | VBOX_JXPCOM_JSRC = $(VBOX_JXPCOM_SRC)/src/org/mozilla/xpcom
|
---|
143 | VBOX_JXPCOM_JGEN = $(PATH_TARGET)/vboxjgen
|
---|
144 |
|
---|
145 | VBoxJXpcom-inst-jar_INST = $(INST_SDK)bindings/xpcom/java
|
---|
146 | VBoxJXpcom-inst-jar_SOURCES = $(VBOX_JXPCOM_JAR)
|
---|
147 |
|
---|
148 | JXPCOM_JAR_SRC= $(VBOX_JXPCOM_JSRC)/IXPCOM.java \
|
---|
149 | $(VBOX_JXPCOM_JSRC)/Mozilla.java \
|
---|
150 | $(VBOX_JXPCOM_JSRC)/VersionComparator.java \
|
---|
151 | $(VBOX_JXPCOM_JSRC)/GREVersionRange.java \
|
---|
152 | $(VBOX_JXPCOM_JSRC)/IAppFileLocProvider.java \
|
---|
153 | $(VBOX_JXPCOM_JSRC)/ProfileLock.java \
|
---|
154 | $(VBOX_JXPCOM_JSRC)/IGRE.java \
|
---|
155 | $(VBOX_JXPCOM_JSRC)/IJavaXPCOMUtils.java \
|
---|
156 | $(VBOX_JXPCOM_JSRC)/XPCOMException.java \
|
---|
157 | $(VBOX_JXPCOM_JSRC)/IMozilla.java \
|
---|
158 | $(VBOX_JXPCOM_JSRC)/XPCOMInitializationException.java \
|
---|
159 | $(VBOX_JXPCOM_JSRC)/INIParser.java \
|
---|
160 | $(VBOX_JXPCOM_JSRC)/internal/GREImpl.java \
|
---|
161 | $(VBOX_JXPCOM_JSRC)/internal/JavaXPCOMMethods.java \
|
---|
162 | $(VBOX_JXPCOM_JSRC)/internal/MozillaImpl.java \
|
---|
163 | $(VBOX_JXPCOM_JSRC)/internal/XPCOMImpl.java \
|
---|
164 | $(VBOX_JXPCOM_JSRC)/internal/XPCOMJavaProxyBase.java \
|
---|
165 | $(VBOX_JXPCOM_JSRC)/internal/XPCOMJavaProxy.java
|
---|
166 |
|
---|
167 | VBOX_JXPCOM_GEN = $(VBOX_JXPCOM_TARGET)/jxpcomgen
|
---|
168 |
|
---|
169 | VBOX_JXPCOM_NSERROR = $(VBOX_JXPCOM_GEN)/java/XPCOMError.java
|
---|
170 | VBOX_JXPCOM_MGR = $(VBOX_JXPCOM_SRC)/src/org/virtualbox/VirtualBoxManager.java
|
---|
171 |
|
---|
172 | $(VBOX_JXPCOM_GENH): $(VBOX_JXPCOM_JAR)
|
---|
173 | $(VBOX_JAVAH) -classpath $(VBOX_JXPCOM_JDEST) -d $(VBOX_JXPCOM_JDEST) \
|
---|
174 | org.mozilla.xpcom.internal.XPCOMImpl \
|
---|
175 | org.mozilla.xpcom.internal.GREImpl \
|
---|
176 | org.mozilla.xpcom.internal.MozillaImpl \
|
---|
177 | org.mozilla.xpcom.internal.XPCOMJavaProxy \
|
---|
178 | org.mozilla.xpcom.ProfileLock \
|
---|
179 | org.mozilla.xpcom.internal.JavaXPCOMMethods
|
---|
180 |
|
---|
181 | $(VBOX_JXPCOM_GEN):
|
---|
182 | $(QUIET)$(MKDIR) -p $(VBOX_JXPCOM_GEN)
|
---|
183 |
|
---|
184 | $(VBOX_JXPCOM_GEN)/java:
|
---|
185 | $(QUIET)$(MKDIR) -p $(VBOX_JXPCOM_GEN)/java
|
---|
186 |
|
---|
187 | $(VBOX_JXPCOM_NSERROR): $(VBOX_PATH_XPCOM_SRC)/xpcom/base/nsError.h $(VBOX_JXPCOM_SRC)/tools/gen-nsError.pl $(VBOX_JXPCOM_GEN)/java
|
---|
188 | perl $(VBOX_JXPCOM_SRC)/tools/gen-nsError.pl < $< > $@
|
---|
189 |
|
---|
190 | $(VBOX_JXPCOM_GEN)/jxpcomgen.list: $(GENJIFACES_BIN) $(PATH_TARGET)/VBox-xpcom-xpt-files/VBoxXPCOMBase.xpt $(VBOX_JXPCOM_GEN)
|
---|
191 | $(QUIET)echo Generating Java interface files
|
---|
192 | $(QUIET)$(MKDIR) -p $(VBOX_JXPCOM_GEN)/java
|
---|
193 | $(call preprocess_exebld,$(GENJIFACES_BIN))
|
---|
194 | $(GENJIFACES_BIN) -d $(VBOX_JXPCOM_GEN)/java
|
---|
195 | $(QUIET)echo $$(ls $(VBOX_JXPCOM_GEN)/java/*.java) > $@
|
---|
196 |
|
---|
197 | $(VBOX_JXPCOM_JAR): $(JXPCOM_JAR_SRC) $(VBOX_JXPCOM_GEN)/jxpcomgen.list $(VBOX_JXPCOM_NSERROR) $(VBOX_JXPCOM_MGR)
|
---|
198 | $(QUIET)$(RM) -Rf $(VBOX_JXPCOM_JDEST)
|
---|
199 | $(QUIET)$(MKDIR) -p $(VBOX_JXPCOM_JDEST)
|
---|
200 | $(VBOX_JAVAC) @$ $(VBOX_JXPCOM_GEN)/jxpcomgen.list \
|
---|
201 | -d $(VBOX_JXPCOM_JDEST) -classpath $(VBOX_JXPCOM_JDEST)
|
---|
202 | $(VBOX_JAVAC) $(JXPCOM_JAR_SRC) \
|
---|
203 | $(VBOX_JXPCOM_NSERROR) $(VBOX_JXPCOM_MGR) \
|
---|
204 | -d $(VBOX_JXPCOM_JDEST) -classpath $(VBOX_JXPCOM_JDEST)
|
---|
205 | $(VBOX_JAR) cf $@ -C $(VBOX_JXPCOM_TARGET)/jdest .
|
---|
206 |
|
---|
207 |
|
---|
208 | ifdef VBOX_ONLY_SDK
|
---|
209 | #
|
---|
210 | # Install sample code.
|
---|
211 | #
|
---|
212 | INSTALLS += jxpcomsample
|
---|
213 | jxpcomsample_INST = $(INST_SDK)bindings/xpcom/java
|
---|
214 | jxpcomsample_MODE = a+rx,u+w
|
---|
215 | jxpcomsample_SOURCES = \
|
---|
216 | tests/TestVBox.java=>samples/TestVBox.java \
|
---|
217 | tests/Makefile=>samples/Makefiles
|
---|
218 | endif
|
---|
219 |
|
---|
220 | include $(KBUILD_PATH)/subfooter.kmk
|
---|