1 | # $Id: Config.kmk 95128 2022-05-27 12:08:33Z 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-2022 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/Firmware
|
---|
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 | ## @todo r=andy Is this still needed? Or can we just use TOOL_YASM_AS?
|
---|
47 | VBOX_YASMCMD ?= $(firstword $(wildcard $(KBUILD_DEVTOOLS_HST)/bin/yasm$(HOSTSUFF_EXE)) yasm$(HOSTSUFF_EXE))
|
---|
48 |
|
---|
49 | # VBox nasm command
|
---|
50 | include $(KBUILD_PATH)/tools/NASM.kmk
|
---|
51 | TOOL_VBoxNasm = Our version of the NASM tool
|
---|
52 | ifndef TOOL_VBoxNasm_PATH
|
---|
53 | TOOL_VBoxNasm_PATH := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST)/nasm/v*.*)))
|
---|
54 | if "$(TOOL_VBoxNasm_PATH)" == "" && "$(KBUILD_DEVTOOLS_HST_ALT)" != ""
|
---|
55 | TOOL_VBoxNasm_PATH := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST_ALT)/nasm/v*.*)))
|
---|
56 | endif
|
---|
57 | endif
|
---|
58 | ifneq ($(TOOL_VBoxNasm_PATH),)
|
---|
59 | VBOX_NASMCMD ?= $(TOOL_VBoxNasm_PATH)/nasm$(HOSTSUFF_EXE)
|
---|
60 | else
|
---|
61 | VBOX_NASMCMD ?= nasm$(HOSTSUFF_EXE)
|
---|
62 | endif
|
---|
63 |
|
---|
64 | # EFI requires python v2.x, so provide a way to select that while using 3.x for the rest of VBox.
|
---|
65 | ifndef VBOX_BLD_PYTHON_2X
|
---|
66 | VBOX_BLD_PYTHON_2X = $(VBOX_BLD_PYTHON)
|
---|
67 | endif
|
---|
68 |
|
---|
69 | #
|
---|
70 | # Decide which tool chain to use for the EFI binaries.
|
---|
71 | # Note! We're using our own stripped down tools_def.txt: vbox-tools_def.txt.
|
---|
72 | #
|
---|
73 | ifeq ($(KBUILD_HOST),win)
|
---|
74 | ifdef VBOX_WITH_NEW_VCC # ACtually using VS2019, but no config for it, so VS2017 will have to do for now.
|
---|
75 | VBOX_EFI_TOOL_CHAIN := VS2017
|
---|
76 | else
|
---|
77 | VBOX_EFI_TOOL_CHAIN := VS2010
|
---|
78 | endif
|
---|
79 | else
|
---|
80 | VBOX_EFI_TOOL_CHAIN = GCC48
|
---|
81 | endif
|
---|
82 |
|
---|
83 |
|
---|
84 | #
|
---|
85 | # Make a build program template of our own.
|
---|
86 | #
|
---|
87 | TEMPLATE_VBoxEfiBldProg = EFI build program.
|
---|
88 | TEMPLATE_VBoxEfiBldProg_EXTENDS = VBoxBldProg
|
---|
89 | TEMPLATE_VBoxEfiBldProg_INST = EfiBldProgs/
|
---|
90 | TEMPLATE_VBoxEfiBldProg_INSTTYPE = stage
|
---|
91 | TEMPLATE_VBoxEfiBldProg_DEFS.win = $(TEMPLATE_VBoxBldProg_DEFS.win) \
|
---|
92 | __STDC_VERSION__=199409L
|
---|
93 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win = $(TEMPLATE_VBoxBldProg_CFLAGS.win)
|
---|
94 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4100 # warning C4100: '_text' : unreferenced formal parameter
|
---|
95 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4189 # warning C4189: 'zzpf' : local variable is initialized but not referenced
|
---|
96 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4255 # warning C4255: 'AllocateMemory' : no function prototype given: converting '()' to '(void)'
|
---|
97 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4267 # warning C4267: '=' : conversion from 'size_t' to 'UINT32', possible loss of data
|
---|
98 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4287 # warning C4287: '>' : unsigned/negative constant mismatch
|
---|
99 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4334 # warning C4334: '<<' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
|
---|
100 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4555 # warning C4555: expression has no effect; expected expression with side-effect
|
---|
101 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4701 # warning C4701: potentially uninitialized local variable 'save_line' used
|
---|
102 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4702 # warning C4702: unreachable code
|
---|
103 | if "$(VBOX_VCC_TOOL_STEM)" >= "VCC140"
|
---|
104 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4456 # antlr\gen.c(3000): warning C4456: declaration of 'f' hides previous local declaration
|
---|
105 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4774 # antlr\main.c(1244): warning C4774: 'sprintf' : format string expected in argument 2 is not a string literal
|
---|
106 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4703 # antlr\antlr.c(1403) : warning C4703: potentially uninitialized local pointer variable 'p' used
|
---|
107 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4477 # dlg\dlg_p.c(874): warning C4477: 'fprintf' : format string '%x' requires an argument of type 'unsigned int', but variadic argument 1 has type '_nfa_node *'
|
---|
108 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4313 # dlg\dlg_p.c(874): warning C4313: 'fprintf': '%x' in format string conflicts with argument 1 of type '_nfa_node *'
|
---|
109 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4459 # antlr\gen.c(756): warning C4459: declaration of 'output' hides global declaration
|
---|
110 | endif
|
---|
111 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win = $(TEMPLATE_VBoxBldProg_CXXFLAGS.win)
|
---|
112 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4018 # warning C4018: '>' : signed/unsigned mismatch
|
---|
113 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4101 # warning C4101: 'LineBuf' : unreferenced local variable
|
---|
114 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4102 # warning C4102: 'fail' : unreferenced label
|
---|
115 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4189 # warning C4189: 'zzpf' : local variable is initialized but not referenced
|
---|
116 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4267 # warning C4267: '=' : conversion from 'size_t' to 'UINT32', possible loss of data
|
---|
117 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4370 # warning C4370: 'ANTLRParser' : layout of class has changed from a previous version of the compiler due to better packing
|
---|
118 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4555 # warning C4555: expression has no effect; expected expression with side-effect
|
---|
119 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4625 # warning C4625: 'EfiVfrParser' : copy constructor could not be generated because a base class copy constructor is inaccessible
|
---|
120 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4626 # warning C4626: 'EfiVfrParser' : assignment operator could not be generated because a base class assignment operator is inaccessible
|
---|
121 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4701 # warning C4701: potentially uninitialized local variable 'save_line' used
|
---|
122 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4702 # warning C4702: unreachable code
|
---|
123 | if "$(VBOX_VCC_TOOL_STEM)" >= "VCC140"
|
---|
124 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd5204 # Pccts\h\ATokenStream.h(49): warning C5204: 'ANTLRTokenStream': class has virtual functions, but its trivial destructor is not virtual; instances of objects derived from this class may not be destructed correctly
|
---|
125 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4774 # Pccts\h\AParser.cpp(653): warning C4774: 'sprintf' : format string expected in argument 2 is not a string literal
|
---|
126 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4703 # VfrCompile\VfrFormPkg.cpp(1344) : warning C4703: potentially uninitialized local pointer variable 'pNodeBeforeAdjust' used
|
---|
127 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd5033 # DLexer.h(68): warning C5033: 'register' is no longer a supported storage class (in c++17 or later mode)
|
---|
128 | endif
|
---|
129 |
|
---|
130 | TEMPLATE_VBoxEfiBldProg_INCS = $(TEMPLATE_VBoxBldProg_INCS) \
|
---|
131 | $(VBOX_PATH_EFI_FIRMWARE)/BaseTools/Source/C/Include/IndustryStandard \
|
---|
132 | $(VBOX_PATH_EFI_FIRMWARE)/BaseTools/Source/C/Common \
|
---|
133 | $(VBOX_PATH_EFI_FIRMWARE)/BaseTools/Source/C/Include \
|
---|
134 | $(VBOX_PATH_EFI_FIRMWARE)/BaseTools/Source/C
|
---|
135 |
|
---|
136 | TEMPLATE_VBoxEfiBldProg_INCS.x86 = $(TEMPLATE_VBoxBldProg_INCS.x86) \
|
---|
137 | $(VBOX_PATH_EFI_FIRMWARE)/BaseTools/Source/C/Include/IA32
|
---|
138 |
|
---|
139 | TEMPLATE_VBoxEfiBldProg_INCS.amd64 = $(TEMPLATE_VBoxBldProg_INCS.amd64) \
|
---|
140 | $(VBOX_PATH_EFI_FIRMWARE)/BaseTools/Source/C/Include/X64
|
---|
141 |
|
---|
142 | TEMPLATE_VBoxEfiBldProg_LIBS = \
|
---|
143 | $(VBOX_PATH_STAGE_EFI_BLDPROGS)/EfiBldCommonLib$(VBOX_SUFF_LIB) \
|
---|
144 | $(TEMPLATE_VBoxBldProg_LIBS)
|
---|
145 | ifn1of ($(KBUILD_HOST),win) # This stuff isn't up to our standard at all! :/
|
---|
146 | TEMPLATE_VBoxEfiBldProg_CFLAGS = $(filter-out -pedantic,$(TEMPLATE_VBoxBldProg_CFLAGS)) \
|
---|
147 | -Wno-sign-compare -Wno-missing-prototypes -Wno-strict-prototypes \
|
---|
148 | -Wno-implicit-function-declaration -Wno-missing-declarations -Wno-shadow -Wno-format \
|
---|
149 | -Wno-empty-body -Wno-unused-parameter -Wno-unused-variable -Wno-unused-label
|
---|
150 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS = $(filter-out -pedantic,$(TEMPLATE_VBoxBldProg_CXXFLAGS)) \
|
---|
151 | -Wno-all -Wno-shadow -Wno-empty-body -Wno-unused-parameter -Wno-unused-variable \
|
---|
152 | -Wno-unused-label
|
---|
153 | endif
|
---|
154 |
|
---|
155 |
|
---|
156 | # There isn't a BLDLIBRARIES target group, so we have to override the build
|
---|
157 | # target for libraries used by build programs and keep them in LIBRARIES.
|
---|
158 | TEMPLATE_VBoxEfiBldLib = Library for an EFI build program.
|
---|
159 | TEMPLATE_VBoxEfiBldLib_EXTENDS = VBoxEfiBldProg
|
---|
160 | TEMPLATE_VBoxEfiBldLib_BLD_TRG := $(KBUILD_HOST)
|
---|
161 | TEMPLATE_VBoxEfiBldLib_BLD_TRG_ARCH := $(KBUILD_HOST_ARCH)
|
---|
162 | TEMPLATE_VBoxEfiBldLib_BLD_TRG_CPU := $(KBUILD_HOST_CPU)
|
---|
163 |
|
---|
164 |
|
---|
165 | #
|
---|
166 | # The debug info suffix.
|
---|
167 | #
|
---|
168 | if1of ($(KBUILD_TARGET), win)
|
---|
169 | VBOX_EFI_DBG_SUFF := .pdb
|
---|
170 | else
|
---|
171 | VBOX_EFI_DBG_SUFF := .debug
|
---|
172 | endif
|
---|
173 |
|
---|
174 | include $(VBOX_PATH_EFI_FIRMWARE)/EfiModules.kmk
|
---|