blob: caaa0d5eba923bfb0c9c953056451eb7a8632c0d [file] [log] [blame]
Paolo Bonzini783e9e52018-03-27 11:49:19 +02001all:
2
Andrew Jonescc687652018-09-18 19:54:26 +02003top_srcdir = ../../../..
Shuah Khan211929f2018-12-12 20:25:14 -07004KSFT_KHDR_INSTALL := 1
Paolo Bonzini783e9e52018-03-27 11:49:19 +02005UNAME_M := $(shell uname -m)
6
Andrew Jones14c47b72018-09-18 19:54:25 +02007LIBKVM = lib/assert.c lib/elf.c lib/io.c lib/kvm_util.c lib/ucall.c lib/sparsebit.c
Andrew Jonescc687652018-09-18 19:54:26 +02008LIBKVM_x86_64 = lib/x86_64/processor.c lib/x86_64/vmx.c
Andrew Jonesfff8dcd2018-09-18 19:54:32 +02009LIBKVM_aarch64 = lib/aarch64/processor.c
Paolo Bonzini783e9e52018-03-27 11:49:19 +020010
Andrew Jonescc687652018-09-18 19:54:26 +020011TEST_GEN_PROGS_x86_64 = x86_64/platform_info_test
12TEST_GEN_PROGS_x86_64 += x86_64/set_sregs_test
13TEST_GEN_PROGS_x86_64 += x86_64/sync_regs_test
14TEST_GEN_PROGS_x86_64 += x86_64/vmx_tsc_adjust_test
15TEST_GEN_PROGS_x86_64 += x86_64/cr4_cpuid_sync_test
16TEST_GEN_PROGS_x86_64 += x86_64/state_test
Vitaly Kuznetsov18178ff2018-10-16 18:50:11 +020017TEST_GEN_PROGS_x86_64 += x86_64/evmcs_test
Andrew Jonesfff8dcd2018-09-18 19:54:32 +020018TEST_GEN_PROGS_x86_64 += dirty_log_test
Paolo Bonzini2a31b9d2018-10-23 02:36:47 +020019TEST_GEN_PROGS_x86_64 += clear_dirty_log_test
Andrew Jonesfff8dcd2018-09-18 19:54:32 +020020
21TEST_GEN_PROGS_aarch64 += dirty_log_test
Paolo Bonzini2a31b9d2018-10-23 02:36:47 +020022TEST_GEN_PROGS_aarch64 += clear_dirty_log_test
Paolo Bonzini783e9e52018-03-27 11:49:19 +020023
24TEST_GEN_PROGS += $(TEST_GEN_PROGS_$(UNAME_M))
25LIBKVM += $(LIBKVM_$(UNAME_M))
26
27INSTALL_HDR_PATH = $(top_srcdir)/usr
28LINUX_HDR_PATH = $(INSTALL_HDR_PATH)/include/
Andrew Jonescc687652018-09-18 19:54:26 +020029LINUX_TOOL_INCLUDE = $(top_srcdir)/tools/include
30CFLAGS += -O2 -g -std=gnu99 -I$(LINUX_TOOL_INCLUDE) -I$(LINUX_HDR_PATH) -Iinclude -I$(<D) -Iinclude/$(UNAME_M) -I..
Lei Yang6bd317d2018-08-29 15:04:08 +080031LDFLAGS += -pthread
Paolo Bonzini783e9e52018-03-27 11:49:19 +020032
33# After inclusion, $(OUTPUT) is defined and
34# $(TEST_GEN_PROGS) starts with $(OUTPUT)/
35include ../lib.mk
36
37STATIC_LIBS := $(OUTPUT)/libkvm.a
38LIBKVM_OBJ := $(patsubst %.c, $(OUTPUT)/%.o, $(LIBKVM))
Andrew Joneseea192b2018-09-18 19:54:27 +020039EXTRA_CLEAN += $(LIBKVM_OBJ) $(STATIC_LIBS) cscope.*
Paolo Bonzini783e9e52018-03-27 11:49:19 +020040
41x := $(shell mkdir -p $(sort $(dir $(LIBKVM_OBJ))))
42$(LIBKVM_OBJ): $(OUTPUT)/%.o: %.c
43 $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
44
45$(OUTPUT)/libkvm.a: $(LIBKVM_OBJ)
46 $(AR) crs $@ $^
47
Anders Roxellb2d35fa2018-09-04 12:47:21 +020048all: $(STATIC_LIBS)
Paolo Bonzini783e9e52018-03-27 11:49:19 +020049$(TEST_GEN_PROGS): $(STATIC_LIBS)
Andrew Joneseea192b2018-09-18 19:54:27 +020050
51cscope: include_paths = $(LINUX_TOOL_INCLUDE) $(LINUX_HDR_PATH) include lib ..
52cscope:
53 $(RM) cscope.*
54 (find $(include_paths) -name '*.h' \
55 -exec realpath --relative-base=$(PWD) {} \;; \
56 find . -name '*.c' \
57 -exec realpath --relative-base=$(PWD) {} \;) | sort -u > cscope.files
58 cscope -b