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