VirtualBox

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

Last change on this file since 91927 was 88058, checked in by vboxsync, 4 years ago

Audio: Build fix. bugref:9890

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