1 | # $Id: Makefile.kmk 29098 2010-05-05 16:47:23Z 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 | endif
|
---|
36 | VBOX_JAVAC = $(VBOX_JAVA_HOME)/bin/javac
|
---|
37 | VBOX_JAVAH = $(VBOX_JAVA_HOME)/bin/javah
|
---|
38 | VBOX_JAR = $(VBOX_JAVA_HOME)/bin/jar
|
---|
39 | # correct for targets we care about
|
---|
40 | VBOX_MD_OS = $(KBUILD_TARGET)
|
---|
41 | VBOX_JAVA_INC = $(VBOX_JAVA_HOME)/include \
|
---|
42 | $(VBOX_JAVA_HOME)/include/$(VBOX_MD_OS)
|
---|
43 | endif
|
---|
44 |
|
---|
45 | VBOX_JXPCOM_TARGET = $(PATH_TARGET)/vboxjxpcom
|
---|
46 | VBOX_JXPCOM_JDEST := $(VBOX_JXPCOM_TARGET)/jdest
|
---|
47 |
|
---|
48 | VBOX_JXPCOM_GENH = \
|
---|
49 | $(VBOX_JXPCOM_JDEST)/org_mozilla_xpcom_internal_XPCOMImpl.h \
|
---|
50 | $(VBOX_JXPCOM_JDEST)/org_mozilla_xpcom_internal_GREImpl.h \
|
---|
51 | $(VBOX_JXPCOM_JDEST)/org_mozilla_xpcom_internal_MozillaImpl.h \
|
---|
52 | $(VBOX_JXPCOM_JDEST)/org_mozilla_xpcom_internal_XPCOMJavaProxy.h \
|
---|
53 | $(VBOX_JXPCOM_JDEST)/org_mozilla_xpcom_internal_JavaXPCOMMethods.h \
|
---|
54 | $(VBOX_JXPCOM_JDEST)/org_mozilla_xpcom_ProfileLock.h
|
---|
55 |
|
---|
56 | VBoxJXpcom_TEMPLATE = XPCOM
|
---|
57 | VBoxJXpcom_CXXFLAGS = -Wno-write-strings
|
---|
58 | VBoxJXpcom_DEFS = \
|
---|
59 | EXPORT_XPTI_API \
|
---|
60 | EXPORT_XPT_API \
|
---|
61 | VBOX_WITH_XPCOM
|
---|
62 | VBoxJXpcom_DEFS.darwin = XP_MACOSX
|
---|
63 | VBoxJXpcom_NAME = libvboxjxpcom
|
---|
64 | VBoxJXpcom_DLLSUFF.darwin = .jnilib
|
---|
65 | VBoxJXpcom_INCS = \
|
---|
66 | src \
|
---|
67 | $(VBOX_JAVA_INC) \
|
---|
68 | $(VBOX_PATH_XPCOM_SRC)/xpcom/glue \
|
---|
69 | $(VBOX_PATH_XPCOM_SRC)/xpcom/build \
|
---|
70 | $(VBOX_JXPCOM_JDEST)
|
---|
71 | VBoxJXpcom_SOURCES = \
|
---|
72 | src/nsAppFileLocProviderProxy.cpp \
|
---|
73 | src/nsJavaWrapper.cpp \
|
---|
74 | src/nsJavaXPCOMBindingUtils.cpp \
|
---|
75 | src/nsJavaXPTCStub.cpp \
|
---|
76 | src/nsJavaXPTCStubWeakRef.cpp \
|
---|
77 | src/nsJavaXPCOMGlue.cpp \
|
---|
78 | src/nsJavaInterfaces.cpp
|
---|
79 | VBoxJXpcom_LIBS = \
|
---|
80 | $(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB) \
|
---|
81 | $(PATH_BIN)/VBoxXPCOM$(VBOX_SUFF_DLL)
|
---|
82 |
|
---|
83 | src/nsJavaInterfaces.cpp_DEPS = $(VBOX_JXPCOM_GENH)
|
---|
84 |
|
---|
85 | DLLS += VBoxJXpcom
|
---|
86 |
|
---|
87 | BLDPROGS += genjifaces
|
---|
88 |
|
---|
89 | genjifaces_TEMPLATE = XPCOMEXE
|
---|
90 | genjifaces_INCS = \
|
---|
91 | src
|
---|
92 | genjifaces_DEFS = \
|
---|
93 | EXPORT_XPTI_API \
|
---|
94 | EXPORT_XPT_API \
|
---|
95 | VBOX_WITH_XPCOM
|
---|
96 | genjifaces_SOURCES = \
|
---|
97 | tools/genifaces/GenerateJavaInterfaces.cpp \
|
---|
98 | src/nsFileStreams.cpp
|
---|
99 | genjifaces_LIBS = \
|
---|
100 | $(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB) \
|
---|
101 | $(PATH_BIN)/VBoxXPCOM$(VBOX_SUFF_DLL) \
|
---|
102 | $(PATH_BIN)/VBoxRT$(VBOX_SUFF_DLL)
|
---|
103 | genjifaces_DEPS = $(PATH_TARGET)/VBox-xpcom-idl-timestamp
|
---|
104 | genjifaces_INST = $(INST_BIN)
|
---|
105 |
|
---|
106 | #
|
---|
107 | # Install JAR files
|
---|
108 | #
|
---|
109 | INSTALLS += VBoxJXpcom-inst-jar
|
---|
110 |
|
---|
111 | VBOX_JXPCOM_JAR = $(VBOX_JXPCOM_TARGET)/vboxjxpcom.jar
|
---|
112 | VBOX_JXPCOM_JSRC = $(VBOX_JXPCOM_SRC)/src/org/mozilla/xpcom
|
---|
113 | VBOX_JXPCOM_JGEN = $(PATH_TARGET)/vboxjgen
|
---|
114 |
|
---|
115 | VBoxJXpcom-inst-jar_INST = $(INST_SDK)bindings/xpcom/java
|
---|
116 | VBoxJXpcom-inst-jar_SOURCES = $(VBOX_JXPCOM_JAR)
|
---|
117 |
|
---|
118 | JXPCOM_JAR_SRC= $(VBOX_JXPCOM_JSRC)/IXPCOM.java \
|
---|
119 | $(VBOX_JXPCOM_JSRC)/Mozilla.java \
|
---|
120 | $(VBOX_JXPCOM_JSRC)/VersionComparator.java \
|
---|
121 | $(VBOX_JXPCOM_JSRC)/GREVersionRange.java \
|
---|
122 | $(VBOX_JXPCOM_JSRC)/IAppFileLocProvider.java \
|
---|
123 | $(VBOX_JXPCOM_JSRC)/ProfileLock.java \
|
---|
124 | $(VBOX_JXPCOM_JSRC)/IGRE.java \
|
---|
125 | $(VBOX_JXPCOM_JSRC)/IJavaXPCOMUtils.java \
|
---|
126 | $(VBOX_JXPCOM_JSRC)/XPCOMException.java \
|
---|
127 | $(VBOX_JXPCOM_JSRC)/IMozilla.java \
|
---|
128 | $(VBOX_JXPCOM_JSRC)/XPCOMInitializationException.java \
|
---|
129 | $(VBOX_JXPCOM_JSRC)/INIParser.java \
|
---|
130 | $(VBOX_JXPCOM_JSRC)/internal/GREImpl.java \
|
---|
131 | $(VBOX_JXPCOM_JSRC)/internal/JavaXPCOMMethods.java \
|
---|
132 | $(VBOX_JXPCOM_JSRC)/internal/MozillaImpl.java \
|
---|
133 | $(VBOX_JXPCOM_JSRC)/internal/XPCOMImpl.java \
|
---|
134 | $(VBOX_JXPCOM_JSRC)/internal/XPCOMJavaProxyBase.java \
|
---|
135 | $(VBOX_JXPCOM_JSRC)/internal/XPCOMJavaProxy.java
|
---|
136 |
|
---|
137 | VBOX_JXPCOM_GEN = $(VBOX_JXPCOM_TARGET)/jxpcomgen
|
---|
138 |
|
---|
139 | VBOX_JXPCOM_NSERROR = $(VBOX_JXPCOM_GEN)/java/XPCOMError.java
|
---|
140 | VBOX_JXPCOM_MGR = $(VBOX_JXPCOM_SRC)/src/org/virtualbox/VirtualBoxManager.java
|
---|
141 |
|
---|
142 | $(VBOX_JXPCOM_GENH): $(VBOX_JXPCOM_JAR)
|
---|
143 | $(VBOX_JAVAH) -classpath $(VBOX_JXPCOM_JDEST) -d $(VBOX_JXPCOM_JDEST) \
|
---|
144 | org.mozilla.xpcom.internal.XPCOMImpl \
|
---|
145 | org.mozilla.xpcom.internal.GREImpl \
|
---|
146 | org.mozilla.xpcom.internal.MozillaImpl \
|
---|
147 | org.mozilla.xpcom.internal.XPCOMJavaProxy \
|
---|
148 | org.mozilla.xpcom.ProfileLock \
|
---|
149 | org.mozilla.xpcom.internal.JavaXPCOMMethods
|
---|
150 |
|
---|
151 | $(VBOX_JXPCOM_GEN):
|
---|
152 | $(QUIET)$(MKDIR) -p $(VBOX_JXPCOM_GEN)
|
---|
153 |
|
---|
154 | $(VBOX_JXPCOM_GEN)/java:
|
---|
155 | $(QUIET)$(MKDIR) -p $(VBOX_JXPCOM_GEN)/java
|
---|
156 |
|
---|
157 | $(VBOX_JXPCOM_NSERROR): $(VBOX_PATH_XPCOM_SRC)/xpcom/base/nsError.h $(VBOX_JXPCOM_SRC)/tools/gen-nsError.pl $(VBOX_JXPCOM_GEN)/java
|
---|
158 | perl $(VBOX_JXPCOM_SRC)/tools/gen-nsError.pl < $< > $@
|
---|
159 |
|
---|
160 | $(VBOX_JXPCOM_GEN)/jxpcomgen.list: $(PATH_BIN)/genjifaces$(HOSTSUFF_EXE) $(PATH_TARGET)/VBox-xpcom-xpt-files/VBoxXPCOMBase.xpt $(VBOX_JXPCOM_GEN)
|
---|
161 | $(QUIET)echo Generating Java interface files
|
---|
162 | $(QUIET)$(MKDIR) -p $(VBOX_JXPCOM_GEN)/java
|
---|
163 | $(PATH_BIN)/genjifaces$(HOSTSUFF_EXE) -d $(VBOX_JXPCOM_GEN)/java
|
---|
164 | $(QUIET)echo $$(ls $(VBOX_JXPCOM_GEN)/java/*.java) > $@
|
---|
165 |
|
---|
166 | $(VBOX_JXPCOM_JAR): $(JXPCOM_JAR_SRC) $(VBOX_JXPCOM_GEN)/jxpcomgen.list $(VBOX_JXPCOM_NSERROR) $(VBOX_JXPCOM_MGR)
|
---|
167 | $(QUIET)$(RM) -Rf $(VBOX_JXPCOM_JDEST)
|
---|
168 | $(QUIET)$(MKDIR) -p $(VBOX_JXPCOM_JDEST)
|
---|
169 | $(VBOX_JAVAC) @$ $(VBOX_JXPCOM_GEN)/jxpcomgen.list \
|
---|
170 | -d $(VBOX_JXPCOM_JDEST) -classpath $(VBOX_JXPCOM_JDEST)
|
---|
171 | $(VBOX_JAVAC) $(JXPCOM_JAR_SRC) \
|
---|
172 | $(VBOX_JXPCOM_NSERROR) $(VBOX_JXPCOM_MGR) \
|
---|
173 | -d $(VBOX_JXPCOM_JDEST) -classpath $(VBOX_JXPCOM_JDEST)
|
---|
174 | $(VBOX_JAR) cf $@ -C $(VBOX_JXPCOM_TARGET)/jdest .
|
---|
175 |
|
---|
176 |
|
---|
177 | ifdef VBOX_ONLY_SDK
|
---|
178 | #
|
---|
179 | # Install sample code.
|
---|
180 | #
|
---|
181 | INSTALLS += jxpcomsample
|
---|
182 | jxpcomsample_INST = $(INST_SDK)bindings/xpcom/java
|
---|
183 | jxpcomsample_MODE = a+rx,u+w
|
---|
184 | jxpcomsample_SOURCES = \
|
---|
185 | tests/TestVBox.java=>samples/TestVBox.java \
|
---|
186 | tests/Makefile=>samples/Makefiles
|
---|
187 | endif
|
---|
188 |
|
---|
189 | include $(KBUILD_PATH)/subfooter.kmk
|
---|
190 |
|
---|