VirtualBox

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

Last change on this file since 77232 was 76719, checked in by vboxsync, 6 years ago

/include/Makefile.kmk: syntax check using the ring-0 driver template too.

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