[40800] | 1 | # $Id: Makefile 98103 2023-01-17 14:15:46Z vboxsync $
|
---|
[21351] | 2 | ## @file
|
---|
[1] | 3 | # Makefile for the VirtualBox Linux Host Driver.
|
---|
| 4 | #
|
---|
| 5 |
|
---|
| 6 | #
|
---|
[98103] | 7 | # Copyright (C) 2006-2023 Oracle and/or its affiliates.
|
---|
[4163] | 8 | #
|
---|
[96407] | 9 | # This file is part of VirtualBox base platform packages, as
|
---|
| 10 | # available from https://www.virtualbox.org.
|
---|
[5227] | 11 | #
|
---|
[96407] | 12 | # This program is free software; you can redistribute it and/or
|
---|
| 13 | # modify it under the terms of the GNU General Public License
|
---|
| 14 | # as published by the Free Software Foundation, in version 3 of the
|
---|
| 15 | # License.
|
---|
| 16 | #
|
---|
| 17 | # This program is distributed in the hope that it will be useful, but
|
---|
| 18 | # WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 20 | # General Public License for more details.
|
---|
| 21 | #
|
---|
| 22 | # You should have received a copy of the GNU General Public License
|
---|
| 23 | # along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
| 24 | #
|
---|
[5999] | 25 | # The contents of this file may alternatively be used under the terms
|
---|
| 26 | # of the Common Development and Distribution License Version 1.0
|
---|
[96407] | 27 | # (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
| 28 | # in the VirtualBox distribution, in which case the provisions of the
|
---|
[5999] | 29 | # CDDL are applicable instead of those of the GPL.
|
---|
| 30 | #
|
---|
| 31 | # You may elect to license modified versions of this file under the
|
---|
| 32 | # terms and conditions of either the GPL or the CDDL or both.
|
---|
| 33 | #
|
---|
[96407] | 34 | # SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
| 35 | #
|
---|
[1] | 36 |
|
---|
[77394] | 37 | # Linux kbuild sets this to our source directory if we are called from there
|
---|
[68682] | 38 | obj ?= $(CURDIR)
|
---|
[77390] | 39 | include $(obj)/Makefile-header.gmk
|
---|
[85939] | 40 | VBOXDRV_DIR := $(VBOX_MODULE_SRC_DIR)
|
---|
[67063] | 41 |
|
---|
[77399] | 42 | VBOXMOD_NAME = vboxdrv
|
---|
| 43 | VBOXMOD_OBJS = \
|
---|
[1] | 44 | linux/SUPDrv-linux.o \
|
---|
[10255] | 45 | SUPDrv.o \
|
---|
[54327] | 46 | SUPDrvGip.o \
|
---|
[25465] | 47 | SUPDrvSem.o \
|
---|
[40777] | 48 | SUPDrvTracer.o \
|
---|
[54322] | 49 | SUPLibAll.o \
|
---|
[85519] | 50 | common/string/strformatrt.o
|
---|
| 51 |
|
---|
[85521] | 52 | ifndef VBOX_WITHOUT_COMBINED_SOURCES
|
---|
[85519] | 53 | VBOXMOD_OBJS += \
|
---|
[85523] | 54 | combined-agnostic1.o \
|
---|
| 55 | combined-agnostic2.o \
|
---|
[85519] | 56 | combined-os-specific.o
|
---|
| 57 | else # VBOX_WITHOUT_COMBINED_SOURCES
|
---|
| 58 | VBOXMOD_OBJS += \
|
---|
[1] | 59 | r0drv/alloc-r0drv.o \
|
---|
[331] | 60 | r0drv/initterm-r0drv.o \
|
---|
[10250] | 61 | r0drv/memobj-r0drv.o \
|
---|
[9470] | 62 | r0drv/mpnotification-r0drv.o \
|
---|
[13473] | 63 | r0drv/powernotification-r0drv.o \
|
---|
[13314] | 64 | r0drv/linux/assert-r0drv-linux.o \
|
---|
[1] | 65 | r0drv/linux/alloc-r0drv-linux.o \
|
---|
[331] | 66 | r0drv/linux/initterm-r0drv-linux.o \
|
---|
[10250] | 67 | r0drv/linux/memobj-r0drv-linux.o \
|
---|
[21285] | 68 | r0drv/linux/memuserkernel-r0drv-linux.o \
|
---|
[9470] | 69 | r0drv/linux/mp-r0drv-linux.o \
|
---|
| 70 | r0drv/linux/mpnotification-r0drv-linux.o \
|
---|
[389] | 71 | r0drv/linux/process-r0drv-linux.o \
|
---|
[66424] | 72 | r0drv/linux/rtStrFormatKernelAddress-r0drv-linux.o \
|
---|
[5227] | 73 | r0drv/linux/semevent-r0drv-linux.o \
|
---|
| 74 | r0drv/linux/semeventmulti-r0drv-linux.o \
|
---|
| 75 | r0drv/linux/semfastmutex-r0drv-linux.o \
|
---|
[28462] | 76 | r0drv/linux/semmutex-r0drv-linux.o \
|
---|
[1] | 77 | r0drv/linux/spinlock-r0drv-linux.o \
|
---|
[9470] | 78 | r0drv/linux/thread-r0drv-linux.o \
|
---|
[14432] | 79 | r0drv/linux/thread2-r0drv-linux.o \
|
---|
[47199] | 80 | r0drv/linux/threadctxhooks-r0drv-linux.o \
|
---|
[9470] | 81 | r0drv/linux/time-r0drv-linux.o \
|
---|
| 82 | r0drv/linux/timer-r0drv-linux.o \
|
---|
[21549] | 83 | r0drv/generic/semspinmutex-r0drv-generic.o \
|
---|
[28283] | 84 | common/alloc/alloc.o \
|
---|
[31829] | 85 | common/checksum/crc32.o \
|
---|
[28156] | 86 | common/checksum/ipv4.o \
|
---|
| 87 | common/checksum/ipv6.o \
|
---|
[13306] | 88 | common/err/RTErrConvertFromErrno.o \
|
---|
[21351] | 89 | common/err/RTErrConvertToErrno.o \
|
---|
[69762] | 90 | common/err/errinfo.o \
|
---|
[13314] | 91 | common/log/log.o \
|
---|
[12099] | 92 | common/log/logellipsis.o \
|
---|
| 93 | common/log/logrel.o \
|
---|
| 94 | common/log/logrelellipsis.o \
|
---|
[6493] | 95 | common/log/logcom.o \
|
---|
| 96 | common/log/logformat.o \
|
---|
[91789] | 97 | common/log/RTLogCreateEx.o \
|
---|
[25528] | 98 | common/misc/RTAssertMsg1Weak.o \
|
---|
[25532] | 99 | common/misc/RTAssertMsg2.o \
|
---|
[25536] | 100 | common/misc/RTAssertMsg2Add.o \
|
---|
| 101 | common/misc/RTAssertMsg2AddWeak.o \
|
---|
| 102 | common/misc/RTAssertMsg2AddWeakV.o \
|
---|
[25528] | 103 | common/misc/RTAssertMsg2Weak.o \
|
---|
| 104 | common/misc/RTAssertMsg2WeakV.o \
|
---|
| 105 | common/misc/assert.o \
|
---|
[19866] | 106 | common/misc/handletable.o \
|
---|
| 107 | common/misc/handletablectx.o \
|
---|
[36233] | 108 | common/misc/thread.o \
|
---|
[69768] | 109 | common/string/RTStrCat.o \
|
---|
[40798] | 110 | common/string/RTStrCopy.o \
|
---|
[41354] | 111 | common/string/RTStrCopyEx.o \
|
---|
[36408] | 112 | common/string/RTStrCopyP.o \
|
---|
[83886] | 113 | common/string/RTStrEnd.o \
|
---|
[40798] | 114 | common/string/RTStrNCmp.o \
|
---|
| 115 | common/string/RTStrNLen.o \
|
---|
| 116 | common/string/stringalloc.o \
|
---|
[6493] | 117 | common/string/strformat.o \
|
---|
[91789] | 118 | common/string/RTStrFormat.o \
|
---|
[69836] | 119 | common/string/strformatnum.o \
|
---|
[7183] | 120 | common/string/strformattype.o \
|
---|
[6493] | 121 | common/string/strprintf.o \
|
---|
[91789] | 122 | common/string/strprintf-ellipsis.o \
|
---|
[90829] | 123 | common/string/strprintf2.o \
|
---|
[91789] | 124 | common/string/strprintf2-ellipsis.o \
|
---|
[6493] | 125 | common/string/strtonum.o \
|
---|
[36233] | 126 | common/table/avlpv.o \
|
---|
[30961] | 127 | common/time/time.o \
|
---|
[6493] | 128 | r0drv/linux/RTLogWriteDebugger-r0drv-linux.o \
|
---|
[13314] | 129 | generic/RTAssertShouldPanic-generic.o \
|
---|
[6493] | 130 | generic/RTLogWriteStdErr-stub-generic.o \
|
---|
| 131 | generic/RTLogWriteStdOut-stub-generic.o \
|
---|
| 132 | generic/RTLogWriteUser-generic.o \
|
---|
[32572] | 133 | generic/RTMpGetArraySize-generic.o \
|
---|
[46646] | 134 | generic/RTMpGetCoreCount-generic.o \
|
---|
[33033] | 135 | generic/RTSemEventWait-2-ex-generic.o \
|
---|
| 136 | generic/RTSemEventWaitNoResume-2-ex-generic.o \
|
---|
[33011] | 137 | generic/RTSemEventMultiWait-2-ex-generic.o \
|
---|
| 138 | generic/RTSemEventMultiWaitNoResume-2-ex-generic.o \
|
---|
[32504] | 139 | generic/RTTimerCreate-generic.o \
|
---|
[37233] | 140 | generic/errvars-generic.o \
|
---|
[36254] | 141 | generic/mppresent-generic.o \
|
---|
[21351] | 142 | generic/uuid-generic.o \
|
---|
[96814] | 143 | VBox/log-vbox.o \
|
---|
| 144 | VBox/RTLogWriteVmm-amd64-x86.o
|
---|
[85519] | 145 | ifeq ($(VBOX_KBUILD_TARGET_ARCH),amd64)
|
---|
| 146 | VBOXMOD_OBJS += common/alloc/heapsimple.o
|
---|
| 147 | endif
|
---|
| 148 | endif # VBOX_WITHOUT_COMBINED_SOURCES
|
---|
[84947] | 149 | ifeq ($(VBOX_KBUILD_TARGET_ARCH),x86)
|
---|
[77399] | 150 | VBOXMOD_OBJS += \
|
---|
[77394] | 151 | math/gcc/divdi3.o \
|
---|
[89961] | 152 | math/gcc/divmoddi4.o \
|
---|
[13314] | 153 | math/gcc/moddi3.o \
|
---|
| 154 | math/gcc/qdivrem.o \
|
---|
| 155 | math/gcc/udivdi3.o \
|
---|
[67293] | 156 | math/gcc/udivmoddi4.o \
|
---|
[49395] | 157 | math/gcc/divdi3.o \
|
---|
[10250] | 158 | math/gcc/umoddi3.o
|
---|
[6493] | 159 | endif
|
---|
[41354] | 160 | ifdef VBOX_WITH_NATIVE_DTRACE
|
---|
[77399] | 161 | VBOXMOD_OBJS += SUPDrvDTrace.o
|
---|
[41354] | 162 | endif
|
---|
[85519] | 163 |
|
---|
[77399] | 164 | VBOXMOD_INCL = \
|
---|
[77403] | 165 | $(VBOXDRV_DIR) \
|
---|
| 166 | $(VBOXDRV_DIR)include \
|
---|
| 167 | $(VBOXDRV_DIR)r0drv/linux
|
---|
[68682] | 168 | ifdef VBOX_WITH_NATIVE_DTRACE
|
---|
[77399] | 169 | VBOXMOD_INCL += \
|
---|
[77403] | 170 | /usr/include/linux \
|
---|
| 171 | /usr/include
|
---|
[1] | 172 | endif
|
---|
[85519] | 173 |
|
---|
[77399] | 174 | VBOXMOD_DEFS = \
|
---|
[77397] | 175 | RT_OS_LINUX \
|
---|
| 176 | IN_RING0 \
|
---|
| 177 | IN_RT_R0 \
|
---|
| 178 | IN_SUP_R0 \
|
---|
| 179 | VBOX \
|
---|
| 180 | RT_WITH_VBOX \
|
---|
| 181 | VBOX_WITH_HARDENING \
|
---|
| 182 | SUPDRV_WITH_RELEASE_LOGGER \
|
---|
[82590] | 183 | VBOX_WITHOUT_EFLAGS_AC_SET_IN_VBOXDRV \
|
---|
| 184 | IPRT_WITHOUT_EFLAGS_AC_PRESERVING \
|
---|
[77397] | 185 | VBOX_WITH_64_BITS_GUESTS # <-- must be consistent with Config.kmk!
|
---|
[1] | 186 | ifndef CONFIG_VBOXDRV_FIXEDMAJOR
|
---|
[77399] | 187 | VBOXMOD_DEFS += CONFIG_VBOXDRV_AS_MISC
|
---|
[1] | 188 | endif
|
---|
[41354] | 189 | ifdef VBOX_WITH_NATIVE_DTRACE
|
---|
[77399] | 190 | VBOXMOD_DEFS += VBOX_WITH_NATIVE_DTRACE
|
---|
[41354] | 191 | endif
|
---|
[50008] | 192 | ifdef VBOX_WITH_TEXT_MODMEM_HACK
|
---|
[77399] | 193 | VBOXMOD_DEFS += RTMEMALLOC_EXEC_HEAP VBOX_WITH_TEXT_MODMEM_HACK
|
---|
[50008] | 194 | endif
|
---|
[77399] | 195 | VBOXMOD_CFLAGS = -include $(VBOXDRV_DIR)include/VBox/SUPDrvMangling.h \
|
---|
[77394] | 196 | -fno-omit-frame-pointer -fno-pie -Wno-declaration-after-statement
|
---|
[1] | 197 |
|
---|
| 198 |
|
---|
[77390] | 199 | include $(obj)/Makefile-footer.gmk
|
---|
[1] | 200 |
|
---|
[77400] | 201 | check: $(VBOXMOD_0_TARGET)
|
---|
[36190] | 202 | @if ! readelf -p __ksymtab_strings vboxdrv.ko | grep -E "\[.*\] *(RT|g_..*RT.*)"; then \
|
---|
| 203 | echo "All exported IPRT symbols are properly renamed!"; \
|
---|
| 204 | else \
|
---|
| 205 | echo "error: Some exported IPRT symbols was not properly renamed! See above." >&2; \
|
---|
| 206 | false; \
|
---|
| 207 | fi
|
---|
[77394] | 208 |
|
---|