Paolo Bonzini | 783e9e5 | 2018-03-27 11:49:19 +0200 | [diff] [blame] | 1 | all: |
| 2 | |
Andrew Jones | cc68765 | 2018-09-18 19:54:26 +0200 | [diff] [blame] | 3 | top_srcdir = ../../../.. |
Paolo Bonzini | 783e9e5 | 2018-03-27 11:49:19 +0200 | [diff] [blame] | 4 | UNAME_M := $(shell uname -m) |
| 5 | |
Andrew Jones | 14c47b7 | 2018-09-18 19:54:25 +0200 | [diff] [blame] | 6 | LIBKVM = lib/assert.c lib/elf.c lib/io.c lib/kvm_util.c lib/ucall.c lib/sparsebit.c |
Andrew Jones | cc68765 | 2018-09-18 19:54:26 +0200 | [diff] [blame] | 7 | LIBKVM_x86_64 = lib/x86_64/processor.c lib/x86_64/vmx.c |
Andrew Jones | fff8dcd | 2018-09-18 19:54:32 +0200 | [diff] [blame] | 8 | LIBKVM_aarch64 = lib/aarch64/processor.c |
Paolo Bonzini | 783e9e5 | 2018-03-27 11:49:19 +0200 | [diff] [blame] | 9 | |
Andrew Jones | cc68765 | 2018-09-18 19:54:26 +0200 | [diff] [blame] | 10 | TEST_GEN_PROGS_x86_64 = x86_64/platform_info_test |
| 11 | TEST_GEN_PROGS_x86_64 += x86_64/set_sregs_test |
| 12 | TEST_GEN_PROGS_x86_64 += x86_64/sync_regs_test |
| 13 | TEST_GEN_PROGS_x86_64 += x86_64/vmx_tsc_adjust_test |
| 14 | TEST_GEN_PROGS_x86_64 += x86_64/cr4_cpuid_sync_test |
| 15 | TEST_GEN_PROGS_x86_64 += x86_64/state_test |
Vitaly Kuznetsov | 18178ff | 2018-10-16 18:50:11 +0200 | [diff] [blame^] | 16 | TEST_GEN_PROGS_x86_64 += x86_64/evmcs_test |
Andrew Jones | fff8dcd | 2018-09-18 19:54:32 +0200 | [diff] [blame] | 17 | TEST_GEN_PROGS_x86_64 += dirty_log_test |
| 18 | |
| 19 | TEST_GEN_PROGS_aarch64 += dirty_log_test |
Paolo Bonzini | 783e9e5 | 2018-03-27 11:49:19 +0200 | [diff] [blame] | 20 | |
| 21 | TEST_GEN_PROGS += $(TEST_GEN_PROGS_$(UNAME_M)) |
| 22 | LIBKVM += $(LIBKVM_$(UNAME_M)) |
| 23 | |
| 24 | INSTALL_HDR_PATH = $(top_srcdir)/usr |
| 25 | LINUX_HDR_PATH = $(INSTALL_HDR_PATH)/include/ |
Andrew Jones | cc68765 | 2018-09-18 19:54:26 +0200 | [diff] [blame] | 26 | LINUX_TOOL_INCLUDE = $(top_srcdir)/tools/include |
| 27 | CFLAGS += -O2 -g -std=gnu99 -I$(LINUX_TOOL_INCLUDE) -I$(LINUX_HDR_PATH) -Iinclude -I$(<D) -Iinclude/$(UNAME_M) -I.. |
Lei Yang | 6bd317d | 2018-08-29 15:04:08 +0800 | [diff] [blame] | 28 | LDFLAGS += -pthread |
Paolo Bonzini | 783e9e5 | 2018-03-27 11:49:19 +0200 | [diff] [blame] | 29 | |
| 30 | # After inclusion, $(OUTPUT) is defined and |
| 31 | # $(TEST_GEN_PROGS) starts with $(OUTPUT)/ |
| 32 | include ../lib.mk |
| 33 | |
| 34 | STATIC_LIBS := $(OUTPUT)/libkvm.a |
| 35 | LIBKVM_OBJ := $(patsubst %.c, $(OUTPUT)/%.o, $(LIBKVM)) |
Andrew Jones | eea192b | 2018-09-18 19:54:27 +0200 | [diff] [blame] | 36 | EXTRA_CLEAN += $(LIBKVM_OBJ) $(STATIC_LIBS) cscope.* |
Paolo Bonzini | 783e9e5 | 2018-03-27 11:49:19 +0200 | [diff] [blame] | 37 | |
| 38 | x := $(shell mkdir -p $(sort $(dir $(LIBKVM_OBJ)))) |
| 39 | $(LIBKVM_OBJ): $(OUTPUT)/%.o: %.c |
| 40 | $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@ |
| 41 | |
| 42 | $(OUTPUT)/libkvm.a: $(LIBKVM_OBJ) |
| 43 | $(AR) crs $@ $^ |
| 44 | |
Anders Roxell | b2d35fa | 2018-09-04 12:47:21 +0200 | [diff] [blame] | 45 | all: $(STATIC_LIBS) |
Paolo Bonzini | 783e9e5 | 2018-03-27 11:49:19 +0200 | [diff] [blame] | 46 | $(TEST_GEN_PROGS): $(STATIC_LIBS) |
Anders Roxell | b2d35fa | 2018-09-04 12:47:21 +0200 | [diff] [blame] | 47 | $(STATIC_LIBS):| khdr |
Andrew Jones | eea192b | 2018-09-18 19:54:27 +0200 | [diff] [blame] | 48 | |
| 49 | cscope: include_paths = $(LINUX_TOOL_INCLUDE) $(LINUX_HDR_PATH) include lib .. |
| 50 | cscope: |
| 51 | $(RM) cscope.* |
| 52 | (find $(include_paths) -name '*.h' \ |
| 53 | -exec realpath --relative-base=$(PWD) {} \;; \ |
| 54 | find . -name '*.c' \ |
| 55 | -exec realpath --relative-base=$(PWD) {} \;) | sort -u > cscope.files |
| 56 | cscope -b |