|
5 | 5 |
|
6 | 6 | top_srcdir = ../../../..
|
7 | 7 | KSFT_KHDR_INSTALL := 1
|
| 8 | + |
| 9 | +# For cross-builds to work, UNAME_M has to map to ARCH and arch specific |
| 10 | +# directories and targets in this Makefile. "uname -m" doesn't map to |
| 11 | +# arch specific sub-directory names. |
| 12 | +# |
| 13 | +# UNAME_M variable to used to run the compiles pointing to the right arch |
| 14 | +# directories and build the right targets for these supported architectures. |
| 15 | +# |
| 16 | +# TEST_GEN_PROGS and LIBKVM are set using UNAME_M variable. |
| 17 | +# LINUX_TOOL_ARCH_INCLUDE is set using ARCH variable. |
| 18 | +# |
| 19 | +# x86_64 targets are named to include x86_64 as a suffix and directories |
| 20 | +# for includes are in x86_64 sub-directory. s390x and aarch64 follow the |
| 21 | +# same convention. "uname -m" doesn't result in the correct mapping for |
| 22 | +# s390x and aarch64. |
| 23 | +# |
| 24 | +# No change necessary for x86_64 |
8 | 25 | UNAME_M := $(shell uname -m)
|
9 | 26 |
|
| 27 | +# Set UNAME_M for arm64 compile/install to work |
| 28 | +ifeq ($(ARCH),arm64) |
| 29 | + UNAME_M := aarch64 |
| 30 | +endif |
| 31 | +# Set UNAME_M s390x compile/install to work |
| 32 | +ifeq ($(ARCH),s390) |
| 33 | + UNAME_M := s390x |
| 34 | +endif |
| 35 | + |
10 | 36 | LIBKVM = lib/assert.c lib/elf.c lib/io.c lib/kvm_util.c lib/sparsebit.c lib/test_util.c
|
11 | 37 | LIBKVM_x86_64 = lib/x86_64/processor.c lib/x86_64/vmx.c lib/x86_64/svm.c lib/x86_64/ucall.c
|
12 | 38 | LIBKVM_aarch64 = lib/aarch64/processor.c lib/aarch64/ucall.c
|
@@ -53,7 +79,7 @@ LIBKVM += $(LIBKVM_$(UNAME_M))
|
53 | 79 | INSTALL_HDR_PATH = $(top_srcdir)/usr
|
54 | 80 | LINUX_HDR_PATH = $(INSTALL_HDR_PATH)/include/
|
55 | 81 | LINUX_TOOL_INCLUDE = $(top_srcdir)/tools/include
|
56 |
| -LINUX_TOOL_ARCH_INCLUDE = $(top_srcdir)/tools/arch/x86/include |
| 82 | +LINUX_TOOL_ARCH_INCLUDE = $(top_srcdir)/tools/arch/$(ARCH)/include |
57 | 83 | CFLAGS += -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=gnu99 \
|
58 | 84 | -fno-stack-protector -fno-PIE -I$(LINUX_TOOL_INCLUDE) \
|
59 | 85 | -I$(LINUX_TOOL_ARCH_INCLUDE) -I$(LINUX_HDR_PATH) -Iinclude \
|
@@ -84,6 +110,7 @@ $(LIBKVM_OBJ): $(OUTPUT)/%.o: %.c
|
84 | 110 | $(OUTPUT)/libkvm.a: $(LIBKVM_OBJ)
|
85 | 111 | $(AR) crs $@ $^
|
86 | 112 |
|
| 113 | +x := $(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS)))) |
87 | 114 | all: $(STATIC_LIBS)
|
88 | 115 | $(TEST_GEN_PROGS): $(STATIC_LIBS)
|
89 | 116 |
|
|
0 commit comments