VirtualBox

source: vbox/trunk/include/Makefile.kmk@ 93444

Last change on this file since 93444 was 93444, checked in by vboxsync, 3 years ago

VMM,Main,HostServices: Use a function table for accessing the VBoxVMM.dll/so/dylib functionality, and load it dynamically when the Console object is initialized. Also converted a few drivers in Main to use device helpers to get config values and such. bugref:10074

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.1 KB
Line 
1# $Id: Makefile.kmk 93444 2022-01-26 18:01:15Z vboxsync $
2## @file
3# Some hacks to allow syntax and prerequisite include checking of headers.
4# This makefile doesn't and shouldn't build successfully.
5#
6
7#
8# Copyright (C) 2006-2022 Oracle Corporation
9#
10# This file is part of VirtualBox Open Source Edition (OSE), as
11# available from http://www.virtualbox.org. This file is free software;
12# you can redistribute it and/or modify it under the terms of the GNU
13# General Public License (GPL) as published by the Free Software
14# Foundation, in version 2 as it comes in the "COPYING" file of the
15# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17#
18
19SUB_DEPTH = ..
20include $(KBUILD_PATH)/subheader.kmk
21
22LIBRARIES += SyntaxVBoxIncludeR3 SyntaxVBoxIncludeR0
23
24# Omit headers that are using C++ features and upsets gcc.
25VBOX_HDRS_CPP_FEATURES := \
26 VBox/vmm/hm.h \
27 VBox/vmm/hm_vmx.h \
28 VBox/vmm/pdmaudioinline.h \
29 VBox/vmm/pdmaudiohostenuminline.h \
30 VBox/HostServices/GuestControlSvc.h \
31 VBox/HostServices/DragAndDropSvc.h \
32 VBox/HostServices/Service.h \
33 VBox/GuestHost/GuestControl.h \
34 VBox/GuestHost/DragAndDrop.h \
35 VBox/GuestHost/SharedClipboard-transfers.h \
36 VBox/dbus.h \
37 VBox/xrandr.h \
38 VBox/VBoxCrHgsmi.h \
39 VBox/VBoxGuestLibSharedFoldersInline.h \
40 VBox/VBoxPktDmp.h \
41 VBox/VBoxUhgsmi.h \
42 iprt/cpp/%
43
44# Omit headers that are C++ and ring-3.
45VBOX_HDRS_R3_CPP := \
46 VBox/dbggui.h \
47 VBox/settings.h \
48 VBox/com/Guid.h \
49 VBox/vmm/vmmapi.h \
50 iprt/cpp/% \
51 VBox/com/% \
52 $(subst $(PATH_SUB_CURRENT)/,,$(wildcard $(PATH_SUB_CURRENT)/iprt/*_cpp.h))
53
54# Ring-3 only headers.
55VBOX_HDRS_R3_ONLY := \
56 VBox/vrdpapi.h \
57 VBox/vrdpusb.h \
58 VBox/VBoxHDD.h \
59 VBox/VBoxHDD-Plugin.h \
60 VBox/VBoxCrHgsmi.h \
61 VBox/VBoxUhgsmi.h \
62 VBox/VBoxNetCfg-win.h \
63 VBox/VBoxDrvCfg-win.h \
64 VBox/dbus.h \
65 VBox/xrandr.h \
66 $(if-expr "$(KBUILD_TARGET)" == "win",VBox/usblib.h,) \
67 VBox/usblib-win.h \
68 VBox/vd.h \
69 VBox/vd-cache-backend.h \
70 VBox/vd-ifs.h \
71 VBox/vd-ifs-internal.h \
72 VBox/vd-image-backend.h \
73 VBox/vd-plugin.h \
74 VBox/vd-filter-backend.h \
75 VBox/vddbg.h \
76 VBox/vmm/uvm.h \
77 VBox/vmm/dbgfflowtrace.h \
78 VBox/vscsi.h \
79 VBox/ExtPack/% \
80 VBox/GuestHost/SharedClipboard-transfers.h \
81 VBox/GuestHost/SharedClipboard-win.h \
82 VBox/GuestHost/SharedClipboard-x11.h \
83 VBox/GuestHost/DragAndDrop.h \
84 VBox/HostServices/Service.h \
85 iprt/win/% \
86 iprt/alloca.h \
87 iprt/tcp.h \
88 iprt/localipc.h \
89 iprt/linux/sysfs.h \
90 iprt/socket.h \
91 iprt/udp.h \
92 iprt/fuzz.h \
93 iprt/linux/symvers.h
94
95# Ring-0 driver only headers.
96VBOX_HDRS_R0DRV_ONLY := \
97 VBox/VBoxGuestLibSharedFolders.h \
98 VBox/VBoxGuestLibSharedFoldersInline.h \
99 iprt/linux/version.h
100
101# GCC only headers.
102VBOX_HDRS_GCC_ONLY := \
103 iprt/nocrt/fenv.h \
104 iprt/nocrt/math.h
105
106# Headers to omit all together.
107VBOX_HDRS_OMIT := \
108 VBox/HostServices/glext.h \
109 VBox/HostServices/glxext.h \
110 VBox/HostServices/wglext.h \
111 VBox/VBoxGL2D.h \
112 $(if-expr "$(KBUILD_TARGET)" != "linux", \
113 VBox/GuestHost/SharedClipboard-x11.h \
114 ,)\
115 $(if-expr "$(KBUILD_TARGET)" != "solaris", \
116 VBox/usblib-solaris.h \
117 ,)\
118 VBox/VDEPlug.h \
119 VBox/VDEPlugSymDefs.h \
120 VBox/VBoxNetCmn-win.h \
121 $(if-expr "$(KBUILD_TARGET)" != "win", \
122 VBox/com/microatl.h \
123 VBox/GuestHost/SharedClipboard-win.h \
124 VBox/usblib-win.h \
125 VBox/VBoxDrvCfg-win.h \
126 VBox/VBoxNetCfg-win.h \
127 iprt/sanitized/intrin.h \
128 ,$(VBOX_HDRS_GCC_ONLY)) \
129 \
130 VBox/dbus-calls.h \
131 VBox/xrandr-calls.h \
132 VBox/VBoxKeyboard.h \
133 VBox/vmm/pdmpcidevint.h \
134 iprt/runtime-loader.h \
135 iprt/mangling.h \
136 $(subst $(PATH_SUB_CURRENT)/,,$(wildcard $(PATH_SUB_CURRENT)/iprt/asm*watcom*.h)) \
137 iprt/asn1-generator% \
138 iprt/win/% \
139 iprt/nt/% \
140 \
141 $(foreach os,$(filter-out $(KBUILD_TARGET),$(KBUILD_OSES)),iprt/$(os)/% VBox/$(os)/%) \
142 $(foreach arch,$(KBUILD_ARCHES),iprt/nocrt/$(arch)/%)
143
144# AMD64 only headers.
145ifneq ($(KBUILD_TARGET_ARCH),amd64)
146VBOX_HDRS_OMIT += \
147 VBox/vmm/cpumctx.h \
148 VBox/vmm/cpumctx-v1_6.h \
149 VBox/vmm/dbgfcorefmt.h
150endif
151# ARM only headers.
152ifn1of ($(KBUILD_TARGET_ARCH), arm32 arm64)
153VBOX_HDRS_OMIT += \
154 iprt/asm-arm.h
155endif
156
157
158# We omit a few headers which have platform specific issues or are templates.
159VBOX_HDRS_ALL := $(filter-out $(VBOX_HDRS_OMIT), \
160 $(subst $(PATH_SUB_CURRENT)/,,$(wildcard \
161 $(PATH_SUB_CURRENT)/VBox/*.h \
162 $(PATH_SUB_CURRENT)/VBox/*/*.h \
163 $(PATH_SUB_CURRENT)/iprt/*.h \
164 $(PATH_SUB_CURRENT)/iprt/*/*.h \
165)))
166
167# ring-3, ring-0 and raw-mode context specific exclusions.
168VBOX_HDRS_ALL_R3 := $(filter-out $(VBOX_HDRS_R0DRV_ONLY), $(VBOX_HDRS_ALL))
169if "$(intersects $(KBUILD_TARGET_ARCH),$(VBOX_SUPPORTED_HOST_ARCHS))" == ""
170 ifeq ($(KBUILD_TARGET),win)
171VBOX_HDRS_ALL_R3 := $(filter-out VBox/com/VirtualBox.h VBox/com/listeners.h VBox/settings.h,$(VBOX_HDRS_ALL_R3))
172 else
173VBOX_HDRS_ALL_R3 := $(filter-out VBox/com/% VBox/settings.h,$(VBOX_HDRS_ALL_R3))
174 endif
175endif
176VBOX_HDRS_ALL_R3_C := $(filter-out $(VBOX_HDRS_CPP_FEATURES) $(VBOX_HDRS_R3_CPP), $(VBOX_HDRS_ALL_R3))
177VBOX_HDRS_ALL_R0 := $(filter-out $(VBOX_HDRS_R3_CPP) $(VBOX_HDRS_R3_ONLY) $(VBOX_HDRS_R0DRV_ONLY), $(VBOX_HDRS_ALL))
178VBOX_HDRS_ALL_R0_C := $(filter-out $(VBOX_HDRS_CPP_FEATURES), $(VBOX_HDRS_ALL_R0))
179VBOX_HDRS_ALL_R0DRV := $(filter-out $(VBOX_HDRS_R3_CPP) $(VBOX_HDRS_R3_ONLY), $(VBOX_HDRS_ALL))
180VBOX_HDRS_ALL_R0DRV_C := $(filter-out $(VBOX_HDRS_CPP_FEATURES), $(VBOX_HDRS_ALL_R0DRV))
181VBOX_HDRS_ALL_RC := $(filter-out \
182 VBox/VBoxGuestLib.h \
183 VBox/vmm/gvm.h \
184 iprt/thread.h \
185 iprt/mem.h \
186 iprt/memsafer.h \
187 iprt/alloc.h \
188 iprt/vector.h \
189 $(VBOX_HDRS_R3_CPP) \
190 $(VBOX_HDRS_R3_ONLY) \
191 $(VBOX_HDRS_R0DRV_ONLY) \
192 , $(VBOX_HDRS_ALL))
193VBOX_HDRS_ALL_RC_C := $(filter-out $(VBOX_HDRS_CPP_FEATURES), $(VBOX_HDRS_ALL_RC))
194#$(error $(subst $(SP),$(NLTAB),$(strip $(sort $(VBOX_HDRS_ALL_RC_C)))))
195
196if1of ($(KBUILD_TARGET_ARCH), $(VBOX_SUPPORTED_HOST_ARCHS))
197SyntaxVBoxIncludeR3_TEMPLATE = VBOXMAINEXE
198SyntaxVBoxIncludeR3_DEFS = VBOX_WITH_HGCM
199else
200SyntaxVBoxIncludeR3_TEMPLATE = VBOXR3EXE
201SyntaxVBoxIncludeR3_SDKS.win = ReorderCompilerIncs $(VBOX_WINPSDK) $(VBOX_WINDDK)
202endif
203SyntaxVBoxIncludeR3_DEFS += USING_VMM_COMMON_DEFS
204SyntaxVBoxIncludeR3_CDEFS = IPRT_WITHOUT_NAMED_UNIONS_AND_STRUCTS
205SyntaxVBoxIncludeR3_SOURCES := \
206 $(addprefix $(PATH_OBJ)/include/c/, $(addsuffix .c, $(basename $(VBOX_HDRS_ALL_R3_C)))) \
207 $(addprefix $(PATH_OBJ)/include/cpp/,$(addsuffix .cpp,$(basename $(VBOX_HDRS_ALL_R3))))
208SyntaxVBoxIncludeR3_CLEAN = $(SyntaxVBoxIncludeR3_SOURCES)
209#$(error $(subst $(SP),$(NLTAB),$(strip $(sort $(SyntaxVBoxIncludeR3_SOURCES)))))
210
211SyntaxVBoxIncludeR0_TEMPLATE = VBoxR0
212SyntaxVBoxIncludeR0_DEFS = VBOX_WITH_HGCM USING_VMM_COMMON_DEFS
213SyntaxVBoxIncludeR0_CDEFS = IPRT_WITHOUT_NAMED_UNIONS_AND_STRUCTS
214SyntaxVBoxIncludeR0_SOURCES := \
215 $(addprefix $(PATH_OBJ)/include/c/, $(addsuffix .c, $(basename $(VBOX_HDRS_ALL_R0_C)))) \
216 $(addprefix $(PATH_OBJ)/include/cpp/,$(addsuffix .cpp,$(basename $(VBOX_HDRS_ALL_R0))))
217SyntaxVBoxIncludeR0_CLEAN = $(SyntaxVBoxIncludeR0_SOURCES)
218
219if1of ($(KBUILD_TARGET), darwin os2 solaris win)
220LIBRARIES += SyntaxVBoxIncludeR0Drv
221SyntaxVBoxIncludeR0Drv_TEMPLATE = VBoxR0DrvLib
222SyntaxVBoxIncludeR0Drv_SDKS.win = ReorderCompilerIncs $(VBOX_WINDDK) $(VBOX_WINPSDK_INCS)
223SyntaxVBoxIncludeR0Drv_DEFS = VBOX_WITH_HGCM USING_VMM_COMMON_DEFS
224SyntaxVBoxIncludeR0Drv_CDEFS = IPRT_WITHOUT_NAMED_UNIONS_AND_STRUCTS
225SyntaxVBoxIncludeR0Drv_SOURCES := \
226 $(addprefix $(PATH_OBJ)/include/c/, $(addsuffix .c, $(basename $(VBOX_HDRS_ALL_R0DRV_C)))) \
227 $(addprefix $(PATH_OBJ)/include/cpp/,$(addsuffix .cpp,$(basename $(VBOX_HDRS_ALL_R0DRV))))
228SyntaxVBoxIncludeR0Drv_CLEAN = $(SyntaxVBoxIncludeR0Drv_SOURCES)
229endif
230
231ifdef VBOX_WITH_RAW_MODE
232LIBRARIES += SyntaxVBoxIncludeRC
233SyntaxVBoxIncludeRC_TEMPLATE = VBoxRc
234SyntaxVBoxIncludeRC_DEFS = VBOX_WITH_HGCM USING_VMM_COMMON_DEFS
235SyntaxVBoxIncludeRC_CDEFS = IPRT_WITHOUT_NAMED_UNIONS_AND_STRUCTS
236SyntaxVBoxIncludeRC_SOURCES := \
237 $(addprefix $(PATH_OBJ)/include/c/, $(addsuffix .c, $(basename $(VBOX_HDRS_ALL_RC_C)))) \
238 $(addprefix $(PATH_OBJ)/include/cpp/,$(addsuffix .cpp,$(basename $(VBOX_HDRS_ALL_RC))))
239SyntaxVBoxIncludeRC_CLEAN = $(SyntaxVBoxIncludeRC_SOURCES)
240endif
241
242
243# Headers that must only be included once.
244VBOX_HDRS_ONLY_ONCE := \
245 iprt/bldprog-strtab-template.cpp.h
246
247
248# Generate the files we compile.
249define def_hdr
250 $(eval functioname := $(translate $(basename $(hdr)),-./,___))
251
252 $$(PATH_OBJ)/include/c/$(basename $(hdr)).c: | $$$$(dir $$$$@)
253 $(QUIET)$$(APPEND) -t -n $$@ \
254 '#include <$(hdr)>' \
255 $(if-expr $(intersects $(hdr),$(VBOX_HDRS_ONLY_ONCE)),, '#include <$(hdr)>') \
256 'extern int $(functioname)_c(void);' \
257 'int $(functioname)_c(void) { return 0;}'
258
259 $$(PATH_OBJ)/include/cpp/$(basename $(hdr)).cpp: | $$$$(dir $$$$@)
260 $(QUIET)$$(APPEND) -t -n $$@ \
261 '#include <$(hdr)>' \
262 $(if-expr $(intersects $(hdr),$(VBOX_HDRS_ONLY_ONCE)),, '#include <$(hdr)>') \
263 'extern int $(functioname)_cpp(void);' \
264 'int $(functioname)_cpp(void) { return 0;}'
265
266endef
267
268$(foreach hdr,$(VBOX_HDRS_ALL), $(eval $(def_hdr)))
269
270# Tell kBuild to generate rules for making the directories for the generated files.
271VBOX_HDR_DIRS := $(sort $(dir $(VBOX_HDRS_ALL)))
272BLDDIRS += $(addprefix $(PATH_OBJ)/include/c/,$(VBOX_HDR_DIRS)) $(addprefix $(PATH_OBJ)/include/cpp/,$(VBOX_HDR_DIRS))
273
274
275include $(FILE_KBUILD_SUB_FOOTER)
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