VirtualBox

source: vbox/trunk/src/VBox/Main/webservice/Makefile.kmk@ 26379

Last change on this file since 26379 was 26370, checked in by vboxsync, 15 years ago

Webservice: code documentation

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 28.2 KB
Line 
1# $Id: Makefile.kmk 26370 2010-02-09 13:56:55Z vboxsync $
2## @file
3# Sub-Makefile for the VBox web service.
4#
5# Warning! This is a seriously complicated makefile!
6#
7
8#
9# Copyright (C) 2006-2010 Sun Microsystems, Inc.
10#
11# This file is part of VirtualBox Open Source Edition (OSE), as
12# available from http://www.virtualbox.org. This file is free software;
13# you can redistribute it and/or modify it under the terms of the GNU
14# General Public License (GPL) as published by the Free Software
15# Foundation, in version 2 as it comes in the "COPYING" file of the
16# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18#
19# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
20# Clara, CA 95054 USA or visit http://www.sun.com if you need
21# additional information or have any questions.
22#
23
24# Define VBOX_GSOAP_INSTALLED to something if you have gSOAP's
25# "wsdl2h" and "soapcpp2" executables on your PATH somewhere.
26
27#
28# Here's an overview how all this works. It's complicated. Essentially,
29# lots of files get generated automatically from our XML XIDL file that
30# describes the VirtualBox API (../idl/VirtualBox.xidl); as a result,
31# no manual coding is necessary when the API changes. All generated
32# web service code gets adjusted automatically.
33#
34# In more detail:
35#
36# 1) We use xsltproc and websrv-wsdl.xsl to generate a WSDL file from
37# our XML IDL file. WSDL (Web Service Description language) is an XML
38# industry standard that publicly describes a web service.
39# So, the WSDL generated here describes the VirtualBox web
40# service to third-party clients; for example, one can feed it to
41# Java or Perl or some other toolkit that understands WSDL and thus
42# easily write a short script that connects to the web service properly.
43# This WSDL file ends up in $(VBOXWEB_OUT_DIR)/vboxweb.wsdl.
44#
45# 2) We use xsltproc and websrv-gsoapH.xsl to generate a so-called
46# "gSoap header file": $(VBOXWEB_OUT_DIR)/gsoapH_from_xslt.h.
47# This file looks like a C header file, but really isn't meant
48# to be included by a C compiler. Instead, it just happens to be the
49# format that gSOAP uses to specify SOAP interfaces instead of WSDL.
50# (The reason for this appears to be that gSOAP predates WSDL and
51# thus needed some format to describe the syntax of a web service.)
52#
53# Note that gSOAP now also comes with its own WSDL-to-gsoap.h converter,
54# but the readme mentions some funny license restrictions, so instead we
55# have our own converter in XSLT.
56#
57# 3) We then feed that pseudo-header file to gSOAP's soapcpp2 compiler,
58# which generates a ton of files in $(VBOXWEB_OUT_DIR), most importantly:
59#
60# SOAP_CLIENT_H = $(VBOXWEB_OUT_DIR)/soapStub.h (header file for webservice clients)
61# SOAP_SERVER_H = $(VBOXWEB_OUT_DIR)/soapH.h (header file for webservice servers)
62#
63# These are "real" header files that one can use to program a) a webservice client
64# and b) a webservice server. Of course to build b) one will have to write method
65# implementations with useful code that does something. This is where more
66# code generation via XSLT comes in:
67#
68# 4) We use xsltproc to generate tons of c++ code directly from the XIDL that
69# maps each SOAP method to our COM methods. This large C++ file is
70# $(VBOXWEB_OUT_DIR)/methodmaps.cpp. The actual webservice executable (vboxwebsrv,
71# which acts as an HTTP server) is composed of this file, plus hard-coded
72# method implementations in vboxweb.cpp, plus gSOAP library code for the HTTP
73# server.
74#
75
76SUB_DEPTH = ../../../..
77include $(KBUILD_PATH)/subheader.kmk
78
79#
80# Find the gSOAP toolkit.
81#
82# Note! We're not using the gSOAP toolkit correctly. The main issue is that
83# compiling soapcpp2.cpp instead of using the library. So, in order
84# to make this work with a locally installed gSOAP toolkit there are
85# some hoops to jump thru to say the least... Shipping soapcpp2.cpp/h
86# is out of the question without also including the two soap tools.
87#
88# Some observations on distros for OSE / configure:
89# The proposed gentoo ebuild screws up several things in the install phase
90# and thus fails to ship stdsoap2.cpp and relatives.
91#
92# debian (2.7.9l-0.2) stuffs stdsoap2.cpp and a handful of the import files
93# into /usr/include/gsoap.
94#
95# fedora (2.7.12-fc10.x86_64) uses the default install layout and does not
96# ship stdsoap2.cpp and friends.
97#
98ifeq ($(VBOX_GSOAP_INSTALLED),)
99 VBOX_GSOAP_INSTALLED = 1
100 VBOX_PATH_GSOAP := $(lastword $(sort $(wildcard $(KBUILD_DEVTOOLS)/common/gsoap/*)))
101 ifeq ($(VBOX_PATH_GSOAP),)
102 VBOX_PATH_GSOAP := $(lastword $(sort $(wildcard $(KBUILD_DEVTOOLS_HST)/gsoap/*)))
103 endif
104 if "$(VBOX_PATH_GSOAP)" == "" && defined(KBUILD_DEVTOOLS_HST)
105 VBOX_PATH_GSOAP := $(lastword $(sort $(wildcard $(KBUILD_DEVTOOLS_HST_ALT)/gsoap/*)))
106 endif
107 ifeq ($(VBOX_PATH_GSOAP),)
108 $(warning VBOX_PATH_GSOAP not found...)
109 VBOX_GSOAP_INSTALLED =
110 endif
111else
112 VBOX_PATH_GSOAP := $(VBOX_PATH_GSOAP)
113endif
114VBOX_PATH_GSOAP_BIN := $(strip $(VBOX_PATH_GSOAP_BIN))
115if "$(VBOX_PATH_GSOAP_BIN)" == ""
116 VBOX_PATH_GSOAP_BIN := $(VBOX_PATH_GSOAP)/bin
117 if "$(KBUILD_HOST)" == "darwin"
118 VBOX_PATH_GSOAP_BIN := $(VBOX_PATH_GSOAP_BIN)/macosx
119 else if "$(KBUILD_HOST)" == "win"
120 VBOX_PATH_GSOAP_BIN := $(VBOX_PATH_GSOAP_BIN)/win32
121 else if "$(KBUILD_HOST)" == "linux"
122 VBOX_PATH_GSOAP_BIN := $(VBOX_PATH_GSOAP_BIN)/linux386
123 else
124 VBOX_PATH_GSOAP_BIN := $(VBOX_PATH_GSOAP_BIN)/$(KBUILD_HOST).x86
125 endif
126 if !exists($(VBOX_PATH_GSOAP_BIN))
127 VBOX_PATH_GSOAP_BIN := $(VBOX_PATH_GSOAP)/bin
128 endif
129endif
130VBOX_SOAPCPP2 := $(VBOX_PATH_GSOAP_BIN)/soapcpp2$(HOSTSUFF_EXE)
131VBOX_WSDL2H := $(VBOX_PATH_GSOAP_BIN)/wsdl2h$(HOSTSUFF_EXE)
132VBOX_STUBMAKER = $(firstword $(which stubmaker stubmaker.pl) stubmaker_not_found)
133VBOX_WSDL2PY = $(firstword $(which wsdl2py) wsdl2py_not_found)
134
135VBOX_PATH_GSOAP_IMPORT := $(strip $(if $(VBOX_PATH_GSOAP_IMPORT),$(VBOX_PATH_GSOAP_IMPORT),$(VBOX_PATH_GSOAP)/import))
136VBOX_GSOAP_INCS := $(strip $(if $(VBOX_GSOAP_INCS),$(VBOX_GSOAP_INCS),$(VBOX_PATH_GSOAP) $(VBOX_PATH_GSOAP_IMPORT) ))
137# note: $(if $(defined FOO)) does not work here!
138VBOX_GSOAP_CXX_SOURCES := $(strip $(if-expr "$(origin VBOX_GSOAP_CXX_SOURCES)" != "undefined",$(VBOX_GSOAP_CXX_SOURCES),$(VBOX_PATH_GSOAP)/stdsoap2.cpp))
139VBOX_GSOAP_CXX_LIBS := $(strip $(if-expr "$(origin VBOX_GSOAP_CXX_LIBS)" != "undefined",$(VBOX_GSOAP_CXX_LIBS),))
140
141
142#
143# Globals
144#
145VBOXWEB_OUT_DIR := $(PATH_TARGET)/webservice
146BLDDIRS += $(VBOXWEB_OUT_DIR)
147
148# The webservice location
149VBOX_PATH_WEBSERVICE := $(PATH_SUB_CURRENT)
150
151# If this is set, all webservice files are considered out-of-date every time
152# this make file is touched. Otherwise, set this to empty.
153RECOMPILE_ON_MAKEFILE_CURRENT := $(MAKEFILE_CURRENT)
154
155PATH_TARGET_SOAPDEMOXML := $(VBOXWEB_OUT_DIR)/demo_soapxml
156PATH_TARGET_SOAPDEMOHEADERS := $(VBOXWEB_OUT_DIR)/demo_headers
157PATH_TARGET_SOAPDEMONSMAPS := $(VBOXWEB_OUT_DIR)/demo_namespacemaps
158PATH_TARGET_WEBTEST := $(VBOXWEB_OUT_DIR)/webtest
159
160VBOXWEB_IDL_SRC_ORIG := $(VBOX_XIDL_FILE)
161VBOXWEB_IDL_SRC := $(VBOXWEB_OUT_DIR)/VirtualBox.xidl
162
163VBOXWEB_TYPEMAP := $(VBOXWEB_OUT_DIR)/typemap.dat
164
165VBOXWEB_GSOAPH_FROM_XSLT := $(VBOXWEB_OUT_DIR)/gsoapH_from_xslt.h
166ifdef VBOX_GSOAP_INSTALLED
167 VBOXWEB_GSOAPH_FROM_GSOAP := $(VBOXWEB_OUT_DIR)/gsoapH_from_gsoap.h
168else
169 VBOXWEB_GSOAPH_FROM_GSOAP :=
170endif
171VBOXWEB_SOAP_CLIENT_H := $(VBOXWEB_OUT_DIR)/soapStub.h
172VBOXWEB_SOAP_SERVER_H := $(VBOXWEB_OUT_DIR)/soapH.h
173
174
175ifdef VBOX_GSOAP_VERBOSE
176 VBOXWEB_XSLTPROC_VERBOSE = --stringparam G_argDebug '1'
177 VBOXWEB_WSDL_VERBOSE = -v
178else
179 VBOXWEB_SOAPCPP2_SKIP_FILES = -x
180endif
181
182
183## @todo VBOXWEB_GSOAPH_FROM_XSLT should probably be a indirect dep of something.
184VBOXWEB_OTHERS += \
185 $(VBOXWEB_GSOAPH_FROM_XSLT)
186
187
188
189ifdef VBOX_GSOAP_INSTALLED
190 ifndef VBOX_ONLY_SDK
191 #
192 # vboxsoap - Library used by both the programs (save build time).
193 #
194 LIBRARIES += vboxsoap
195 vboxsoap_TEMPLATE = VBOXR3EXE
196 ifdef VBOX_USE_VCC80
197 vboxsoap_CXXFLAGS.win += -bigobj
198 endif
199 ifn1of ($(KBUILD_TARGET), win)
200 vboxsoap_CXXFLAGS += -Wno-shadow
201 endif
202 vboxsoap_INCS := \
203 $(VBOX_GSOAP_INCS) \
204 $(VBOXWEB_OUT_DIR) \
205 $(PATH_SUB_CURRENT)
206 ifdef VBOX_WITHOUT_SPLIT_SOAPC
207 vboxsoap_SOURCES = \
208 $(VBOXWEB_OUT_DIR)/soapC.cpp
209 else
210 BLDPROGS += split-soapC
211 split-soapC_TEMPLATE = VBOXBLDPROG
212 split-soapC_SOURCES = split-soapC.cpp
213
214 vboxsoap_SOURCES = \
215 $(VBOXWEB_OUT_DIR)/soapC-1.cpp \
216 $(VBOXWEB_OUT_DIR)/soapC-2.cpp \
217 $(VBOXWEB_OUT_DIR)/soapC-3.cpp \
218 $(VBOXWEB_OUT_DIR)/soapC-4.cpp \
219 $(VBOXWEB_OUT_DIR)/soapC-5.cpp \
220 $(VBOXWEB_OUT_DIR)/soapC-6.cpp \
221 $(VBOXWEB_OUT_DIR)/soapC-7.cpp \
222 $(VBOXWEB_OUT_DIR)/soapC-8.cpp \
223 $(VBOXWEB_OUT_DIR)/soapC-9.cpp \
224 $(VBOXWEB_OUT_DIR)/soapC-10.cpp \
225 $(VBOXWEB_OUT_DIR)/soapC-11.cpp \
226 $(VBOXWEB_OUT_DIR)/soapC-12.cpp \
227 $(VBOXWEB_OUT_DIR)/soapC-13.cpp \
228 $(VBOXWEB_OUT_DIR)/soapC-14.cpp \
229 $(VBOXWEB_OUT_DIR)/soapC-15.cpp \
230 $(VBOXWEB_OUT_DIR)/soapC-16.cpp \
231 $(VBOXWEB_OUT_DIR)/soapC-17.cpp \
232 $(VBOXWEB_OUT_DIR)/soapC-18.cpp \
233 $(VBOXWEB_OUT_DIR)/soapC-19.cpp \
234 $(VBOXWEB_OUT_DIR)/soapC-20.cpp
235 endif
236 vboxsoap_CLEAN := $(vboxsoap_SOURCES) # lazy bird
237 vboxsoap_SOURCES += \
238 $(VBOX_GSOAP_CXX_SOURCES)
239 vboxsoap_ORDERDEPS = \
240 $(VBOXWEB_IDL_SRC) \
241 $(VBOXWEB_OUT_DIR)/gsoap_copy_all_ts
242 ifn1of ($(KBUILD_TARGET), win)
243 $(VBOX_GSOAP_CXX_SOURCES)_CXXFLAGS = -Wno-format
244 endif
245
246ifdef VBOX_SOAP_PRECOMPILED_HEADER
247 # This'll save a few seconds, but the compiler invocation currently makes it impracticable. This will
248 # be addressed in a future kBuild version, by adding PCH support or/and by adding some helpers to
249 # gather the required data (DEFS,INCS,CXXTOOL,CXXFLAGS).
250 vboxsoap_INTERMEDIATES += $(VBOXWEB_OUT_DIR)/soapH.h.gch
251 vboxsoap_CXXFLAGS += -Winvalid-pch -H
252 vboxsoap_CLEAN += $(VBOXWEB_OUT_DIR)/soapH.h.gch
253
254$(VBOXWEB_OUT_DIR)/soapH.h.gch: $(VBOXWEB_OUT_DIR)/soapH.h
255 g++ -x c++-header -g -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -Wno-variadic-macros -pipe -O0 -fno-omit-frame-pointer -fno-strict-aliasing -fvisibility-inlines-hidden -fvisibility=hidden -DVBOX_HAVE_VISIBILITY_HIDDEN -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -m32 -I/Volumes/ScratchHFS/bird/vbox/svn/trunk/src/VBox/Main/webservice/gsoap -I/Volumes/ScratchHFS/bird/vbox/svn/trunk/out/darwin.x86/debug/obj/src/VBox/Main -I/Volumes/ScratchHFS/bird/vbox/svn/trunk/src/VBox/Main/webservice -I/Volumes/ScratchHFS/bird/vbox/svn/trunk/include -I/Volumes/ScratchHFS/bird/vbox/svn/trunk/out/darwin.x86/debug -DVBOX -DVBOX_WITH_DEBUGGER -DVBOX_WITH_DEBUGGER_GUI -DDEBUG -DDEBUG_bird -DDEBUG_USERNAME=bird -DRT_OS_DARWIN -D__DARWIN__ -DRT_ARCH_X86 -D__X86__ -DVBOX_WITH_HYBRID_32BIT_KERNEL -DIN_RING3 -DHC_ARCH_BITS=32 -DGC_ARCH_BITS=32 -DMAC_OS_X_VERSION_MIN_REQUIRED=1040 -DMAC_OS_X_VERSION_MAX_ALLOWED=1040 \
256 $< -o $@
257endif
258 endif # !VBOX_ONLY_SDK
259
260
261 ifndef VBOX_ONLY_SDK
262 #
263 # vboxwebsrv - webservice server process
264 #
265 PROGRAMS += vboxwebsrv
266 vboxwebsrv_TEMPLATE = VBOXMAINCLIENTEXE
267 vboxwebsrv_DEFS += SOCKET_CLOSE_ON_EXEC
268 vboxwebsrv_INCS = \
269 $(VBOX_GSOAP_INCS) \
270 $(VBOXWEB_OUT_DIR) \
271 .
272 ifdef VBOX_USE_VCC80
273 vboxwebsrv_CXXFLAGS.win += -bigobj
274 endif
275 ifn1of ($(KBUILD_TARGET), win)
276 vboxwebsrv_CXXFLAGS += -Wno-shadow
277 endif
278 vboxwebsrv_LIBS += \
279 $(PATH_LIB)/vboxsoap$(VBOX_SUFF_LIB) \
280 $(VBOX_GSOAP_CXX_LIBS)
281 vboxwebsrv_LIBS.solaris += socket nsl
282 vboxwebsrv_SOURCES = \
283 vboxweb.cpp \
284 $(VBOXWEB_OUT_DIR)/methodmaps.cpp \
285 $(VBOXWEB_OUT_DIR)/soapServer.cpp
286 vboxwebsrv_CLEAN = \
287 $(VBOXWEB_OUT_DIR)/methodmaps.cpp \
288 $(VBOXWEB_OUT_DIR)/soapServer.cpp
289
290 vboxwebsrv_ORDERDEPS = $(VBOXWEB_OUT_DIR)/gsoap_copy_all_ts
291 endif # !VBOX_ONLY_SDK
292
293
294 ifndef VBOX_ONLY_SDK
295 #
296 # webtest - webservice sample client in C++
297 #
298 PROGRAMS += webtest
299 webtest_TEMPLATE = VBOXR3EXE
300 ifdef VBOX_USE_VCC80
301 webtest_CXXFLAGS.win += -bigobj
302 endif
303 ifn1of ($(KBUILD_TARGET), win)
304 webtest_CXXFLAGS += -Wno-shadow
305 endif
306 webtest_INCS := \
307 $(VBOX_GSOAP_INCS) \
308 $(VBOXWEB_OUT_DIR) \
309 .
310 webtest_LIBS += \
311 $(PATH_LIB)/vboxsoap$(VBOX_SUFF_LIB) \
312 $(VBOX_GSOAP_CXX_LIBS)
313 webtest_LIBS.solaris += nsl
314 webtest_SOURCES = \
315 webtest.cpp \
316 $(VBOXWEB_OUT_DIR)/soapClient.cpp
317 webtest_CLEAN = \
318 $(VBOXWEB_OUT_DIR)/soapClient.cpp
319
320 webtest_ORDERDEPS = $(VBOXWEB_OUT_DIR)/gsoap_copy_all_ts
321 endif # !VBOX_ONLY_SDK
322
323
324 #
325 # Additional mess to cleanup (applies to both webtest and vboxwebsrv).
326 #
327 ## @todo figure out whether the SDK really needs this or not...
328 OTHER_CLEAN += \
329 $(wildcard $(VBOXWEB_OUT_DIR)/soap*.h) \
330 $(wildcard $(VBOXWEB_OUT_DIR)/soap*.cpp) \
331 $(wildcard $(VBOXWEB_OUT_DIR)/*.nsmap) \
332 $(VBOXWEB_GSOAPH_FROM_XSLT) \
333 $(VBOXWEB_GSOAPH_FROM_GSOAP) \
334 $(VBOXWEB_SOAP_CLIENT_H) \
335 $(VBOXWEB_SOAP_SERVER_H) \
336 $(VBOXWEB_OUT_DIR)/gsoap_generate_all_ts \
337 $(VBOXWEB_OUT_DIR)/gsoap_copy_all_ts \
338 $(wildcard $(PATH_TARGET_SOAPDEMOXML)/*) \
339 $(PATH_TARGET_SOAPDEMOXML)/dummy_file \
340 $(wildcard $(PATH_TARGET_SOAPDEMOHEADERS)/*) \
341 $(PATH_TARGET_SOAPDEMOHEADERS)/dummy_file \
342 $(wildcard $(PATH_TARGET_SOAPDEMONSMAPS)/*) \
343 $(PATH_TARGET_SOAPDEMONSMAPS)/dummy_file
344
345endif # VBOX_GSOAP_INSTALLED
346
347
348ifdef VBOX_ONLY_SDK
349 #
350 # Global relevant to the SDK.
351 #
352 VBOXWEB_GLUE_PYTHON = $(VBOX_PATH_SDK)/bindings/webservice/python/lib/VirtualBox_wrappers.py
353 VBOXWEB_WS_PYTHON = $(VBOX_PATH_SDK)/bindings/webservice/python/lib/VirtualBox_services.py
354 VBOXWEB_WS_PERL = $(VBOX_PATH_SDK)/bindings/webservice/perl/lib/vboxService.pm
355 VBOXWEB_WS_PHP = $(VBOX_PATH_SDK)/bindings/webservice/php/lib/vboxServiceWrappers.php
356 VBOXWEB_SAMPLES_AXIS_DIR = $(VBOX_PATH_SDK)/bindings/webservice/java/axis/samples
357 VBOXWEB_SAMPLES_JAXWS_DIR = $(VBOX_PATH_SDK)/bindings/webservice/java/jax-ws/samples
358 VBOXWEB_JAXWSSAMPLE = $(VBOXWEB_SAMPLES_JAXWS_DIR)/clienttest.java
359 VBOXWEB_METRICSAMPLE = $(VBOXWEB_SAMPLES_JAXWS_DIR)/metrictest.java
360
361 VBOXWEB_GLUE_JAVA_TMP = $(VBOXWEB_OUT_DIR)/glue-jaxws.java.tmp
362 VBOXWEB_PATH_SDK_GLUE_JAVA = $(VBOX_PATH_SDK)/bindings/webservice/java/jax-ws/src
363 VBOXWEB_JAVALIB = $(VBOX_PATH_SDK)/bindings/webservice/java/jax-ws/lib
364 VBOXWEB_JAVA15_JAR = $(VBOXWEB_JAVALIB)/vboxws_java15.jar
365 VBOXWEB_JAVA16_JAR = $(VBOXWEB_JAVALIB)/vboxws_java16.jar
366
367define find_java_files
368 $(shell find $(1) -name \*.java)
369endef
370
371
372 VBOX_JAXWS_LIBDIR = $(VBOX_PATH_WEBSERVICE)/jaxlibs
373 # well, not really good
374 VBOX_JAVA15 = $(firstword $(wildcard \
375 /usr/lib/jvm/java-1.5.0-sun/bin/java \
376 /usr/jdk/jdk1.5*/bin/java \
377 /opt/sun-jdk-1.5*/bin/java))
378 ifndef VBOX_JAVA15
379 $(error Failed to autodetect VBOX_JAVA15, please set it manually)
380 endif
381 VBOX_JAVA16 = java
382 VBOX_JAVAC15 = javac -target 1.5
383 VBOX_JAVAC16 = javac -target 1.6
384 VBOX_WSIMPORT15 = $(VBOX_JAVA15) -jar $(VBOX_JAXWS_LIBDIR)/jaxws-tools.jar
385 VBOX_WSIMPORT16 = $(firstword $(wildcard \
386 /usr/jdk/jdk1.6*/bin/wsimport \
387 /usr/bin/wsimport \
388 /opt/sun-jdk-1.6*/bin/wsimport))
389 ifndef VBOX_WSIMPORT16
390 $(error Failed to autodetect VBOX_WSIMPORT16, please set it manually)
391 endif
392 VBOX_JAR = jar
393 # Keep in sync with G_virtualBoxPackage in glue-jaxws.xsl
394 # Changed with every new version, so beware!
395 VBOX_API_SUFFIX = _$(VBOX_VERSION_MAJOR)_$(VBOX_VERSION_MINOR)
396 VBOX_JAVA_PACKAGE = org.virtualbox$(VBOX_API_SUFFIX)
397
398 VBOXWEB_OTHERS += \
399 $(VBOXWEB_GLUE_JAVA_TMP) \
400 $(VBOXWEB_GLUE_PYTHON) \
401 $(VBOXWEB_WS_PYTHON) \
402 $(VBOXWEB_WS_PERL) \
403 $(VBOXWEB_WS_PHP) \
404 $(VBOXWEB_PYTHONWSSAMPLE)\
405 $(VBOXWEB_JAXWSSAMPLE) \
406 $(VBOXWEB_METRICSAMPLE) \
407 $(VBOXWEB_JAVA15_JAR) \
408 $(VBOXWEB_JAVA16_JAR)
409
410 #
411 # Install sample code.
412 #
413 INSTALLS += vboxwebinst
414 vboxwebinst_INST = $(INST_SDK)bindings/webservice/
415 vboxwebinst_MODE = a+rx,u+w
416 vboxwebinst_SOURCES = \
417 samples/java/axis/clienttest.java=>java/axis/samples/clienttest.java \
418 samples/java/jax-ws/Makefile.glue=>java/jax-ws/src/Makefile \
419 samples/java/jax-ws/Makefile=>java/jax-ws/samples/Makefile \
420 samples/perl/clienttest.pl=>perl/samples/clienttest.pl \
421 samples/php/clienttest.php=>php/samples/clienttest.php \
422 samples/python/Makefile=>python/samples/Makefile \
423 samples/python/Makefile.glue=>python/lib/Makefile
424
425 #
426 # filesplitter - build helper, splits up the java classes.
427 #
428 BLDPROGS += filesplitter
429 filesplitter_TEMPLATE = VBOXBLDPROG
430 filesplitter_SOURCES = filesplitter.cpp
431
432endif # VBOX_ONLY_SDK
433
434VBOXWEB_WSDL = $(VBOX_PATH_SDK)/bindings/webservice/vboxweb.wsdl
435VBOXWEBSERVICE_WSDL = $(VBOX_PATH_SDK)/bindings/webservice/vboxwebService.wsdl
436
437## @todo VBOXWEB_WSDL and VBOXWEBSERVICE_WSDL should be an install target.
438VBOXWEB_OTHERS += \
439 $(VBOXWEB_WSDL) \
440 $(VBOXWEBSERVICE_WSDL)
441
442#
443# Update the OTHERS and OTHER_CLEAN lists with VBOXWEB_OTHERS and some more stuff.
444#
445# We can't just built up OTHERS and append it to OTHER_CLEAN because we're sharing
446# OTHERS with all the other VBox makefiles (VBOX_SINGLE_MAKEFILE), thus VBOXWEB_OTHERS.
447#
448OTHERS += $(VBOXWEB_OTHERS)
449OTHER_CLEAN += \
450 $(VBOXWEB_OTHERS) \
451 $(VBOXWEB_TYPEMAP) \
452 $(VBOXWEB_IDL_SRC)
453
454
455# generate platform-specific XIDL file from original XIDL file
456$(VBOXWEB_IDL_SRC): $(VBOXWEB_IDL_SRC_ORIG) $(VBOX_PATH_WEBSERVICE)/platform-xidl.xsl | $$(dir $$@)
457 $(call MSG_GENERATE,,$@,$(VBOXWEB_IDL_SRC) using platform-xidl.xsl)
458 $(QUIET)$(VBOX_XSLTPROC) $(VBOXWEB_XSLTPROC_VERBOSE) -o $@ $(VBOX_PATH_WEBSERVICE)/platform-xidl.xsl $<
459
460# generate WSDL from main XIDL file
461$(VBOXWEB_WSDL): $(VBOXWEB_IDL_SRC) $(VBOX_PATH_WEBSERVICE)/websrv-wsdl.xsl $(VBOX_PATH_WEBSERVICE)/websrv-shared.inc.xsl $(RECOMPILE_ON_MAKEFILE_CURRENT) ## @todo | $$(dir $$@)
462 $(QUIET)$(MKDIR) -p $(@D)
463 $(call MSG_GENERATE,,$@,$(VBOXWEB_IDL_SRC) using websrv-wsdl.xsl)
464 $(QUIET)$(VBOX_XSLTPROC) $(VBOXWEB_XSLTPROC_VERBOSE) -o $@ $(VBOX_PATH_WEBSERVICE)/websrv-wsdl.xsl $<
465
466$(VBOXWEBSERVICE_WSDL): $(VBOXWEB_IDL_SRC) $(VBOX_PATH_WEBSERVICE)/websrv-wsdl-service.xsl $(VBOX_PATH_WEBSERVICE)/websrv-shared.inc.xsl $(RECOMPILE_ON_MAKEFILE_CURRENT) ## @todo | $$(dir $$@)
467 $(QUIET)$(MKDIR) -p $(@D)
468 $(call MSG_GENERATE,,$@,$(VBOXWEB_IDL_SRC) using websrv-wsdl-service.xsl)
469 $(QUIET)$(VBOX_XSLTPROC) $(VBOXWEB_XSLTPROC_VERBOSE) -o $@ $(VBOX_PATH_WEBSERVICE)/websrv-wsdl-service.xsl $<
470
471ifdef VBOX_ONLY_SDK
472
473$(VBOXWEB_GLUE_PYTHON): $(VBOXWEB_IDL_SRC) $(VBOXWEB_WSDL) $(VBOXWEBSERVICE_WSDL) $(VBOX_PATH_WEBSERVICE)/websrv-python.xsl
474 $(call MSG_GENERATE,,$@,$(VBOXWEB_IDL_SRC) using websrv-python.xsl)
475 $(QUIET)$(MKDIR) -p $(@D)
476 $(QUIET)$(VBOX_XSLTPROC) $(VBOXWEB_XSLTPROC_VERBOSE) -o $@ $(VBOX_PATH_WEBSERVICE)/websrv-python.xsl $<
477
478$(VBOXWEB_WS_PYTHON): $(VBOXWEB_WSDL) $(VBOXWEBSERVICE_WSDL)
479 $(call MSG_GENERATE,,$@, WS Python bindings)
480 $(QUIET)$(MKDIR) -p $(@D)
481# Try both w/o and with --file option
482 $(QUIET)$(REDIRECT) -C $(@D) -- bash -c "$(VBOX_WSDL2PY) -b $(VBOXWEBSERVICE_WSDL) || $(VBOX_WSDL2PY) -b --file $(VBOXWEBSERVICE_WSDL)"
483 $(QUIET)$(APPEND) $@ ''
484
485$(VBOXWEB_WS_PERL): $(VBOXWEB_WSDL) $(VBOXWEBSERVICE_WSDL)
486 $(call MSG_GENERATE,,$@, WS Perl bindings)
487 $(QUIET)$(MKDIR) -p $(@D)
488 $(QUIET)$(REDIRECT) -C $(@D) -- $(VBOX_STUBMAKER) file://$(VBOXWEBSERVICE_WSDL)
489# Ugly, ugly, ugly, make me right once
490 $(QUIET)$(SED) -e "s+http://www.virtualbox.org/Service+http://www.virtualbox.org/+" < $(VBOXWEB_WS_PERL) > $(VBOXWEB_WS_PERL).tmp
491 $(QUIET)$(MV) $(VBOXWEB_WS_PERL).tmp $(VBOXWEB_WS_PERL)
492 $(QUIET)$(APPEND) $@ ''
493
494$(VBOXWEB_WS_PHP): $(VBOXWEB_IDL_SRC) $(VBOX_PATH_WEBSERVICE)/websrv-php.xsl
495 $(call MSG_GENERATE,,$@,$(VBOXWEB_IDL_SRC) using websrv-php.xsl)
496 $(QUIET)$(MKDIR) -p $(@D)
497 $(QUIET)$(VBOX_XSLTPROC) $(VBOXWEB_XSLTPROC_VERBOSE) -o $@ $(VBOX_PATH_WEBSERVICE)/websrv-php.xsl $<
498
499endif # VBOX_ONLY_SDK
500
501# generate typemap.dat (used by wsdl2h) from main XIDL file
502$(VBOXWEB_TYPEMAP): $(VBOXWEB_IDL_SRC) $(VBOX_PATH_WEBSERVICE)/websrv-typemap.xsl $(VBOX_PATH_WEBSERVICE)/websrv-shared.inc.xsl $(RECOMPILE_ON_MAKEFILE_CURRENT) | $$(dir $$@)
503 $(call MSG_GENERATE,,$@,$(VBOXWEB_IDL_SRC) using websrv-typemap.xsl)
504 $(QUIET)$(VBOX_XSLTPROC) $(VBOXWEB_XSLTPROC_VERBOSE) -o $@ $(VBOX_PATH_WEBSERVICE)/websrv-typemap.xsl $<
505
506# generate gsoap pseudo-C header file from that WSDL; once via XSLT...
507# $(VBOXWEB_GSOAPH_FROM_XSLT): $(VBOXWEB_IDL_SRC) $(VBOX_PATH_WEBSERVICE)/websrv-gsoapH.xsl $(VBOX_PATH_WEBSERVICE)/websrv-shared.inc.xsl $(RECOMPILE_ON_MAKEFILE_CURRENT) | $$(dir $$@)
508# $(call MSG_GENERATE,,$@,$(VBOXWEB_IDL_SRC) using websrv-gsoapH.xsl)
509# $(QUIET)$(VBOX_XSLTPROC) $(VBOXWEB_XSLTPROC_VERBOSE) -o $@ $(VBOX_PATH_WEBSERVICE)/websrv-gsoapH.xsl $<
510$(VBOXWEB_GSOAPH_FROM_XSLT): $(VBOXWEB_WSDL) $(VBOX_PATH_WEBSERVICE)/websrv-wsdl2gsoapH.xsl $(VBOX_PATH_WEBSERVICE)/websrv-shared.inc.xsl $(RECOMPILE_ON_MAKEFILE_CURRENT) | $$(dir $$@)
511 $(call MSG_GENERATE,,$@,$(VBOXWEB_WSDL) using websrv-wsdl2gsoapH.xsl)
512 $(QUIET)$(VBOX_XSLTPROC) $(VBOXWEB_XSLTPROC_VERBOSE) -o $@ $(VBOX_PATH_WEBSERVICE)/websrv-wsdl2gsoapH.xsl $<
513
514NSMAP = $(VBOXWEB_OUT_DIR)/vboxwebsrv.nsmap
515
516$(NSMAP): $(VBOXWEB_IDL_SRC) $(VBOX_PATH_WEBSERVICE)/websrv-nsmap.xsl $(VBOX_PATH_WEBSERVICE)/websrv-shared.inc.xsl $(RECOMPILE_ON_MAKEFILE_CURRENT) | $$(dir $$@)
517 $(call MSG_GENERATE,,$@,$(VBOXWEB_IDL_SRC) using websrv-nsmap.xsl)
518 $(QUIET)$(VBOX_XSLTPROC) $(VBOXWEB_XSLTPROC_VERBOSE) -o $@ $(VBOX_PATH_WEBSERVICE)/websrv-nsmap.xsl $<
519
520
521
522ifdef VBOX_GSOAP_INSTALLED
523# ... and once with the gSOAP tool (just for comparison, we don't use it for licensing reasons)
524$(VBOXWEB_GSOAPH_FROM_GSOAP): $(VBOXWEB_WSDL) $(VBOXWEB_TYPEMAP) | $$(dir $$@)
525 $(call MSG_GENERATE,,$@,)
526 $(VBOX_WSDL2H) $(VBOXWEB_WSDL_VERBOSE) -t$(VBOXWEB_TYPEMAP) -nvbox -o $@ $<
527
528GSOAPH_RELEVANT = $(VBOXWEB_GSOAPH_FROM_XSLT)
529
530# wsdl2h -v: verbose
531# wsdl2h -e: don't qualify enum names
532# wsdl2h -n<prefix>: namespace header prefix
533
534## @todo change this to state explicitly what will be generated?
535
536# generate server and client code from gsoap pseudo-C header file
537$(VBOXWEB_OUT_DIR)/gsoap_generate_all_ts \
538+ $(VBOXWEB_OUT_DIR)/soapH.h \
539+ $(VBOXWEB_OUT_DIR)/soapStub.h \
540+ $(VBOXWEB_OUT_DIR)/soapC.cpp \
541+ $(VBOXWEB_OUT_DIR)/soapClient.cpp \
542+ $(VBOXWEB_OUT_DIR)/soapServer.cpp \
543: $(VBOXWEB_GSOAPH_FROM_GSOAP) $(VBOXWEB_GSOAPH_FROM_XSLT) $(NSMAP) $(RECOMPILE_ON_MAKEFILE_CURRENT) | $$(dir $$@)
544 $(call MSG_GENERATE,,lots of files,$(GSOAPH_RELEVANT))
545 $(RM) -f $@
546 $(REDIRECT) -C $(VBOXWEB_OUT_DIR) -- $(VBOX_SOAPCPP2) $(VBOXWEB_SOAPCPP2_SKIP_FILES) -L -w -I$(VBOX_PATH_GSOAP_IMPORT) $(GSOAPH_RELEVANT)
547 $(APPEND) $@ done
548
549# copy the generated headers and stuff. This has to be a seperate rule if we
550# want to use wildcard (all commands are expaned when the rule is evaluated).
551$(VBOXWEB_OUT_DIR)/gsoap_copy_all_ts: $(VBOXWEB_OUT_DIR)/gsoap_generate_all_ts | $$(dir $$@)
552 $(RM) -f $@
553 $(MKDIR) -p $(PATH_TARGET_SOAPDEMOXML) $(PATH_TARGET_SOAPDEMOHEADERS) $(PATH_TARGET_SOAPDEMONSMAPS)
554ifdef VBOX_GSOAP_VERBOSE
555 $(MV) -f $(wildcard $(VBOXWEB_OUT_DIR)/*.req.xml $(VBOXWEB_OUT_DIR)/*.res.xml) $(PATH_TARGET_SOAPDEMOXML)
556endif
557 $(MV) -f $(wildcard $(VBOXWEB_OUT_DIR)/soapvbox*.h) $(PATH_TARGET_SOAPDEMOHEADERS)
558 $(MV) -f $(VBOXWEB_OUT_DIR)/vboxBinding.nsmap $(PATH_TARGET_SOAPDEMONSMAPS)
559 $(APPEND) $@ done
560
561$(PATH_TARGET_SOAPDEMONSMAPS) \
562$(PATH_TARGET_SOAPDEMOHEADERS)/soapvboxBindingProxy.h \
563$(PATH_TARGET_SOAPDEMOHEADERS)/soapvboxBindingObject.h: $(VBOXWEB_OUT_DIR)/gsoap_copy_all_ts
564
565# soapcpp2 -2: generate SOAP 1.2 calls
566# soapcpp2 -S: server-side code only
567# soapcpp2 -L: don't generate soapClientLib/soapServerLib
568# soapcpp2 -w: don't generate WSDL and schema files
569# soapcpp2 -x: don't generate sample XML files
570
571ifndef VBOX_WITHOUT_SPLIT_SOAPC
572#
573# Split up the soapC.cpp monster into manageable bits that can be
574# built in parallel and without exhausting all available memory.
575#
576$(VBOXWEB_OUT_DIR)/soapC-1.cpp \
577+ $(VBOXWEB_OUT_DIR)/soapC-2.cpp \
578+ $(VBOXWEB_OUT_DIR)/soapC-3.cpp \
579+ $(VBOXWEB_OUT_DIR)/soapC-4.cpp \
580+ $(VBOXWEB_OUT_DIR)/soapC-5.cpp \
581+ $(VBOXWEB_OUT_DIR)/soapC-6.cpp \
582+ $(VBOXWEB_OUT_DIR)/soapC-7.cpp \
583+ $(VBOXWEB_OUT_DIR)/soapC-8.cpp \
584+ $(VBOXWEB_OUT_DIR)/soapC-9.cpp \
585+ $(VBOXWEB_OUT_DIR)/soapC-10.cpp \
586+ $(VBOXWEB_OUT_DIR)/soapC-11.cpp \
587+ $(VBOXWEB_OUT_DIR)/soapC-12.cpp \
588+ $(VBOXWEB_OUT_DIR)/soapC-13.cpp \
589+ $(VBOXWEB_OUT_DIR)/soapC-14.cpp \
590+ $(VBOXWEB_OUT_DIR)/soapC-15.cpp \
591+ $(VBOXWEB_OUT_DIR)/soapC-16.cpp \
592+ $(VBOXWEB_OUT_DIR)/soapC-17.cpp \
593+ $(VBOXWEB_OUT_DIR)/soapC-18.cpp \
594+ $(VBOXWEB_OUT_DIR)/soapC-19.cpp \
595+ $(VBOXWEB_OUT_DIR)/soapC-20.cpp \
596: $(VBOXWEB_OUT_DIR)/soapC.cpp $$(TARGET_split-soapC) | $$(dir $$@)
597 $(RM) -f $(wildcard $(VBOXWEB_OUT_DIR)/soapC-?.cpp $(VBOXWEB_OUT_DIR)/soapC-??.cpp)
598 $(TARGET_split-soapC) $(VBOXWEB_OUT_DIR)/soapC.cpp $(VBOXWEB_OUT_DIR) 20
599endif # !VBOX_WITHOUT_SPLIT_SOAPC
600
601endif # VBOX_GSOAP_INSTALLED
602
603
604
605# generate method maps in server: map wsdl operations to com/xpcom method calls
606$(VBOXWEB_OUT_DIR)/methodmaps.cpp: $(VBOXWEB_IDL_SRC) $(VBOX_PATH_WEBSERVICE)/websrv-cpp.xsl $(VBOX_PATH_WEBSERVICE)/websrv-shared.inc.xsl $(RECOMPILE_ON_MAKEFILE_CURRENT) | $$(dir $$@)
607 $(call MSG_GENERATE,,$@,$(VBOXWEB_IDL_SRC) using websrv-cpp.xsl)
608 $(QUIET)$(VBOX_XSLTPROC) -o $@ $(VBOX_PATH_WEBSERVICE)/websrv-cpp.xsl $<
609
610
611ifdef VBOX_ONLY_SDK
612
613$(VBOXWEB_JAXWSSAMPLE): $(VBOX_PATH_WEBSERVICE)/samples/java/jax-ws/clienttest.java
614 $(QUIET)$(MKDIR) -p $(VBOXWEB_SAMPLES_JAXWS_DIR)
615 $(QUIET)$(SED) -e 's/{VBOX_API_SUFFIX}/$(VBOX_API_SUFFIX)/' < $< > $@
616
617$(VBOXWEB_METRICSAMPLE): $(VBOX_PATH_WEBSERVICE)/samples/java/jax-ws/metrictest.java
618 $(QUIET)$(MKDIR) -p $(VBOXWEB_SAMPLES_JAXWS_DIR)
619 $(QUIET)$(SED) -e 's/{VBOX_API_SUFFIX}/$(VBOX_API_SUFFIX)/' < $< > $@
620
621# generate jax-ws wrapper for java client code
622$(VBOXWEB_GLUE_JAVA_TMP): $(VBOXWEB_IDL_SRC) $(VBOX_PATH_WEBSERVICE)/glue-jaxws.xsl $(VBOX_PATH_WEBSERVICE)/websrv-shared.inc.xsl $$(TARGET_filesplitter) $(RECOMPILE_ON_MAKEFILE_CURRENT) | $$(dir $$@)
623 $(QUIET)$(MKDIR) -p $(@D)
624 $(call MSG_GENERATE,,$@,$(VBOXWEB_IDL_SRC) using glue-jaxws.xsl)
625 $(QUIET)$(VBOX_XSLTPROC) $(VBOXWEB_XSLTPROC_VERBOSE) \
626 --stringparam G_vboxApiSuffix $(VBOX_API_SUFFIX) \
627 -o $@ $(VBOX_PATH_WEBSERVICE)/glue-jaxws.xsl $<
628 $(call MSG_GENERATE,,java client glue files in $(VBOXWEB_PATH_SDK_GLUE_JAVA))
629 $(RM) -R -f $(VBOXWEB_PATH_SDK_GLUE_JAVA)
630 $(QUIET)$(MKDIR) -p $(VBOXWEB_PATH_SDK_GLUE_JAVA)
631 $(QUIET)$(TARGET_filesplitter) $@ $(VBOXWEB_PATH_SDK_GLUE_JAVA)
632 $(QUIET)$(CP) -f $(VBOX_PATH_WEBSERVICE)/../../../../COPYING.LIB $(VBOXWEB_PATH_SDK_GLUE_JAVA)
633
634$(VBOXWEB_GLUE_JAVA_TMP).done: $(VBOXWEB_GLUE_JAVA_TMP)
635 $(QUIET)$(APPEND) $@ ''
636
637$(VBOXWEB_JAVA15_JAR): $(VBOXWEB_GLUE_JAVA_TMP).done $(VBOXWEB_WSDL) $(VBOXWEBSERVICE_WSDL)
638 $(QUIET)$(RM) -Rf $(VBOXWEB_JAVALIB)/gen15
639 $(QUIET)$(MKDIR) -p $(VBOXWEB_JAVALIB)/gen15
640 $(call MSG_GENERATE,,$@,JAX-WS for Java 1.5 bindings using $(VBOXWEBSERVICE_WSDL))
641 $(QUIET)$(VBOX_WSIMPORT15) -p $(VBOX_JAVA_PACKAGE) -d $(VBOXWEB_JAVALIB)/gen15 $(VBOXWEBSERVICE_WSDL)
642 $(call MSG_L1,Compiling bridge code)
643 $(QUIET)$(VBOX_JAVAC15) -cp \
644 $(VBOXWEB_JAVALIB)/gen15:$(VBOX_JAXWS_LIBDIR)/jaxws-api.jar:$(VBOX_JAXWS_LIBDIR)/lib/jaxb-api.jar:$(VBOX_JAXWS_LIBDIR)/jsr181-api.jar \
645 $(call find_java_files,$(VBOXWEB_PATH_SDK_GLUE_JAVA)) -d $(VBOXWEB_JAVALIB)/gen15
646 $(QUIET)$(SED) -e "s/vboxweb.wsdl/vboxweb$(VBOX_API_SUFFIX).wsdl/" < $(VBOXWEBSERVICE_WSDL) > $(VBOXWEB_JAVALIB)/gen15/vboxwebService$(VBOX_API_SUFFIX).wsdl
647 $(QUIET)$(CP) -f $(VBOXWEB_WSDL) $(VBOXWEB_JAVALIB)/gen15/vboxweb$(VBOX_API_SUFFIX).wsdl
648 $(QUIET)$(RM) -f $(call find_java_files,$(VBOXWEB_JAVALIB))
649 $(QUIET)$(VBOX_JAR) cf $@ -C $(VBOXWEB_JAVALIB)/gen15 .
650
651$(VBOXWEB_JAVA16_JAR): $(VBOXWEB_GLUE_JAVA_TMP).done $(VBOXWEB_WSDL) $(VBOXWEBSERVICE_WSDL)
652 $(QUIET)$(RM) -Rf $(VBOXWEB_JAVALIB)/gen16
653 $(MKDIR) -p $(VBOXWEB_JAVALIB)/gen16
654 $(call MSG_GENERATE,,$@,JAX-WS for Java 1.6 bindings using $(VBOXWEBSERVICE_WSDL))
655 $(QUIET)$(VBOX_WSIMPORT16) -p $(VBOX_JAVA_PACKAGE) -d $(VBOXWEB_JAVALIB)/gen16 $(VBOXWEBSERVICE_WSDL)
656 $(call MSG_L1,Compiling bridge code)
657 $(QUIET)$(VBOX_JAVAC16) -cp $(VBOXWEB_JAVALIB)/gen16 \
658 $(VBOXWEB_PATH_SDK_GLUE_JAVA)/*.java -d $(VBOXWEB_JAVALIB)/gen16
659 $(QUIET)$(SED) -e "s/vboxweb.wsdl/vboxweb$(VBOX_API_SUFFIX).wsdl/" < $(VBOXWEBSERVICE_WSDL) > $(VBOXWEB_JAVALIB)/gen16/vboxwebService$(VBOX_API_SUFFIX).wsdl
660 $(QUIET)$(CP) -f $(VBOXWEB_WSDL) $(VBOXWEB_JAVALIB)/gen16/vboxweb$(VBOX_API_SUFFIX).wsdl
661 $(QUIET)$(RM) -f $(call find_java_files,$(VBOXWEB_JAVALIB)/gen16)
662 $(QUIET)$(VBOX_JAR) cf $@ -C $(VBOXWEB_JAVALIB)/gen16 .
663
664endif # VBOX_ONLY_SDK
665
666include $(KBUILD_PATH)/subfooter.kmk
667
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette