1 | # $Id: Config.kmk 77669 2019-03-12 16:34:13Z vboxsync $
|
---|
2 | ## @file
|
---|
3 | # kBuild configuration for the VBox EFI firmware.
|
---|
4 | #
|
---|
5 | # Note! kBuild is only used for the build tools, the rest is handled by the
|
---|
6 | # very custom EFI build system.
|
---|
7 | #
|
---|
8 |
|
---|
9 | #
|
---|
10 | # Copyright (C) 2013-2019 Oracle Corporation
|
---|
11 | #
|
---|
12 | # This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
13 | # available from http://www.virtualbox.org. This file is free software;
|
---|
14 | # you can redistribute it and/or modify it under the terms of the GNU
|
---|
15 | # General Public License (GPL) as published by the Free Software
|
---|
16 | # Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
17 | # VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
18 | # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
19 | #
|
---|
20 | # The contents of this file may alternatively be used under the terms
|
---|
21 | # of the Common Development and Distribution License Version 1.0
|
---|
22 | # (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
23 | # VirtualBox OSE distribution, in which case the provisions of the
|
---|
24 | # CDDL are applicable instead of those of the GPL.
|
---|
25 | #
|
---|
26 | # You may elect to license modified versions of this file under the
|
---|
27 | # terms and conditions of either the GPL or the CDDL or both.
|
---|
28 | #
|
---|
29 |
|
---|
30 | VBOX_EFI_FIRMWARE_CONFIG_KMK_INCLUDED = 1
|
---|
31 |
|
---|
32 | # Include the next configure file above us.
|
---|
33 | ifndef VBOX_DEVICES_CONFIG_KMK_INCLUDED
|
---|
34 | include $(PATH_ROOT)/src/VBox/Devices/Config.kmk
|
---|
35 | endif
|
---|
36 |
|
---|
37 | #
|
---|
38 | # Globals.
|
---|
39 | #
|
---|
40 | VBOX_PATH_EFI_FIRMWARE = $(PATH_ROOT)/src/VBox/Devices/EFI/FirmwareNew
|
---|
41 | VBOX_PATH_STAGE_EFI_BLDPROGS = $(PATH_STAGE)/EfiBldProgs
|
---|
42 | VBOX_EFI_BUILD_TARGET = $(if-expr $(intersects release profile, $(KBUILD_TYPE)),RELEASE,DEBUG)
|
---|
43 | VBOX_EFI_OUTPUT_SUBDIR = $(VBOX_EFI_BUILD_TARGET)_$(VBOX_EFI_TOOL_CHAIN)
|
---|
44 |
|
---|
45 | # VBox Yasm command
|
---|
46 | VBOX_YASMCMD ?= $(firstword $(wildcard $(KBUILD_DEVTOOLS_HST)/bin/yasm$(HOSTSUFF_EXE)) yasm$(HOSTSUFF_EXE))
|
---|
47 |
|
---|
48 | # VBox nasm command
|
---|
49 | include $(KBUILD_PATH)/tools/NASM.kmk
|
---|
50 | TOOL_VBoxNasm = Our version of the NASM tool
|
---|
51 | ifndef TOOL_VBoxNasm_PATH
|
---|
52 | TOOL_VBoxNasm_PATH := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST)/nasm/v*.*)))
|
---|
53 | if "$(TOOL_VBoxNasm_PATH)" == "" && "$(KBUILD_DEVTOOLS_HST_ALT)" != ""
|
---|
54 | TOOL_VBoxNasm_PATH := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST_ALT)/nasm/v*.*)))
|
---|
55 | endif
|
---|
56 | endif
|
---|
57 | ifneq ($(TOOL_VBoxNasm_PATH),)
|
---|
58 | VBOX_NASMCMD ?= $(TOOL_VBoxNasm_PATH)/nasm$(HOSTSUFF_EXE)
|
---|
59 | else
|
---|
60 | VBOX_NASMCMD ?= nasm$(HOSTSUFF_EXE)
|
---|
61 | endif
|
---|
62 |
|
---|
63 | # EFI requires python v2.x, so provide a way to select that while using 3.x for the rest of VBox.
|
---|
64 | ifndef VBOX_BLD_PYTHON_2X
|
---|
65 | VBOX_BLD_PYTHON_2X = $(VBOX_BLD_PYTHON)
|
---|
66 | endif
|
---|
67 |
|
---|
68 | #
|
---|
69 | # Decide which tool chain to use for the EFI binaries.
|
---|
70 | # Note! We're using our own stripped down tools_def.txt: vbox-tools_def.txt.
|
---|
71 | #
|
---|
72 | ifeq ($(KBUILD_HOST),win)
|
---|
73 | VBOX_EFI_TOOL_CHAIN := VS2010
|
---|
74 | else
|
---|
75 | VBOX_EFI_TOOL_CHAIN = UNIXGCC
|
---|
76 | if !defined(VBOX_PATH_PREFIX_MINGW32) && !defined(VBOX_PATH_PREFIX_MINGW64)
|
---|
77 | $(info Requires VBOX_PATH_PREFIX_MINGW32 and/or VBOX_PATH_PREFIX_MINGW64 to point something mingw like or there must be some mingw like in the PATH.)
|
---|
78 | $(info )
|
---|
79 | $(info Recent Fedora: sudo yum install mingw64-gcc mingw64-gcc-c++ mingw64-binutils mingw32-gcc mingw32-gcc-c++ mingw32-binutils)
|
---|
80 | $(info )
|
---|
81 | $(info Newer Debian and forks: sudo apt-get install binutils-mingw-w64 gcc-mingw-w64 g++-mingw-w64 )
|
---|
82 | $(info Older Debian and forks: sudo apt-get install mingw32-binutils mingw32 mingw32-runtime )
|
---|
83 | $(info )
|
---|
84 | $(info Gentoo: crossdev -S -P -v -t i686-pc-mingw32 && crossdev -S -P -v -t x86_64-pc-mingw32)
|
---|
85 | $(info )
|
---|
86 | $(error Needs mingw32/64)
|
---|
87 | endif
|
---|
88 | endif
|
---|
89 |
|
---|
90 |
|
---|
91 | #
|
---|
92 | # Make a build program template of our own.
|
---|
93 | #
|
---|
94 | TEMPLATE_VBoxEfiBldProg = EFI build program.
|
---|
95 | TEMPLATE_VBoxEfiBldProg_EXTENDS = VBoxBldProg
|
---|
96 | TEMPLATE_VBoxEfiBldProg_INST = EfiBldProgs/
|
---|
97 | TEMPLATE_VBoxEfiBldProg_INSTTYPE = stage
|
---|
98 | TEMPLATE_VBoxEfiBldProg_DEFS.win = $(TEMPLATE_VBoxBldProg_DEFS.win) \
|
---|
99 | __STDC_VERSION__=199409L
|
---|
100 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win = $(TEMPLATE_VBoxBldProg_CFLAGS.win)
|
---|
101 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4100 # warning C4100: '_text' : unreferenced formal parameter
|
---|
102 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4189 # warning C4189: 'zzpf' : local variable is initialized but not referenced
|
---|
103 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4255 # warning C4255: 'AllocateMemory' : no function prototype given: converting '()' to '(void)'
|
---|
104 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4267 # warning C4267: '=' : conversion from 'size_t' to 'UINT32', possible loss of data
|
---|
105 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4287 # warning C4287: '>' : unsigned/negative constant mismatch
|
---|
106 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4334 # warning C4334: '<<' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
|
---|
107 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4555 # warning C4555: expression has no effect; expected expression with side-effect
|
---|
108 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4701 # warning C4701: potentially uninitialized local variable 'save_line' used
|
---|
109 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4702 # warning C4702: unreachable code
|
---|
110 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win = $(TEMPLATE_VBoxBldProg_CXXFLAGS.win)
|
---|
111 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4018 # warning C4018: '>' : signed/unsigned mismatch
|
---|
112 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4101 # warning C4101: 'LineBuf' : unreferenced local variable
|
---|
113 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4102 # warning C4102: 'fail' : unreferenced label
|
---|
114 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4189 # warning C4189: 'zzpf' : local variable is initialized but not referenced
|
---|
115 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4267 # warning C4267: '=' : conversion from 'size_t' to 'UINT32', possible loss of data
|
---|
116 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4370 # warning C4370: 'ANTLRParser' : layout of class has changed from a previous version of the compiler due to better packing
|
---|
117 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4555 # warning C4555: expression has no effect; expected expression with side-effect
|
---|
118 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4625 # warning C4625: 'EfiVfrParser' : copy constructor could not be generated because a base class copy constructor is inaccessible
|
---|
119 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4626 # warning C4626: 'EfiVfrParser' : assignment operator could not be generated because a base class assignment operator is inaccessible
|
---|
120 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4701 # warning C4701: potentially uninitialized local variable 'save_line' used
|
---|
121 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4702 # warning C4702: unreachable code
|
---|
122 |
|
---|
123 | TEMPLATE_VBoxEfiBldProg_INCS = $(TEMPLATE_VBoxBldProg_INCS) \
|
---|
124 | $(VBOX_PATH_EFI_FIRMWARE)/BaseTools/Source/C/Include/IndustryStandard \
|
---|
125 | $(VBOX_PATH_EFI_FIRMWARE)/BaseTools/Source/C/Common \
|
---|
126 | $(VBOX_PATH_EFI_FIRMWARE)/BaseTools/Source/C/Include \
|
---|
127 | $(VBOX_PATH_EFI_FIRMWARE)/BaseTools/Source/C
|
---|
128 |
|
---|
129 | TEMPLATE_VBoxEfiBldProg_INCS.x86 = $(TEMPLATE_VBoxBldProg_INCS.x86) \
|
---|
130 | $(VBOX_PATH_EFI_FIRMWARE)/BaseTools/Source/C/Include/IA32
|
---|
131 |
|
---|
132 | TEMPLATE_VBoxEfiBldProg_INCS.amd64 = $(TEMPLATE_VBoxBldProg_INCS.amd64) \
|
---|
133 | $(VBOX_PATH_EFI_FIRMWARE)/BaseTools/Source/C/Include/X64
|
---|
134 |
|
---|
135 | TEMPLATE_VBoxEfiBldProg_LIBS = \
|
---|
136 | $(VBOX_PATH_STAGE_EFI_BLDPROGS)/EfiBldCommonLib$(VBOX_SUFF_LIB) \
|
---|
137 | $(TEMPLATE_VBoxBldProg_LIBS)
|
---|
138 | ifn1of ($(KBUILD_HOST),win) # This stuff isn't up to our standard at all! :/
|
---|
139 | TEMPLATE_VBoxEfiBldProg_CFLAGS = $(filter-out -pedantic,$(TEMPLATE_VBoxBldProg_CFLAGS)) \
|
---|
140 | -Wno-sign-compare -Wno-missing-prototypes -Wno-strict-prototypes \
|
---|
141 | -Wno-implicit-function-declaration -Wno-missing-declarations -Wno-shadow -Wno-format \
|
---|
142 | -Wno-empty-body -Wno-unused-parameter -Wno-unused-variable -Wno-unused-label
|
---|
143 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS = $(filter-out -pedantic,$(TEMPLATE_VBoxBldProg_CXXFLAGS)) \
|
---|
144 | -Wno-all -Wno-shadow -Wno-empty-body -Wno-unused-parameter -Wno-unused-variable \
|
---|
145 | -Wno-unused-label
|
---|
146 | endif
|
---|
147 |
|
---|
148 |
|
---|
149 | # There isn't a BLDLIBRARIES target group, so we have to override the build
|
---|
150 | # target for libraries used by build programs and keep them in LIBRARIES.
|
---|
151 | TEMPLATE_VBoxEfiBldLib = Library for an EFI build program.
|
---|
152 | TEMPLATE_VBoxEfiBldLib_EXTENDS = VBoxEfiBldProg
|
---|
153 | TEMPLATE_VBoxEfiBldLib_BLD_TRG := $(KBUILD_HOST)
|
---|
154 | TEMPLATE_VBoxEfiBldLib_BLD_TRG_ARCH := $(KBUILD_HOST_ARCH)
|
---|
155 | TEMPLATE_VBoxEfiBldLib_BLD_TRG_CPU := $(KBUILD_HOST_CPU)
|
---|
156 |
|
---|
157 |
|
---|
158 | #
|
---|
159 | # The debug info suffix.
|
---|
160 | #
|
---|
161 | if1of ($(KBUILD_TARGET), win)
|
---|
162 | VBOX_EFI_DBG_SUFF := .pdb
|
---|
163 | else
|
---|
164 | VBOX_EFI_DBG_SUFF := .debug
|
---|
165 | endif
|
---|
166 |
|
---|
167 | include $(VBOX_PATH_EFI_FIRMWARE)/EfiModules.kmk
|
---|