VirtualBox

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

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

scm --update-copyright-year

  • 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 93115 2022-01-01 11:31:46Z 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 iprt/cpp/% \
50 VBox/com/% \
51 $(subst $(PATH_SUB_CURRENT)/,,$(wildcard $(PATH_SUB_CURRENT)/iprt/*_cpp.h))
52
53# Ring-3 only headers.
54VBOX_HDRS_R3_ONLY := \
55 VBox/vrdpapi.h \
56 VBox/vrdpusb.h \
57 VBox/VBoxHDD.h \
58 VBox/VBoxHDD-Plugin.h \
59 VBox/VBoxCrHgsmi.h \
60 VBox/VBoxUhgsmi.h \
61 VBox/VBoxNetCfg-win.h \
62 VBox/VBoxDrvCfg-win.h \
63 VBox/dbus.h \
64 VBox/xrandr.h \
65 $(if-expr "$(KBUILD_TARGET)" == "win",VBox/usblib.h,) \
66 VBox/usblib-win.h \
67 VBox/vd.h \
68 VBox/vd-cache-backend.h \
69 VBox/vd-ifs.h \
70 VBox/vd-ifs-internal.h \
71 VBox/vd-image-backend.h \
72 VBox/vd-plugin.h \
73 VBox/vd-filter-backend.h \
74 VBox/vddbg.h \
75 VBox/vmm/uvm.h \
76 VBox/vmm/dbgfflowtrace.h \
77 VBox/vscsi.h \
78 VBox/ExtPack/% \
79 VBox/GuestHost/SharedClipboard-transfers.h \
80 VBox/GuestHost/SharedClipboard-win.h \
81 VBox/GuestHost/SharedClipboard-x11.h \
82 VBox/GuestHost/DragAndDrop.h \
83 VBox/HostServices/Service.h \
84 iprt/win/% \
85 iprt/alloca.h \
86 iprt/tcp.h \
87 iprt/localipc.h \
88 iprt/linux/sysfs.h \
89 iprt/socket.h \
90 iprt/udp.h \
91 iprt/fuzz.h \
92 iprt/linux/symvers.h
93
94# Ring-0 driver only headers.
95VBOX_HDRS_R0DRV_ONLY := \
96 VBox/VBoxGuestLibSharedFolders.h \
97 VBox/VBoxGuestLibSharedFoldersInline.h \
98 iprt/linux/version.h
99
100# GCC only headers.
101VBOX_HDRS_GCC_ONLY := \
102 iprt/nocrt/fenv.h \
103 iprt/nocrt/math.h
104
105# Headers to omit all together.
106VBOX_HDRS_OMIT := \
107 VBox/HostServices/glext.h \
108 VBox/HostServices/glxext.h \
109 VBox/HostServices/wglext.h \
110 VBox/VBoxGL2D.h \
111 $(if-expr "$(KBUILD_TARGET)" != "linux", \
112 VBox/GuestHost/SharedClipboard-x11.h \
113 ,)\
114 $(if-expr "$(KBUILD_TARGET)" != "solaris", \
115 VBox/usblib-solaris.h \
116 ,)\
117 VBox/VDEPlug.h \
118 VBox/VDEPlugSymDefs.h \
119 VBox/VBoxNetCmn-win.h \
120 $(if-expr "$(KBUILD_TARGET)" != "win", \
121 VBox/com/microatl.h \
122 VBox/GuestHost/SharedClipboard-win.h \
123 VBox/usblib-win.h \
124 VBox/VBoxDrvCfg-win.h \
125 VBox/VBoxNetCfg-win.h \
126 iprt/sanitized/intrin.h \
127 ,$(VBOX_HDRS_GCC_ONLY)) \
128 \
129 VBox/dbus-calls.h \
130 VBox/xrandr-calls.h \
131 VBox/VBoxKeyboard.h \
132 VBox/vmm/pdmpcidevint.h \
133 iprt/runtime-loader.h \
134 iprt/mangling.h \
135 $(subst $(PATH_SUB_CURRENT)/,,$(wildcard $(PATH_SUB_CURRENT)/iprt/asm*watcom*.h)) \
136 iprt/asn1-generator% \
137 iprt/win/% \
138 iprt/nt/% \
139 \
140 $(foreach os,$(filter-out $(KBUILD_TARGET),$(KBUILD_OSES)),iprt/$(os)/% VBox/$(os)/%) \
141 $(foreach arch,$(KBUILD_ARCHES),iprt/nocrt/$(arch)/%)
142
143# AMD64 only headers.
144ifneq ($(KBUILD_TARGET_ARCH),amd64)
145VBOX_HDRS_OMIT += \
146 VBox/vmm/cpumctx.h \
147 VBox/vmm/cpumctx-v1_6.h \
148 VBox/vmm/dbgfcorefmt.h
149endif
150# ARM only headers.
151ifn1of ($(KBUILD_TARGET_ARCH), arm32 arm64)
152VBOX_HDRS_OMIT += \
153 iprt/asm-arm.h
154endif
155
156
157# We omit a few headers which have platform specific issues or are templates.
158VBOX_HDRS_ALL := $(filter-out $(VBOX_HDRS_OMIT), \
159 $(subst $(PATH_SUB_CURRENT)/,,$(wildcard \
160 $(PATH_SUB_CURRENT)/VBox/*.h \
161 $(PATH_SUB_CURRENT)/VBox/*/*.h \
162 $(PATH_SUB_CURRENT)/iprt/*.h \
163 $(PATH_SUB_CURRENT)/iprt/*/*.h \
164)))
165
166# ring-3, ring-0 and raw-mode context specific exclusions.
167VBOX_HDRS_ALL_R3 := $(filter-out $(VBOX_HDRS_R0DRV_ONLY), $(VBOX_HDRS_ALL))
168if "$(intersects $(KBUILD_TARGET_ARCH),$(VBOX_SUPPORTED_HOST_ARCHS))" == ""
169 ifeq ($(KBUILD_TARGET),win)
170VBOX_HDRS_ALL_R3 := $(filter-out VBox/com/VirtualBox.h VBox/com/listeners.h VBox/settings.h,$(VBOX_HDRS_ALL_R3))
171 else
172VBOX_HDRS_ALL_R3 := $(filter-out VBox/com/% VBox/settings.h,$(VBOX_HDRS_ALL_R3))
173 endif
174endif
175VBOX_HDRS_ALL_R3_C := $(filter-out $(VBOX_HDRS_CPP_FEATURES) $(VBOX_HDRS_R3_CPP), $(VBOX_HDRS_ALL_R3))
176VBOX_HDRS_ALL_R0 := $(filter-out $(VBOX_HDRS_R3_CPP) $(VBOX_HDRS_R3_ONLY) $(VBOX_HDRS_R0DRV_ONLY), $(VBOX_HDRS_ALL))
177VBOX_HDRS_ALL_R0_C := $(filter-out $(VBOX_HDRS_CPP_FEATURES), $(VBOX_HDRS_ALL_R0))
178VBOX_HDRS_ALL_R0DRV := $(filter-out $(VBOX_HDRS_R3_CPP) $(VBOX_HDRS_R3_ONLY), $(VBOX_HDRS_ALL))
179VBOX_HDRS_ALL_R0DRV_C := $(filter-out $(VBOX_HDRS_CPP_FEATURES), $(VBOX_HDRS_ALL_R0DRV))
180VBOX_HDRS_ALL_RC := $(filter-out \
181 VBox/VBoxGuestLib.h \
182 VBox/vmm/gvm.h \
183 iprt/thread.h \
184 iprt/mem.h \
185 iprt/memsafer.h \
186 iprt/alloc.h \
187 iprt/vector.h \
188 $(VBOX_HDRS_R3_CPP) \
189 $(VBOX_HDRS_R3_ONLY) \
190 $(VBOX_HDRS_R0DRV_ONLY) \
191 , $(VBOX_HDRS_ALL))
192VBOX_HDRS_ALL_RC_C := $(filter-out $(VBOX_HDRS_CPP_FEATURES), $(VBOX_HDRS_ALL_RC))
193#$(error $(subst $(SP),$(NLTAB),$(strip $(sort $(VBOX_HDRS_ALL_RC_C)))))
194
195if1of ($(KBUILD_TARGET_ARCH), $(VBOX_SUPPORTED_HOST_ARCHS))
196SyntaxVBoxIncludeR3_TEMPLATE = VBOXMAINEXE
197SyntaxVBoxIncludeR3_DEFS = VBOX_WITH_HGCM
198else
199SyntaxVBoxIncludeR3_TEMPLATE = VBOXR3EXE
200SyntaxVBoxIncludeR3_SDKS.win = ReorderCompilerIncs $(VBOX_WINPSDK) $(VBOX_WINDDK)
201endif
202SyntaxVBoxIncludeR3_DEFS += USING_VMM_COMMON_DEFS
203SyntaxVBoxIncludeR3_CDEFS = IPRT_WITHOUT_NAMED_UNIONS_AND_STRUCTS
204SyntaxVBoxIncludeR3_SOURCES := \
205 $(addprefix $(PATH_OBJ)/include/c/, $(addsuffix .c, $(basename $(VBOX_HDRS_ALL_R3_C)))) \
206 $(addprefix $(PATH_OBJ)/include/cpp/,$(addsuffix .cpp,$(basename $(VBOX_HDRS_ALL_R3))))
207SyntaxVBoxIncludeR3_CLEAN = $(SyntaxVBoxIncludeR3_SOURCES)
208#$(error $(subst $(SP),$(NLTAB),$(strip $(sort $(SyntaxVBoxIncludeR3_SOURCES)))))
209
210SyntaxVBoxIncludeR0_TEMPLATE = VBoxR0
211SyntaxVBoxIncludeR0_DEFS = VBOX_WITH_HGCM USING_VMM_COMMON_DEFS
212SyntaxVBoxIncludeR0_CDEFS = IPRT_WITHOUT_NAMED_UNIONS_AND_STRUCTS
213SyntaxVBoxIncludeR0_SOURCES := \
214 $(addprefix $(PATH_OBJ)/include/c/, $(addsuffix .c, $(basename $(VBOX_HDRS_ALL_R0_C)))) \
215 $(addprefix $(PATH_OBJ)/include/cpp/,$(addsuffix .cpp,$(basename $(VBOX_HDRS_ALL_R0))))
216SyntaxVBoxIncludeR0_CLEAN = $(SyntaxVBoxIncludeR0_SOURCES)
217
218if1of ($(KBUILD_TARGET), darwin os2 solaris win)
219LIBRARIES += SyntaxVBoxIncludeR0Drv
220SyntaxVBoxIncludeR0Drv_TEMPLATE = VBoxR0DrvLib
221SyntaxVBoxIncludeR0Drv_SDKS.win = ReorderCompilerIncs $(VBOX_WINDDK) $(VBOX_WINPSDK_INCS)
222SyntaxVBoxIncludeR0Drv_DEFS = VBOX_WITH_HGCM USING_VMM_COMMON_DEFS
223SyntaxVBoxIncludeR0Drv_CDEFS = IPRT_WITHOUT_NAMED_UNIONS_AND_STRUCTS
224SyntaxVBoxIncludeR0Drv_SOURCES := \
225 $(addprefix $(PATH_OBJ)/include/c/, $(addsuffix .c, $(basename $(VBOX_HDRS_ALL_R0DRV_C)))) \
226 $(addprefix $(PATH_OBJ)/include/cpp/,$(addsuffix .cpp,$(basename $(VBOX_HDRS_ALL_R0DRV))))
227SyntaxVBoxIncludeR0Drv_CLEAN = $(SyntaxVBoxIncludeR0Drv_SOURCES)
228endif
229
230ifdef VBOX_WITH_RAW_MODE
231LIBRARIES += SyntaxVBoxIncludeRC
232SyntaxVBoxIncludeRC_TEMPLATE = VBoxRc
233SyntaxVBoxIncludeRC_DEFS = VBOX_WITH_HGCM USING_VMM_COMMON_DEFS
234SyntaxVBoxIncludeRC_CDEFS = IPRT_WITHOUT_NAMED_UNIONS_AND_STRUCTS
235SyntaxVBoxIncludeRC_SOURCES := \
236 $(addprefix $(PATH_OBJ)/include/c/, $(addsuffix .c, $(basename $(VBOX_HDRS_ALL_RC_C)))) \
237 $(addprefix $(PATH_OBJ)/include/cpp/,$(addsuffix .cpp,$(basename $(VBOX_HDRS_ALL_RC))))
238SyntaxVBoxIncludeRC_CLEAN = $(SyntaxVBoxIncludeRC_SOURCES)
239endif
240
241
242# Headers that must only be included once.
243VBOX_HDRS_ONLY_ONCE := \
244 iprt/bldprog-strtab-template.cpp.h
245
246
247# Generate the files we compile.
248define def_hdr
249 $(eval functioname := $(translate $(basename $(hdr)),-./,___))
250
251 $$(PATH_OBJ)/include/c/$(basename $(hdr)).c: | $$$$(dir $$$$@)
252 $(QUIET)$$(APPEND) -t -n $$@ \
253 '#include <$(hdr)>' \
254 $(if-expr $(intersects $(hdr),$(VBOX_HDRS_ONLY_ONCE)),, '#include <$(hdr)>') \
255 'extern int $(functioname)_c(void);' \
256 'int $(functioname)_c(void) { return 0;}'
257
258 $$(PATH_OBJ)/include/cpp/$(basename $(hdr)).cpp: | $$$$(dir $$$$@)
259 $(QUIET)$$(APPEND) -t -n $$@ \
260 '#include <$(hdr)>' \
261 $(if-expr $(intersects $(hdr),$(VBOX_HDRS_ONLY_ONCE)),, '#include <$(hdr)>') \
262 'extern int $(functioname)_cpp(void);' \
263 'int $(functioname)_cpp(void) { return 0;}'
264
265endef
266
267$(foreach hdr,$(VBOX_HDRS_ALL), $(eval $(def_hdr)))
268
269# Tell kBuild to generate rules for making the directories for the generated files.
270VBOX_HDR_DIRS := $(sort $(dir $(VBOX_HDRS_ALL)))
271BLDDIRS += $(addprefix $(PATH_OBJ)/include/c/,$(VBOX_HDR_DIRS)) $(addprefix $(PATH_OBJ)/include/cpp/,$(VBOX_HDR_DIRS))
272
273
274include $(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