Skip to content

Commit f1cce67

Browse files
liuming50lijinxia
authored andcommitted
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>
1 parent 8787c06 commit f1cce67

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

hypervisor/bsp/uefi/efi/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ endif
5353
# its tools and libraries in different folders. The next couple of
5454
# variables will determine and set the right path for both the
5555
# tools $(GNUEFI_DIR) and libraries $(LIBDIR)
56-
GNUEFI_DIR := $(shell find /usr/lib* -name elf_$(ARCH)_efi.lds -type f | xargs dirname)
56+
GNUEFI_DIR := $(shell find $(SYSROOT)/usr/lib* -name elf_$(ARCH)_efi.lds -type f | xargs dirname)
5757
LIBDIR := $(subst gnuefi,,$(GNUEFI_DIR))
5858
CRT0 := $(GNUEFI_DIR)/crt0-efi-$(ARCH).o
5959
LDSCRIPT := $(GNUEFI_DIR)/elf_$(ARCH)_efi.lds
6060

61-
INCDIR := /usr/include
61+
INCDIR := $(SYSROOT)/usr/include
6262

6363
CFLAGS=-I. -I.. -I../../../include/arch/x86/guest -I$(INCDIR)/efi -I$(INCDIR)/efi/$(ARCH) \
6464
-DEFI_FUNCTION_WRAPPER -fPIC -fshort-wchar -ffreestanding \

tools/acrn-crashlog/Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ export BUILDDIR
5454
export CC
5555
export RM
5656

57-
PKG_CONFIG_PATH := $(PKG_CONFIG_PATH):/usr/lib/pkgconfig
58-
PKG_CONFIG_PATH := $(PKG_CONFIG_PATH):/usr/share/pkgconfig
59-
PKG_CONFIG_PATH := $(PKG_CONFIG_PATH):/usr/local/lib/pkgconfig
60-
PKG_CONFIG_PATH := $(PKG_CONFIG_PATH):/usr/local/share/pkgconfig
61-
PKG_CONFIG_PATH := $(PKG_CONFIG_PATH):/usr/lib32/pkgconfig
62-
PKG_CONFIG_PATH := $(PKG_CONFIG_PATH):/usr/lib64/pkgconfig
57+
PKG_CONFIG_PATH := $(PKG_CONFIG_PATH):$(SYSROOT)/usr/lib/pkgconfig
58+
PKG_CONFIG_PATH := $(PKG_CONFIG_PATH):$(SYSROOT)/usr/share/pkgconfig
59+
PKG_CONFIG_PATH := $(PKG_CONFIG_PATH):$(SYSROOT)/usr/local/lib/pkgconfig
60+
PKG_CONFIG_PATH := $(PKG_CONFIG_PATH):$(SYSROOT)/usr/local/share/pkgconfig
61+
PKG_CONFIG_PATH := $(PKG_CONFIG_PATH):$(SYSROOT)/usr/lib32/pkgconfig
62+
PKG_CONFIG_PATH := $(PKG_CONFIG_PATH):$(SYSROOT)/usr/lib64/pkgconfig
6363

6464
EXTRA_LIBS = -lsystemd-journal
6565
PKG_CONFIG := $(shell export PKG_CONFIG_PATH=$(PKG_CONFIG_PATH); \

tools/acrn-crashlog/acrnprobe/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ VERSION_H = $(BUILDDIR)/include/acrnprobe/version.h
55

66
LIBS = -lpthread -lxml2 -lcrypto -lrt -lblkid -lext2fs -lcom_err \
77
$(EXTRA_LIBS)
8-
INCLUDE += -I $(CURDIR)/include -I /usr/include/libxml2
8+
INCLUDE += -I $(CURDIR)/include -I $(SYSROOT)/usr/include/libxml2
99
INCLUDE += -I $(BUILDDIR)/include/acrnprobe
1010
CFLAGS += $(INCLUDE)
1111
CFLAGS += -fdata-sections

0 commit comments

Comments
 (0)