VirtualBox

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

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

Try to fix build failures

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

© 2024 Oracle
ContactPrivacy/Do Not Sell My InfoTerms of Use