VirtualBox

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

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

iprt/asm-arm.h: copied from branch. needs work. bugref:9898 bugref:9026

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