Makefile: fix cross-compiling issues

Replace all the host paths with a prefix sysroot directory, it defaults
to be empty, but can be overridden by the variable set in
environment(make -e) or being passed to make command.

Tracked-On: #1307
Signed-off-by: Ming Liu <liu.ming50@gmail.com>
This commit is contained in:
Ming Liu
2018-09-25 08:57:34 +02:00
committed by lijinxia
parent 8787c06d3b
commit f1cce6710a
3 changed files with 9 additions and 9 deletions

View File

@@ -53,12 +53,12 @@ endif
# its tools and libraries in different folders. The next couple of
# variables will determine and set the right path for both the
# tools $(GNUEFI_DIR) and libraries $(LIBDIR)
GNUEFI_DIR := $(shell find /usr/lib* -name elf_$(ARCH)_efi.lds -type f | xargs dirname)
GNUEFI_DIR := $(shell find $(SYSROOT)/usr/lib* -name elf_$(ARCH)_efi.lds -type f | xargs dirname)
LIBDIR := $(subst gnuefi,,$(GNUEFI_DIR))
CRT0 := $(GNUEFI_DIR)/crt0-efi-$(ARCH).o
LDSCRIPT := $(GNUEFI_DIR)/elf_$(ARCH)_efi.lds
INCDIR := /usr/include
INCDIR := $(SYSROOT)/usr/include
CFLAGS=-I. -I.. -I../../../include/arch/x86/guest -I$(INCDIR)/efi -I$(INCDIR)/efi/$(ARCH) \
-DEFI_FUNCTION_WRAPPER -fPIC -fshort-wchar -ffreestanding \