#!/usr/bin/make -f # # Copyright (c) Siemens AG, 2022-2023 # # Authors: # Sven Schultschik # # SPDX-License-Identifier: MIT ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) export CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)- endif export WORKSPACE=$(shell pwd) export PACKAGES_PATH=$(WORKSPACE)/edk2:$(WORKSPACE)/edk2-platforms export ACTIVE_PLATFORM="Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStandaloneMmRpmb.dsc" # https://github.com/tianocore/edk2-platforms/blob/master/Readme.md#if-cross-compiling ifeq (arm64,$(DEB_TARGET_ARCH)) export TARGET_ARCH = 'AARCH64' else ifeq ((armhf,$(DEB_TARGET_ARCH)) export TARGET_ARCH = 'ARM' else ifeq ((amd64,$(DEB_TARGET_ARCH)) export TARGET_ARCH = 'X64' else ifeq ((i386,$(DEB_TARGET_ARCH)) export TARGET_ARCH = 'IA32' else $(error DEB_TARGET_ARCH $(DEB_TARGET_ARCH) unsupported) endif export SHELL=/bin/bash # ENV Vars which should get set by edksetup.sh export PYTHON_COMMAND=python3 export PYTHONHASHSEED=1 export CONF_PATH=$(WORKSPACE)/edk2/Conf export EDK_TOOLS_PATH=$(WORKSPACE)/edk2/BaseTools export PATH=$(WORKSPACE)/edk2/BaseTools/Bin/Linux-$(TARGET_ARCH):$(WORKSPACE)/edk2/BaseTools/BinWrappers/PosixLike::/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin # When cross-compiling, or building with a different version of the compiler than # the default `gcc`, we additionally need to inform the # build command which toolchain to use. We do this by setting the environment # variable `{TOOL_CHAIN_TAG}_{TARGET_ARCH}_PREFIX` - in the case above, # **GCC5_AARCH64_PREFIX**. # export GCC5_AARCH64_PREFIX=aarch64-linux-gnu- # using export here at TOP Level does not work, because # GCC5_$(TARGET_ARCH)_PREFIX gets deleted again for what reason ever # Therefore it is set right before the build command # export GCC5_$(TARGET_ARCH)_PREFIX=$(DEB_HOST_GNU_TYPE)- override_dh_auto_build: source edk2/edksetup.sh --reconfig CFLAGS= LDFLAGS= make -C edk2/BaseTools (export GCC49_$(TARGET_ARCH)_PREFIX=$(DEB_HOST_GNU_TYPE)- && \ build -p $(ACTIVE_PLATFORM) -b RELEASE -a $(TARGET_ARCH) -t GCC49 -n $(shell nproc)) override_dh_auto_install: override_dh_auto_test: %: dh $@ --no-parallel