VirtualBox

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

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

iprt/linux/symvers.h: Fixed header compilation test issue, dropping $ line (don't do this in project wide headers), removed incorrect (inverted) #endif comment, and added missing Makefile.kup file for the iprt/linux dir.

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

© 2023 Oracle
ContactPrivacy policyTerms of Use