summaryrefslogtreecommitdiff
path: root/src/VBox/Main/Makefile.kmk
blob: 39c5f33ced7c7408f0242f74ab5704f1aa23fa9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
# $Id: Makefile.kmk 29859 2010-05-28 13:17:24Z vboxsync $
## @file
# Makefile for the VBox Main module.
#

#
# Copyright (C) 2006-2010 Oracle Corporation
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
# you can redistribute it and/or modify it under the terms of the GNU
# General Public License (GPL) as published by the Free Software
# Foundation, in version 2 as it comes in the "COPYING" file of the
# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
#

SUB_DEPTH = ../../..
include $(KBUILD_PATH)/subheader.kmk

#
# Include sub-makefile(s).
#
ifdef VBOX_WITH_WEBSERVICES
 include $(PATH_SUB_CURRENT)/webservice/Makefile.kmk
endif
include $(PATH_SUB_CURRENT)/testcase/Makefile.kmk
include $(PATH_SUB_CURRENT)/cbinding/Makefile.kmk


#
# Targets and globals (bit of a mess...)
#
VBOX_PATH_MAIN_SRC := $(PATH_SUB_CURRENT)

ifdef VBOX_ONLY_SDK
 # used by some rules
 PATH_VBoxCOM    = $(PATH_TARGET)/VBoxCOM
 BLDDIRS        += $(PATH_VBoxCOM) $(PATH_BIN)/components
 # I'm Evil! Dr. Evil.
 include $(KBUILD_PATH)/tools/VCC70.kmk
 include $(KBUILD_PATH)/sdks/WINPSDK.kmk
endif # !VBOX_ONLY_SDK


# Construct VBOX_MAIN_DEFS
## @todo eliminate or expand VBOX_MAIN_DEFS.
VBOX_MAIN_DEFS   =
ifneq ($(KBUILD_TARGET),win)
 ifndef VBOX_WITH_XPCOM
  $(error "VBox: VBOX_WITH_XPCOM isn't defined")
 endif
 ifneq ($(KBUILD_TARGET),os2)
  VBOX_MAIN_DEFS += VBOX_WITH_SYS_V_IPC_SESSION_WATCHER
 endif
endif
VBOX_MAIN_DEFS += \
	$(if $(VBOX_WITH_RAW_MODE),VBOX_WITH_RAW_MODE,) \
	$(if $(VBOX_WITH_NETFLT),VBOX_WITH_NETFLT,) \
	$(if $(VBOX_WITH_CROGL),VBOX_WITH_CROGL,) \
	$(if $(VBOX_WITH_GUEST_PROPS),VBOX_WITH_GUEST_PROPS,) \
	$(if $(VBOX_WITH_GUEST_PROPS_RDONLY_GUEST),VBOX_WITH_GUEST_PROPS_RDONLY_GUEST,) \
	$(if $(VBOX_WITH_GUEST_CONTROL),VBOX_WITH_GUEST_CONTROL,) \
	$(if $(VBOX_WITH_HOSTNETIF_API),VBOX_WITH_HOSTNETIF_API,) \
	$(if $(VBOX_WITH_VDE),VBOX_WITH_VDE,)

# Unconditionally enable the new semaphore key generation code
VBOX_MAIN_DEFS += VBOX_WITH_NEW_SYS_V_KEYGEN

VBOX_IDL_FILE.MSCOM    = $(VBOX_PATH_SDK)/bindings/mscom/idl/VirtualBox.idl
VBOX_IDL_FILE.XPCOM    = $(VBOX_PATH_SDK)/bindings/xpcom/idl/VirtualBox_XPCOM.idl

VBOX_IDL_TYPELIB.XPCOM = $(PATH_BIN)/components/VirtualBox_XPCOM.xpt
VBOX_IDL_HEADER.XPCOM  = $(VBOX_PATH_SDK)/bindings/xpcom/include/VirtualBox_XPCOM.h

# The MS COM specific stuff.
if defined(VBOX_ONLY_SDK) || "$(KBUILD_TARGET)" == "win"
 OTHERS         += \
	$(VBOX_IDL_FILE.MSCOM) \
	$(VBOX_PATH_SDK)/bindings/mscom/include/VirtualBox.h \
	$(VBOX_PATH_SDK)/bindings/mscom/lib/VirtualBox.tlb \
	$(VBOX_PATH_SDK)/bindings/mscom/lib/VirtualBox_i.c
 OTHER_CLEAN    += \
	$(VBOX_IDL_FILE.MSCOM) \
	$(VBOX_PATH_SDK)/bindings/mscom/include/VirtualBox.h \
	$(VBOX_PATH_SDK)/bindings/mscom/lib/VirtualBox.tlb \
	$(VBOX_PATH_SDK)/bindings/mscom/lib/VirtualBox_i.c \
	$(PATH_VBoxCOM)/VirtualBox.h   \
	$(PATH_VBoxCOM)/VirtualBox_i.c \
	$(PATH_VBoxCOM)/VirtualBox.tlb

 VBOX_MAIN_PREREQS += $(PATH_VBoxCOM)/VirtualBox_i.c
 BLDDIRS += $(VBOX_PATH_SDK)/bindings/mscom/idl
endif

# The XPCOM specific stuff.
if defined(VBOX_ONLY_SDK) || "$(KBUILD_TARGET)" != "win"
 OTHERS         += $(VBOX_IDL_FILE.XPCOM) $(VBOX_IDL_TYPELIB.XPCOM) $(VBOX_IDL_HEADER.XPCOM)
 OTHER_CLEAN    += \
    $(VBOX_IDL_FILE.XPCOM) \
    $(VBOX_IDL_HEADER.XPCOM) \
    $(VBOX_IDL_TYPELIB.XPCOM)

 VBOX_MAIN_PREREQS += $(VBOX_IDL_TYPELIB.XPCOM) $(VBOX_IDL_HEADER.XPCOM)
 BLDDIRS += \
	$(VBOX_PATH_SDK)/bindings/xpcom/idl \
	$(VBOX_PATH_SDK)/bindings/xpcom/include
endif # xpcom


#
# Strip documentation from source XIDL so that we don't get a full
# recompile every time a comma in the documentation is changed.
#
$(VBOX_XIDL_FILE).ts +| $(VBOX_XIDL_FILE): \
		$(VBOX_XIDL_FILE_SRC) \
		$(VBOX_PATH_MAIN_SRC)/idl/docstrip.xsl \
		| $$(dir $$@)
# 	$(CP) -fv $< $(VBOX_XIDL_FILE).ts
	$(VBOX_XSLTPROC) -o $(VBOX_XIDL_FILE).ts $(VBOX_PATH_MAIN_SRC)/idl/docstrip.xsl $<
	$(CP) --changed -fv $(VBOX_XIDL_FILE).ts $(VBOX_XIDL_FILE)


#
# The Main API documentation
#
VBOX_MAIN_DOC_DIR = $(VBOX_PATH_SDK)/docs
BLDDIRS += $(VBOX_MAIN_DOC_DIR)

$(PATH_TARGET)/docs.Main: \
		$(VBOX_PATH_MAIN_SRC)/Doxyfile.Main \
		$(VBOX_PATH_MAIN_SRC)/idl/doxygen.xsl \
		$(VBOX_XIDL_FILE_SRC) \
		| $(PATH_TARGET)/ \
		$(VBOX_MAIN_DOC_DIR)/
	$(RM) -f $(wildcard $(VBOX_MAIN_DOC_DIR)/html/*) $(PATH_TARGET)/docs.Main
	$(VBOX_XSLTPROC) -o $(PATH_TARGET)/VirtualBox.idl $(VBOX_PATH_MAIN_SRC)/idl/doxygen.xsl $(VBOX_XIDL_FILE_SRC)
	$(REDIRECT) -E 'DOCDIR=$(VBOX_MAIN_DOC_DIR)' -E 'PATH_TARGET=$(PATH_TARGET)' -E 'PATH_CHM=$(subst /,\,$(VBOX_MAIN_DOC_DIR)/VirtualBoxAPI.chm)' \
		-- doxygen $(VBOX_PATH_MAIN_SRC)/Doxyfile.Main
	$(QUIET)$(TEST) -s "$(PATH_TARGET)/Main.err" -- $(ECHO_EXT) ">>>>>>>>>>>>>>>>>>>> Main.err: >>>>>>>>>>>>>>>>>>>>>>>>"
	$(QUIET)$(TEST) -s "$(PATH_TARGET)/Main.err" -- $(CAT) "$(PATH_TARGET)/Main.err"
	$(QUIET)$(TEST) -s "$(PATH_TARGET)/Main.err" -- $(ECHO_EXT) "<<<<<<<<<<<<<<<<<<<< Main.err <<<<<<<<<<<<<<<<<<<<<<<<<"
	$(QUIET)$(TEST) -s "$(PATH_TARGET)/Main.err" -- $(ECHO_EXT) "===> **************************************************"
	$(QUIET)$(TEST) -s "$(PATH_TARGET)/Main.err" -- $(ECHO_EXT) "===> Please fix above doxygen errors/warnings listed in"
	$(QUIET)$(TEST) -s "$(PATH_TARGET)/Main.err" -- $(ECHO_EXT) "===> $(PATH_TARGET)/Main.err"
	$(QUIET)$(TEST) -s "$(PATH_TARGET)/Main.err" -- $(ECHO_EXT) "===> **************************************************"
	-$(EXEC_X86_WIN32) $(VBOX_PATH_HTML_HELP_WORKSHOP)/hhc.exe $(subst /,\\,$(VBOX_MAIN_DOC_DIR)/html/index.hhp)
	$(APPEND) $(PATH_TARGET)/docs.Main
# aliases
docs.main docs.Main: $(PATH_TARGET)/docs.Main
if !defined(VBOX_ONLY_DOCS)
docs:                $(PATH_TARGET)/docs.Main
endif


#
# Some SDK bit.
#
INSTALLS += VBox-main-xidl
VBox-main-xidl_INST = $(INST_SDK)bindings/
VBox-main-xidl_SOURCES = $(VBOX_XIDL_FILE_SRC)

ifdef VBOX_WITH_PYTHON

# or to some subdir?
VBOX_PYTHON_CONSTANTS = $(PATH_TARGET)/VirtualBox_constants.py

INSTALLS += VBox-python-glue
VBox-python-glue_INST = $(INST_SDK)installer
VBox-python-glue_SOURCES = glue/vboxapi.py=>vboxapi/__init__.py  \
                           $(VBOX_PYTHON_CONSTANTS)=>vboxapi/VirtualBox_constants.py

$(VBOX_PYTHON_CONSTANTS):  $(VBOX_PATH_MAIN_SRC)/glue/constants-python.xsl $(VBOX_XIDL_FILE) | $$(dir $$@)
	$(call MSG_TOOL,xsltproc,Python constants,$<,$@)
	$(QUIET)$(VBOX_XSLTPROC) -o $@ $< $(VBOX_XIDL_FILE)

endif # VBOX_WITH_PYTHON

ifndef VBOX_ONLY_SDK # Note this goes on for *very* long

#
# Generate SchemaDefs.h and SchemaDefs.cpp from XML Schema
# These two files are used by both VBoxC and VBoxSVC.
#
BLDDIRS += $(PATH_TARGET)/Main
VBOX_XML_SCHEMADEFS_H   = $(PATH_TARGET)/Main/SchemaDefs.h
VBOX_XML_SCHEMADEFS_CPP = $(PATH_TARGET)/Main/SchemaDefs.cpp
VBOX_XML_SCHEMADEFS_XSL = $(VBOX_PATH_MAIN_SRC)/xml/SchemaDefs.xsl

testschemadefs: $(VBOX_XML_SCHEMADEFS_H) $(VBOX_XML_SCHEMADEFS_CPP)


#
# VBoxSVC executable
#
PROGRAMS += VBoxSVC
VBoxSVC_TEMPLATE = VBOXMAINEXE
VBoxSVC_DEFS = \
	VBOX_MAIN_SETTINGS_ADDONS \
	IN_VMM_STATIC \
	$(VBOX_MAIN_DEFS) \
	$(if $(VBOX_WITH_VBOXSDL),VBOX_WITH_VBOXSDL,) \
	$(if $(VBOX_WITH_VRDP),VBOX_WITH_VRDP,) \
	$(if $(VBOX_WITH_HEADLESS),VBOX_WITH_HEADLESS,) \
	$(if $(VBOX_WITH_QTGUI),VBOX_WITH_QTGUI,) \
	$(if $(VBOX_WITH_COCOA_QT),VBOX_WITH_COCOA_QT,) \
	$(if $(VBOX_WITH_HGCM),VBOX_WITH_HGCM,) \
	$(if $(VBOX_MAIN_RELEASE_LOG),VBOX_MAIN_RELEASE_LOG LOG_ENABLED,) \
	$(if $(VBOX_WITH_ALSA),VBOX_WITH_ALSA,) \
	$(if $(VBOX_WITH_PULSE),VBOX_WITH_PULSE,) \
	$(if $(VBOX_WITH_WINMM),VBOX_WITH_WINMM,) \
	$(if $(VBOX_WITH_SOLARIS_OSS),VBOX_WITH_SOLARIS_OSS,) \
	$(if $(VBOX_WITH_E1000),VBOX_WITH_E1000,) \
	$(if $(VBOX_WITH_VIRTIO),VBOX_WITH_VIRTIO,) \
	$(if $(VBOX_WITH_AHCI),VBOX_WITH_AHCI,) \
	$(if $(VBOX_WITH_LSILOGIC),VBOX_WITH_LSILOGIC,) \
	$(if $(VBOX_WITH_LINUX_COMPILER_H),VBOX_WITH_LINUX_COMPILER_H,) \
	$(if $(VBOX_WITH_RESOURCE_USAGE_API),VBOX_WITH_RESOURCE_USAGE_API,) \
	$(if $(VBOX_WITH_PDM_ASYNC_COMPLETION),VBOX_WITH_PDM_ASYNC_COMPLETION,) \
	$(if $(VBOX_WITH_DBUS),$(if $(VBOX_USB_WITH_DBUS),VBOX_USB_WITH_DBUS,),) \
	$(if $(VBOX_USB_WITH_SYSFS),VBOX_USB_WITH_SYSFS,) \
	$(if $(VBOX_USB_WITH_INOTIFY),VBOX_USB_WITH_INOTIFY,) \
	$(if $(VBOX_WITH_LIVE_MIGRATION),VBOX_WITH_LIVE_MIGRATION,) \
	$(if $(VBOX_WITH_VUSB),VBOX_WITH_VUSB,)
ifdef VBOX_WITH_USB
 VBoxSVC_DEFS += \
VBOX_WITH_USB \
	$(if $(VBOX_WITH_EHCI),VBOX_WITH_EHCI,) \
	$(if $(VBOX_WITH_NEW_USB_CODE_ON_DARWIN),VBOX_WITH_NEW_USB_CODE_ON_DARWIN,) \
	$(if $(VBOX_WITH_NEW_USB_CODE_ON_SOLARIS),VBOX_WITH_NEW_USB_CODE_ON_SOLARIS,)
endif
VBoxSVC_DEFS.win += VBOX_COM_OUTOFPROC_MODULE
VBoxSVC_DEFS.win.x86 += _WIN32_WINNT=0x0500
VBoxSVC_DEFS.win.amd64 += _WIN32_WINNT=0x0510
# Try to load and use libhal at runtime for probing removable media
# VBoxSVC_DEFS.linux += VBOX_USE_LIBHAL
VBoxSVC_DEFS.solaris += VBOX_USE_LIBHAL
VBoxSVC_DEFS.freebsd += VBOX_USE_LIBHAL
ifdef VBOX_SOLARIS_NSL_RESOLVED
 VBoxSVC_DEFS.solaris += VBOX_SOLARIS_NSL_RESOLVED
endif

VBoxSVC_CXXFLAGS = $(filter-out -Wno-unused,$(TEMPLATE_VBOXMAINEXE_CXXFLAGS))
## @todo We're disabling optimizations on FreeBSD to work around strange linker
#        errors in release builds. Figure out why and how to work around it in a
#        more optimal fashion.
VBoxSVC_CXXFLAGS.freebsd = -O0

VBoxSVC_INCS = \
	include \
	$(PATH_VBoxSVC) \
	$(dir $(VBOX_XML_SCHEMADEFS_H)) \
	.
VBoxSVC_INCS.win = \
	$(PATH_VBoxCOM)
ifdef VBOX_WITH_USB
 VBoxSVC_INCS.os2 = \
	$(PATH_ROOT)/src/VBox/HostDrivers/VBoxUSB/os2
endif

VBoxSVC_LIBS += \
	$(PATH_LIB)/SSMStandalone$(VBOX_SUFF_LIB) \
	$(LIB_DDU)
VBoxSVC_LIBS.solaris = \
	adm \
	nsl \
	socket

ifdef VBOX_WITH_NETFLT
 ifdef VBOX_SOLARIS_NSL_RESOLVED
  VBoxSVC_LIBS.solaris += devinfo
 endif
 VBoxSVC_LIBS.solaris += socket
endif
ifdef VBOX_WITH_USB
 VBoxSVC_LIBS.solaris += \
	devinfo
endif

VBoxSVC_INTERMEDIATES = \
	$(VBOX_MAIN_PREREQS) \
	$(VBOX_XML_SCHEMADEFS_H)

VBoxSVC_SOURCES = \
	Global.cpp \
	Logging.cpp \
	Matching.cpp \
	xml/Settings.cpp \
	VirtualBoxBase.cpp \
	VirtualBoxErrorInfoImpl.cpp \
	VirtualBoxImpl.cpp \
	ApplianceImpl.cpp \
	ApplianceImplExport.cpp \
	ApplianceImplImport.cpp \
	xml/ovfreader.cpp \
	VFSExplorerImpl.cpp \
	MachineImpl.cpp \
	SnapshotImpl.cpp \
	MediumImpl.cpp \
	MediumLock.cpp \
	MediumAttachmentImpl.cpp \
	MediumFormatImpl.cpp \
	ProgressImpl.cpp \
	ProgressProxyImpl.cpp \
	HostImpl.cpp \
	HostNetworkInterfaceImpl.cpp \
	DHCPServerImpl.cpp \
	DHCPServerRunner.cpp \
	GuestOSTypeImpl.cpp \
	NATEngineImpl.cpp \
	NetworkAdapterImpl.cpp \
	SerialPortImpl.cpp \
	ParallelPortImpl.cpp \
	USBControllerImpl.cpp \
	StorageControllerImpl.cpp \
	AudioAdapterImpl.cpp \
	SharedFolderImpl.cpp \
	SystemPropertiesImpl.cpp \
	BIOSSettingsImpl.cpp \
	HostPower.cpp \
	$(if $(VBOX_WITH_VRDP),VRDPServerImpl.cpp,) \
	$(if $(VBOX_WITH_XPCOM),xpcom/server.cpp,) \
	$(VBOX_XML_SCHEMADEFS_CPP)

VBoxSVC_SOURCES.darwin = \
	darwin/iokit.cpp \
	darwin/HostPowerDarwin.cpp

ifdef VBOX_WITH_CROGL
  ifneq ($(KBUILD_TARGET),darwin)
    VBoxSVC_SOURCES += generic/OpenGLTest.cpp
  endif
 VBoxSVC_SOURCES.darwin += darwin/OpenGLTestDarwin.cpp
endif

VBoxSVC_SOURCES.win = \
	win/svcmain.cpp \
	win/svchlp.cpp \
	win/HostPowerWin.cpp \
	win/VBoxSVC.rc

VBoxSVC_SOURCES.linux = \
	linux/HostHardwareLinux.cpp

VBoxSVC_SOURCES.solaris = \
	linux/vbox-libhal.cpp \
	solaris/DynLoadLibSolaris.cpp

VBoxSVC_SOURCES.freebsd = \
	freebsd/HostHardwareFreeBSD.cpp

ifdef VBOX_WITH_USB
 ifdef VBOX_WITH_SYSFS_BY_DEFAULT
  linux/USBProxyServiceLinux.cpp_DEFS += VBOX_WITH_SYSFS_BY_DEFAULT
 endif
 VBoxSVC_SOURCES  += \
	USBDeviceFilterImpl.cpp \
	USBProxyService.cpp \
	HostUSBDeviceImpl.cpp
 VBoxSVC_SOURCES.darwin  +=  darwin/USBProxyServiceDarwin.cpp
 VBoxSVC_SOURCES.linux   +=   linux/USBProxyServiceLinux.cpp
 VBoxSVC_SOURCES.os2     +=     os2/USBProxyServiceOs2.cpp
 VBoxSVC_SOURCES.solaris += solaris/USBProxyServiceSolaris.cpp
 VBoxSVC_SOURCES.win     +=     win/USBProxyServiceWindows.cpp
 VBoxSVC_SOURCES.freebsd += freebsd/USBProxyServiceFreeBSD.cpp
endif

ifdef VBOX_WITH_NETFLT
 # Note! The includes from the TOOL has lower priority than the SDKs,
 #       since comdef.h is in both the DDK and VCC we want to make sure
 #       we're using the VCC since we're not using the DDK compiler/crt.
 #       Since this is potentially risky, restrict it to the source file
 #       needing it.
 win/NetIf-win.cpp_INCS.win += $(PATH_TOOL_$(VBOX_VCC_TOOL)_INC)
 VBoxSVC_LIBS.win += \
	$(PATH_LIB)/WinNetConfig.lib \
	$(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/comsupp.lib \
	$(PATH_SDK_WINPSDK_LIB)/WbemUuid.Lib
 ifdef VBOX_NETFLT_ONDEMAND_BIND
  VBoxSVC_DEFS.win += VBOX_NETFLT_ONDEMAND_BIND
 endif
endif
VBoxSVC_LDFLAGS.darwin    = -framework IOKit -framework SystemConfiguration

ifdef VBOX_WITH_CROGL
 VBoxSVC_LDFLAGS.darwin += -framework OpenGL
endif

ifeq ($(KBUILD_TYPE),debug)
 VBoxSVC_LDFLAGS.linux   += -rdynamic # for backtrace_symbols()
endif

ifdef VBOX_WITH_RESOURCE_USAGE_API
 VBoxSVC_SOURCES += \
	PerformanceImpl.cpp \
	Performance.cpp
 VBoxSVC_SOURCES.darwin  +=  darwin/PerformanceDarwin.cpp
 VBoxSVC_SOURCES.freebsd += freebsd/PerformanceFreeBSD.cpp
 VBoxSVC_SOURCES.linux   +=   linux/PerformanceLinux.cpp
 VBoxSVC_SOURCES.os2     +=     os2/PerformanceOs2.cpp
 VBoxSVC_SOURCES.solaris += solaris/PerformanceSolaris.cpp
 VBoxSVC_SOURCES.win     +=     win/PerformanceWin.cpp
 VBoxSVC_LDFLAGS.darwin  += -lproc
 VBoxSVC_LDFLAGS.solaris += -lkstat
 VBoxSVC_LDFLAGS.win     += psapi.lib powrprof.lib
endif

ifdef VBOX_WITH_HOSTNETIF_API
 VBoxSVC_SOURCES.win     +=     win/NetIf-win.cpp
 VBoxSVC_SOURCES.linux   +=   linux/NetIf-linux.cpp
 VBoxSVC_SOURCES.os2     +=     os2/NetIf-os2.cpp
 VBoxSVC_SOURCES.darwin  +=  darwin/NetIf-darwin.cpp
 VBoxSVC_SOURCES.solaris += solaris/NetIf-solaris.cpp
 VBoxSVC_SOURCES.freebsd += freebsd/NetIf-freebsd.cpp
 VBoxSVC_DEFS            += VBOX_WITH_HOSTNETIF_API
 if1of ($(KBUILD_TARGET), linux darwin solaris freebsd)
  VBoxSVC_SOURCES        += generic/NetIf-generic.cpp
 endif
endif

win/VBoxSVC.rc_INCS  = $(PATH_VBoxSVC)
win/VBoxSVC.rc_DEPS  = $(PATH_VBoxSVC)/VBoxSVC.rgs $(PATH_VBoxSVC)/VBoxSVC-icon.rc
win/VBoxSVC.rc_CLEAN = $(PATH_VBoxSVC)/VBoxSVC.rgs $(PATH_VBoxSVC)/VBoxSVC-icon.rc

$$(PATH_VBoxSVC)/VBoxSVC-icon.rc: $(MAKEFILE_CURRENT) $(VBOX_WINDOWS_ICON_FILE) | $$(dir $$(@D))
	$(APPEND) -t $@ '1 ICON DISCARDABLE "$(subst /,\\,$(VBOX_WINDOWS_ICON_FILE))"'

$$(PATH_VBoxSVC)/VBoxSVC.rgs: $(VBOX_PATH_MAIN_SRC)/win/VirtualBox_rgs.xsl $(VBOX_XIDL_FILE) | $$(dir $$(@D))
	$(VBOX_XSLTPROC) --stringparam Module VBoxSVC -o $@ $< $(VBOX_XIDL_FILE)

#
# Embed XML Schema files to VBoxSVC
#
VBOX_XML_SCHEMA_COMMON        = $(VBOX_PATH_MAIN_SRC)/xml/VirtualBox-settings-common.xsd
VBOX_XML_SCHEMA.darwin        = $(VBOX_PATH_MAIN_SRC)/xml/VirtualBox-settings-macosx.xsd
VBOX_XML_SCHEMA.linux         = $(VBOX_PATH_MAIN_SRC)/xml/VirtualBox-settings-linux.xsd
VBOX_XML_SCHEMA.freebsd       = $(VBOX_PATH_MAIN_SRC)/xml/VirtualBox-settings-freebsd.xsd
VBOX_XML_SCHEMA.win           = $(VBOX_PATH_MAIN_SRC)/xml/VirtualBox-settings-windows.xsd
VBOX_XML_SCHEMA.os2           = $(VBOX_PATH_MAIN_SRC)/xml/VirtualBox-settings-os2.xsd
VBOX_XML_SCHEMA.solaris       = $(VBOX_PATH_MAIN_SRC)/xml/VirtualBox-settings-solaris.xsd

VBOX_XML_CONVERTER_TEMPLATE   = $(VBOX_PATH_MAIN_SRC)/xml/SettingsConverter.xsl

$$(PATH_VBoxSVC)/xml_VirtualBox_settings_xsd.h: $(VBOX_XML_SCHEMA.$(KBUILD_TARGET)) $(VBOX_BIN2C)
	$(call MSG_TOOL,bin2c,VBoxSVC,$<,$@)
	$(QUIET)$(VBOX_BIN2C) _xml_VirtualBox_settings_xsd $< $@

$$(PATH_VBoxSVC)/xml_VirtualBox_settings_common_xsd.h: $(VBOX_XML_SCHEMA_COMMON) $(VBOX_BIN2C)
	$(call MSG_TOOL,bin2c,VBoxSVC,$<,$@)
	$(QUIET)$(VBOX_BIN2C) _xml_VirtualBox_settings_common_xsd $< $@

$$(PATH_VBoxSVC)/xml_SettingsConverter_xsl.h: $(VBOX_XML_CONVERTER_TEMPLATE) $(VBOX_BIN2C)
	$(call MSG_TOOL,bin2c,VBoxSVC,$<,$@)
	$(QUIET)$(VBOX_BIN2C) _xml_SettingsConverter_xsl $< $@

$(VBOX_XML_SCHEMADEFS_H): $(VBOX_XML_SCHEMADEFS_XSL) $(VBOX_XML_SCHEMA.$(KBUILD_TARGET)) $(VBOX_XML_SCHEMA_COMMON) | $$(dir $$@)
	$(call MSG_GENERATE,SchemaDefs,$@,$<)
	$(VBOX_XSLTPROC)  --stringparam mode declare -o $@ $(VBOX_XML_SCHEMADEFS_XSL) $(VBOX_XML_SCHEMA.$(KBUILD_TARGET))

$(VBOX_XML_SCHEMADEFS_CPP): $(VBOX_XML_SCHEMADEFS_XSL) $(VBOX_XML_SCHEMA.$(KBUILD_TARGET)) $(VBOX_XML_SCHEMA_COMMON)  | $$(dir $$@)
	$(call MSG_GENERATE,SchemaDefs,$@,$<)
	$(VBOX_XSLTPROC)  --stringparam mode define  -o $@ $(VBOX_XML_SCHEMADEFS_XSL) $(VBOX_XML_SCHEMA.$(KBUILD_TARGET))

OTHER_CLEAN += $(VBOX_XML_SCHEMADEFS_H) $(VBOX_XML_SCHEMADEFS_CPP)


if (   defined(VBOX_WITH_QTGUI) \
    && (defined(VBOX_WITH_CROGL) || defined(VBOX_WITH_VIDEOHWACCEL)) \
    && !defined(VBOX_WITH_DEBUG_VCC_CRT))
 ifneq ($(KBUILD_TARGET),darwin)
  #
  # VBoxTestOGL - OpenGL support test app.
  # Note! Doesn't link with VBOX_WITH_DEBUG_VCC_CRT defined because it uses Qt.
  #
  ifdef VBOX_WITH_VIDEOHWACCEL
   USES += qt4
  endif
  PROGRAMS += VBoxTestOGL
  VBoxTestOGL_TEMPLATE = $(if $(VBOX_WITH_VIDEOHWACCEL),$(if $(VBOX_WITH_HARDENING),VBOXQT4GUI,VBOXQT4GUIEXE),VBOXMAINEXE)
  VBoxTestOGL_SOURCES = generic/OpenGLTestApp.cpp
  VBoxTestOGL_LIBS = \
	$(if $(VBOX_WITH_CROGL), \
	  $(PATH_LIB)/VBoxOGLhostspuload$(VBOX_SUFF_LIB) \
	  $(VBOX_LIB_OGL_HOSTCRUTIL),) \
	$(if $(VBOX_WITH_VIDEOHWACCEL), $(PATH_LIB)/VBoxOGL2D$(VBOX_SUFF_LIB),) \
	$(LIB_RUNTIME)
  VBoxTestOGL_DEFS += \
	$(if $(VBOX_WITH_CROGL), VBOX_WITH_CROGL,) \
	$(if $(VBOX_WITH_VIDEOHWACCEL), VBOX_WITH_VIDEOHWACCEL,) \
	VBOX_BUILD_TARGET=\"$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)\" \
	$(if $(VBOX_BLEEDING_EDGE),VBOX_BLEEDING_EDGE=\"$(VBOX_BLEEDING_EDGE)\",)
  ifdef VBOX_WITH_VIDEOHWACCEL
   VBoxTestOGL_QT_MODULES += Core Gui OpenGL
   VBoxTestOGL_LDFLAGS.darwin += -framework OpenGL
   VBoxTestOGL_LIBS.win     += $(PATH_SDK_WINPSDK_LIB)/Opengl32.lib
   if1of ($(KBUILD_TARGET), solaris linux freebsd)
    # must come after VBoxOGL2D, therefore don't set the arch-specific LIBS variable here!
    VBoxTestOGL_LIBS += GL
   endif
  endif
  VBoxTestOGL_LDFLAGS.win = /SUBSYSTEM:windows
 endif
endif


ifdef VBOX_WITH_XPCOM
#
# VBoxSVCM - VBoxSVC wrapper module
#
DLLS += VBoxSVCM
VBoxSVCM_TEMPLATE       = VBOXMAINCOMP
VBoxSVCM_DEFS           = IN_RING3 $(VBOX_MAIN_DEFS)
ifdef VBOX_WITH_HARDENING
 VBoxSVCM_DEFS         += VBOX_WITH_HARDENING
endif
VBoxSVCM_INCS           = \
	include \
	$(PATH_VBoxC) \
	.
VBoxSVCM_INTERMEDIATES  = $(VBOX_MAIN_PREREQS)
VBoxSVCM_SOURCES        = \
	xpcom/server_module.cpp
VBoxSVCM_LDFLAGS.darwin = \
	-install_name $(VBOX_DYLD_EXECUTABLE_PATH)/components/VBoxSVCM.dylib \
	-exported_symbols_list $(PATH_VBoxSVCM)/VBoxSVCM.def
 ifeq ($(KBUILD_TARGET),darwin)
VBoxSVCM_ORDERDEPS     += $(PATH_VBoxSVCM)/VBoxSVCM.def
VBoxSVCM_CLEAN         += $(PATH_VBoxSVCM)/VBoxSVCM.def
$$(PATH_VBoxSVCM)/VBoxSVCM.def:
	$(RM) -f $@
	$(APPEND) $@ _NSGetModule
 endif
VBoxSVCM_INTERMEDIATES += $(VBOX_IDL_HEADER.XPCOM)

endif # VBOX_WITH_XPCOM

#
# VBoxC module
#
DLLS += VBoxC
VBoxC_TEMPLATE = VBOXMAINCOMP
VBoxC_SDKS =  VBOX_LIBPNG VBOX_ZLIB
VBoxC_DEFS = \
	IN_RING3 \
	$(VBOX_MAIN_DEFS) \
	VBOX_COM_INPROC \
	$(if $(VBOX_WITH_VRDP),VBOX_WITH_VRDP,) \
	$(if $(VBOX_WITH_VRDP_VIDEO_CHANNEL),VBOX_WITH_VRDP_VIDEO_CHANNEL,) \
	$(if $(VBOX_WITH_HGCM),VBOX_WITH_HGCM,) \
	$(if $(VBOX_MAIN_RELEASE_LOG),VBOX_MAIN_RELEASE_LOG LOG_ENABLED,) \
	$(if $(VBOX_WITH_ALSA),VBOX_WITH_ALSA,) \
	$(if $(VBOX_WITH_PULSE),VBOX_WITH_PULSE,) \
	$(if $(VBOX_WITH_WINMM),VBOX_WITH_WINMM,) \
	$(if $(VBOX_WITH_SOLARIS_OSS),VBOX_WITH_SOLARIS_OSS,) \
	$(if $(VBOX_WITH_CROSSBOW),VBOX_WITH_CROSSBOW,) \
	$(if $(VBOX_WITH_E1000),VBOX_WITH_E1000,) \
	$(if $(VBOX_WITH_VIRTIO),VBOX_WITH_VIRTIO,) \
	$(if $(VBOX_WITH_EFI),VBOX_WITH_EFI,) \
	$(if $(VBOX_WITH_HPET),VBOX_WITH_HPET,) \
	$(if $(VBOX_WITH_SMC),VBOX_WITH_SMC,) \
	$(if $(VBOX_WITH_LPC),VBOX_WITH_LPC,) \
	$(if $(VBOX_WITH_PDM_ASYNC_COMPLETION),VBOX_WITH_PDM_ASYNC_COMPLETION,) \
	$(if $(VBOX_WITH_LIVE_MIGRATION),VBOX_WITH_LIVE_MIGRATION,) \
	$(if $(VBOX_WITH_VUSB),VBOX_WITH_VUSB,)
ifdef VBOX_WITH_USB
VBoxC_DEFS += \
	VBOX_WITH_USB \
	$(if $(VBOX_WITH_EHCI),VBOX_WITH_EHCI,)
endif
ifdef VBOX_WITH_OLD_VBVA_LOCK
VBoxC_DEFS += VBOX_WITH_OLD_VBVA_LOCK
endif
ifdef VBOX_WITH_HGSMI
VBoxC_DEFS += VBOX_WITH_HGSMI
endif
ifdef VBOX_WITH_VIDEOHWACCEL
VBoxC_DEFS += VBOX_WITH_VIDEOHWACCEL
endif

ifdef VBOX_DYNAMIC_NET_ATTACH
VBoxC_DEFS += VBOX_DYNAMIC_NET_ATTACH
endif

VBoxC_DEFS.darwin.x86 = VBOX_WITH_2X_4GB_ADDR_SPACE
VBoxC_DEFS.win.x86 += _WIN32_WINNT=0x0500
VBoxC_DEFS.win.amd64 += _WIN32_WINNT=0x0510

#temporary define
VBoxC_DEFS += MMSEAMLESS

VBoxC_INCS          = \
	include \
	$(PATH_VBoxC) \
	$(dir $(VBOX_XML_SCHEMADEFS_H))
VBoxC_INCS.win      = \
	$(PATH_VBoxCOM) \
	.

VBoxC_LDFLAGS.darwin = \
	-install_name $(VBOX_DYLD_EXECUTABLE_PATH)/components/VBoxC.dylib \
	-exported_symbols_list $(PATH_VBoxC)/VBoxC.def \
	-framework IOKit
ifdef VBOX_USE_VCC80
 VBoxC_LDFLAGS.win = /MANIFEST
endif

VBoxC_LIBS += \
	$(LIB_VMM) \
	$(LIB_REM)

ifdef VBOX_WITH_NETFLT
 VBoxC_LIBS.win += $(PATH_LIB)/WinNetConfig.lib \
	$(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/comsupp.lib \
	$(PATH_SDK_WINPSDK_LIB)/WbemUuid.Lib
endif

VBoxC_INTERMEDIATES = \
	$(VBOX_MAIN_PREREQS) \
	$(VBOX_XML_SCHEMADEFS_H)

VBoxC_SOURCES = \
	Global.cpp \
	Logging.cpp \
	VBoxDll.cpp \
	USBDeviceImpl.cpp \
	RemoteUSBDeviceImpl.cpp \
	VirtualBoxBase.cpp \
	VirtualBoxErrorInfoImpl.cpp \
	ProgressImpl.cpp \
	SharedFolderImpl.cpp \
	SessionImpl.cpp \
	VirtualBoxCallbackImpl.cpp \
	ConsoleImpl.cpp \
	ConsoleImpl2.cpp \
	ConsoleImplTeleporter.cpp \
	ConsoleVRDPServer.cpp \
	GuestImpl.cpp \
	KeyboardImpl.cpp \
	MouseImpl.cpp \
	DisplayImpl.cpp \
	DisplayResampleImage.cpp \
	MachineDebuggerImpl.cpp \
	VBoxDriversRegister.cpp \
	AudioSnifferInterface.cpp \
	VMMDevInterface.cpp \
	$(VBOX_XML_SCHEMADEFS_CPP)
VBoxC_SOURCES.win = \
	win/dllmain.cpp \
	win/VBoxC.def \
	win/VBoxC.rc

ifdef VBOX_WITH_XPCOM
VBoxC_SOURCES += \
	xpcom/module.cpp
endif

ifdef VBOX_WITH_HGCM
VBoxC_SOURCES += \
	hgcm/HGCMObjects.cpp \
	hgcm/HGCMThread.cpp \
	hgcm/HGCM.cpp
endif

ifdef VBOX_WITH_USB
VBoxC_SOURCES += \
	RemoteUSBBackend.cpp
endif

ifeq ($(KBUILD_TARGET),darwin)
VBoxC_ORDERDEPS += $(PATH_VBoxC)/VBoxC.def
VBoxC_CLEAN     += $(PATH_VBoxC)/VBoxC.def
$$(PATH_VBoxC)/VBoxC.def: $(MAKEFILE_CURRENT)
	$(RM) -f $@
	$(APPEND) $@ _NSGetModule
	$(APPEND) $@ _VBoxDriversRegister
endif

ConsoleImpl.cpp_DEFS = \
	VBOX_BUILD_TARGET=\"$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)\" \
	$(if $(VBOX_BLEEDING_EDGE),VBOX_BLEEDING_EDGE=\"$(VBOX_BLEEDING_EDGE)\",)


win/VBoxC.rc_DEPS = $(PATH_VBoxC)/VBoxC.rgs $(PATH_VBoxCOM)/VirtualBox.tlb
VBoxC_CLEAN.win  += $(PATH_VBoxC)/VBoxC.rgs

$$(PATH_VBoxC)/VBoxC.rgs: $(VBOX_PATH_MAIN_SRC)/win/VirtualBox_rgs.xsl $(VBOX_XIDL_FILE) | $$(PATH_VBoxC)/
	$(VBOX_XSLTPROC) --stringparam Module VBoxC -o $@ $< $(VBOX_XIDL_FILE)


#
# VBoxCOM - COM Abstraction Layer library
#
LIBRARIES += VBoxCOM
VBoxCOM_TEMPLATE        = VBOXMAINLIB
VBoxCOM_INTERMEDIATES   = $(VBOX_MAIN_PREREQS)
VBoxCOM_SOURCES         = \
	glue/com.cpp \
	glue/initterm.cpp \
	glue/string.cpp \
	glue/AutoLock.cpp \
	glue/EventQueue.cpp \
	glue/ErrorInfo.cpp \
	glue/errorprint.cpp \
	glue/SupportErrorInfo.cpp \
	glue/VirtualBoxErrorInfo.cpp
VBoxCOM_INCS          += \
	include
ifeq ($(KBUILD_TARGET),win)
 VBoxCOM_DEFS.x86      += _WIN32_WINNT=0x0500
 VBoxCOM_DEFS.amd64    += _WIN32_WINNT=0x0510
 VBoxCOM_SOURCES       += \
	$(PATH_VBoxCOM)/VirtualBox_i.c
else # !win
 VBoxCOM_SOURCES       += \
	xpcom/helpers.cpp
endif # !win


endif # !VBOX_ONLY_SDK (the ifndef is far above)


#
# Installs com related thing(s) to bin.
#
INSTALLS.win += VBoxMain-com-inst
VBoxMain-com-inst_INST = $(INST_BIN)
VBoxMain-com-inst_SOURCES = \
	win/comregister.cmd


if defined(VBOX_WITH_HARDENING) && "$(KBUILD_TARGET)" == "linux"
 #
 # Installs linux/hardening related things to components.
 #
 INSTALLS.linux += VBoxMain-hardening-inst
 VBoxMain-hardening-inst_INST = $(INST_BIN)components/
 VBoxMain-hardening-inst_SYMLINKS = \
	VBoxDDU.so=>../VBoxDDU.so \
	VBoxREM.so=>../VBoxREM.so \
	VBoxRT.so=>../VBoxRT.so \
	VBoxVMM.so=>../VBoxVMM.so \
	VBoxXPCOM.so=>../VBoxXPCOM.so
endif


# generate rules
include $(KBUILD_PATH)/subfooter.kmk



#
# Additions rules.
#

## @todo this hack ain't cutting it any longer. (the file name is abspath'ed since ages now.)
xpcom/helpers.cpp: $(VBOX_IDL_TYPELIB.XPCOM)

$(VBOX_IDL_FILE.XPCOM): $(VBOX_PATH_MAIN_SRC)/idl/xpidl.xsl $(VBOX_XIDL_FILE) | $$(dir $$@)
	$(call MSG_TOOL,xsltproc,VBoxSVC,$<,$@)
	$(QUIET)$(VBOX_XSLTPROC) -o $@ $< $(VBOX_XIDL_FILE)

$(VBOX_IDL_TYPELIB.XPCOM): $(VBOX_IDL_FILE.XPCOM) |  $$(dir $$@) $(VBOX_XPIDL)
	$(call MSG_TOOL,xpidl,VBoxSVC,$<,$@)
	$(QUIET)$(VBOX_XPIDL_ENV)$(VBOX_XPIDL) -m typelib -I $(VBOX_PATH_XPCOM_IDL) -e $@ $<
	$(CHMOD) 0644 $@
## @todo ^^^^^^^^^^^^ fix horrible hack

$(VBOX_IDL_HEADER.XPCOM): $(VBOX_IDL_FILE.XPCOM) | $$(dir $$@) $(VBOX_XPIDL)
	$(call MSG_TOOL,xpidl,VBoxSVC,$<,$@)
	$(QUIET)$(VBOX_XPIDL_ENV)$(VBOX_XPIDL) -m header  -I $(VBOX_PATH_XPCOM_IDL) -e $@ $<


VBOX_MAIN_IDL ?= $(EXEC_X86_WIN32) $(call VBOX_FN_MAKE_WIN_PATH,$(firstword $(wildcard \
	$(PATH_SDK_WINPSDK_BIN)/Midl.Exe\
	$(PATH_SDK_WINPSDK)/Bin/Midl.Exe\
	$(PATH_DEVTOOLS)/win.x86/bin/midl.exe\
	) Sorry_Cannot_Find_The_Midl_Compiler_In_The_PSDK))
IDL_DEFS = /nologo
ifdef VBOX_WITH_VRDP
 IDL_DEFS += /D VBOX_WITH_VRDP
endif

$(VBOX_IDL_FILE.MSCOM): $(VBOX_PATH_MAIN_SRC)/idl/midl.xsl $(VBOX_XIDL_FILE) | $$(dir $$@)
	$(call MSG_TOOL,xsltproc,VBoxSVC,$<,$@)
	$(QUIET)$(VBOX_XSLTPROC) -o $@ $< $(VBOX_XIDL_FILE)

# Aliases for testing purposes.
ifdef VBOX_WITH_XPCOM
testidl:    $(VBOX_IDL_FILE.XPCOM) $(VBOX_IDL_TYPELIB.XPCOM)
testidlhdr: $(VBOX_IDL_HEADER.XPCOM)
else
testidl:    $(VBOX_IDL_FILE.MSCOM) $(PATH_VBoxCOM)/VirtualBox_i.c
endif


## @todo r=bird: last changes to this rule showed incorrect dependencies here as it broke testcase (see testboxwin2).
# This is kind of obvious when looking at the rule, because it's (a) not specifying all it output
# and (b) generating more stuff *after* the main target has been completed.
#
# What needs to be done is to not depend on _i.c in the object subdir, but on all the final outputs.
$(PATH_VBoxCOM)/VirtualBox_i.c \
+ $(VBOX_PATH_SDK)/bindings/mscom/lib/VirtualBox_i.c \
+ $(PATH_VBoxCOM)/VirtualBox.h \
+ $(VBOX_PATH_SDK)/bindings/mscom/include/VirtualBox.h \
+ $(PATH_VBoxCOM)/VirtualBox.tlb \
+ $(VBOX_PATH_SDK)/bindings/mscom/lib/VirtualBox.tlb: $(VBOX_IDL_FILE.MSCOM) | $(call DIRDEP,$(PATH_VBoxCOM))
	$(VBOX_MAIN_IDL) $(IDL_DEFS) \
		/out $(call VBOX_FN_MAKE_WIN_PATH,$(PATH_VBoxCOM)) \
		/cpp_cmd $(subst $(EXEC_X86_WIN32),,$(call VBOX_FN_MAKE_WIN_PATH,$(TOOL_$(VBOX_VCC_TOOL)_CC))) \
		/I $(call VBOX_FN_MAKE_WIN_PATH,$(PATH_SDK_WINPSDK_INC)) \
		/I idl \
		$(call VBOX_FN_MAKE_WIN_PATH,$<)
	$(MKDIR) -p $(VBOX_PATH_SDK)/bindings/mscom/include
	$(CP) $(PATH_VBoxCOM)/VirtualBox.h $(VBOX_PATH_SDK)/bindings/mscom/include
	$(MKDIR) -p $(VBOX_PATH_SDK)/bindings/mscom/lib
	$(CP) $(PATH_VBoxCOM)/VirtualBox.tlb $(VBOX_PATH_SDK)/bindings/mscom/lib
	$(CP) $(PATH_VBoxCOM)/VirtualBox_i.c $(VBOX_PATH_SDK)/bindings/mscom/lib

#
# Translation stuff
#
VBoxSVC_VBOX_HEADERS = \
	include/collection.h \
	include/MachineImpl.h
VBoxSVC_VBOX_TRANSLATIONS = \
	nls/VBoxSVC_de.ts

VBoxC_VBOX_HEADERS = \
	include/ConsoleImpl.h
VBoxC_VBOX_TRANSLATIONS = \
	nls/VBoxC_de.ts

ifdef VBOX_WITH_JMSCOM
INSTALLS += VBoxJMscom-inst-jar

#
# Java glue JAR files
#
VBOX_JMSCOM_JAR     = $(VBoxJMscom-inst-jar_0_OUTDIR)/vboxjmscom.jar
VBOX_JMSCOM_TARGET := $(PATH_TARGET)/vboxjmscom-gen
VBOX_JMSCOM_GEN     = $(VBOX_JMSCOM_TARGET)/jmscomgen
VBOX_JMSCOM_JDEST  := $(VBOX_JMSCOM_TARGET)/jdest
VBOX_GLUE_XSLT_DIR := $(PATH_ROOT)/src/VBox/Main/glue
VBOX_JACOB_DIR     := $(PATH_ROOT)/src/libs/jacob-1.15-M3

VBoxJMscom-inst-jar_INST = $(INST_SDK)bindings/mscom/java/
VBoxJMscom-inst-jar_SOURCES = \
	$(VBOX_JMSCOM_JAR)
VBoxJMscom-inst-jar_CLEAN = \
	$(VBOX_JMSCOM_JAR) \
	$(VBOX_JMSCOM_GEN)/jmscomglue.list \
	$(wildcard \
		$(VBOX_JMSCOM_GEN)/java/*.java \
		$(VBOX_JMSCOM_JDEST)/*.class \
		$(VBOX_JMSCOM_JDEST)/*/*.class \
		$(VBOX_JMSCOM_JDEST)/*/*/*.class \
		$(VBOX_JMSCOM_JDEST)/*/*/*/*.class \
	)
VBoxJMscom-inst-jar_BLDDIRS += $(VBOX_JMSCOM_GEN)/java

$(VBOX_JMSCOM_GEN)/jmscomglue.list:  \
		$(VBOX_XIDL_FILE)    \
                $(VBOX_GLUE_XSLT_DIR)/glue-java.xsl \
                $(VBOX_FILESPLIT)    \
		| $(VBOX_JMSCOM_GEN)/java/
	$(call MSG_L1,Generating Java glue files from XIDL)
	$(QUIET)$(RM) -f $(wildcard $(VBOX_JMSCOM_GEN)/java/*.java)
	$(QUIET)$(VBOX_XSLTPROC) \
              --stringparam G_vboxApiSuffix $(VBOX_API_SUFFIX) \
              --stringparam G_vboxGlueStyle mscom              \
              -o $(VBOX_JMSCOM_GEN)/java/merged.file $(VBOX_GLUE_XSLT_DIR)/glue-java.xsl $<
	$(QUIET)$(VBOX_FILESPLIT) $(VBOX_JMSCOM_GEN)/java/merged.file $(VBOX_JMSCOM_GEN)/java
	$(QUIET)echo $(VBOX_JMSCOM_GEN)/java/*.java > $@

$$(VBOX_JMSCOM_JAR): $(VBOX_JMSCOM_GEN)/jmscomglue.list | $$(dir $$@)
	$(call MSG_TOOL,javac,$(notdir $@),jmscomgen.list,)
	$(QUIET)$(RM) -Rf $(VBOX_JMSCOM_JDEST)
	$(QUIET)$(MKDIR) -p $(VBOX_JMSCOM_JDEST)
	$(call MSG_TOOL,javac,$(notdir $@),...,)
	$(VBOX_JAVAC) $(VBOX_JAVAC_OPTS) \
                @$(VBOX_JMSCOM_GEN)/jmscomglue.list \
		-d $(VBOX_JMSCOM_JDEST) -classpath $(VBOX_JMSCOM_JDEST)$(VBOX_SEP)$(VBOX_JACOB_DIR)/jacob.jar
	$(call MSG_LINK,$(notdir $@),$@)
	$(VBOX_JAR) cf $@ -C $(VBOX_JMSCOM_JDEST) .

endif # VBOX_WITH_JMSCOM

updatenls::
	$(VBOX_LUPDATE) $(VBoxSVC_SOURCES) $(VBoxSVC_VBOX_HEADERS) -ts $(VBoxSVC_VBOX_TRANSLATIONS)
	$(VBOX_LUPDATE) $(VBoxC_SOURCES) $(VBoxC_VBOX_HEADERS) -ts $(VBoxC_VBOX_TRANSLATIONS)

testconverter:: $(VBOX_USER_HOME)/VirtualBox.xml
	$(call MSG_TOOL,xsltproc,Test Settings Converter,$<,$(VBOX_USER_HOME)/VirtualBox.xml.test)
	$(QUIET)$(VBOX_XSLTPROC) -o $(VBOX_USER_HOME)/VirtualBox.xml.test xml/SettingsConverter.xsl $<

testconverter2:: $(VBOX_USER_HOME)/Machines/dos/dos.xml
	$(call MSG_TOOL,xsltproc,Test Settings Converter,$<,$<.test)
	$(QUIET)$(VBOX_XSLTPROC) -o $<.test xml/SettingsConverter.xsl $<