VirtualBox

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

Last change on this file since 98694 was 98578, checked in by vboxsync, 2 years ago

HGCMMock*.h: Moved to HostServices as it chiefly tests the HGCM services, not so much shared guest/host code is the previous location would indicate.

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