VirtualBox

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

Last change on this file since 81025 was 80862, checked in by vboxsync, 5 years ago

Shared Clipboard/URI: File renaming: *-uri* -> *-transfers*.

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