From 23c12b7a74079e718a7b4b7916f907a0d013e267 Mon Sep 17 00:00:00 2001 From: "David B. Kinder" Date: Tue, 20 Mar 2018 13:54:32 -0700 Subject: [PATCH] makefile: adjust linker path in Makefile As mentioned in https://github.com/projectacrn/acrn-documentation/pull/38 on some operating systems, the ``gnu-efi`` package installs the linker under a ``gnuefi`` folder in ``${LIBDIR}``. This is the case in Fedora for example. Check if the gnuefi folder is there and use it if it is in the path to the linker. This PR fixes the Makefile rather than documenting how to edit it yourself. Signed-off-by: David B. Kinder --- hypervisor/bsp/uefi/efi/Makefile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hypervisor/bsp/uefi/efi/Makefile b/hypervisor/bsp/uefi/efi/Makefile index e31d9e73a..86d220cbb 100644 --- a/hypervisor/bsp/uefi/efi/Makefile +++ b/hypervisor/bsp/uefi/efi/Makefile @@ -55,8 +55,15 @@ endif INCDIR := /usr/include # gnuefi sometimes installs these under a gnuefi/ directory, and sometimes not -CRT0 := $(LIBDIR)/crt0-efi-$(ARCH).o -LDSCRIPT := $(LIBDIR)/elf_$(ARCH)_efi.lds +ifneq ("$(wildcard $(LIBDIR)/gnuefi/crt0-efi-$(ARCH).o)","") + CRT0 := $(LIBDIR)/gnuefi/crt0-efi-$(ARCH).o + LDSCRIPT := $(LIBDIR)/gnuefi/elf_$(ARCH)_efi.lds +else + CRT0 := $(LIBDIR)/crt0-efi-$(ARCH).o + LDSCRIPT := $(LIBDIR)/elf_$(ARCH)_efi.lds +endif + + CFLAGS=-I. -I.. -I$(INCDIR)/efi -I$(INCDIR)/efi/$(ARCH) \ -DEFI_FUNCTION_WRAPPER -fPIC -fshort-wchar -ffreestanding \