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 <david.b.kinder@intel.com>
This commit is contained in:
David B. Kinder 2018-03-20 13:54:32 -07:00 committed by lijinxia
parent 0a5806ea8e
commit 263a0c9de0

View File

@ -55,8 +55,15 @@ endif
INCDIR := /usr/include
# gnuefi sometimes installs these under a gnuefi/ directory, and sometimes not
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 \