1all: 2 3top_srcdir = ../../../../ 4UNAME_M := $(shell uname -m) 5 6LIBKVM = lib/assert.c lib/elf.c lib/io.c lib/kvm_util.c lib/sparsebit.c 7LIBKVM_x86_64 = lib/x86.c lib/vmx.c 8 9TEST_GEN_PROGS_x86_64 = set_sregs_test 10TEST_GEN_PROGS_x86_64 += sync_regs_test 11TEST_GEN_PROGS_x86_64 += vmx_tsc_adjust_test 12 13TEST_GEN_PROGS += $(TEST_GEN_PROGS_$(UNAME_M)) 14LIBKVM += $(LIBKVM_$(UNAME_M)) 15 16INSTALL_HDR_PATH = $(top_srcdir)/usr 17LINUX_HDR_PATH = $(INSTALL_HDR_PATH)/include/ 18CFLAGS += -O2 -g -std=gnu99 -I$(LINUX_HDR_PATH) -Iinclude -I$(<D) -I.. 19 20# After inclusion, $(OUTPUT) is defined and 21# $(TEST_GEN_PROGS) starts with $(OUTPUT)/ 22include ../lib.mk 23 24STATIC_LIBS := $(OUTPUT)/libkvm.a 25LIBKVM_OBJ := $(patsubst %.c, $(OUTPUT)/%.o, $(LIBKVM)) 26EXTRA_CLEAN += $(LIBKVM_OBJ) $(STATIC_LIBS) 27 28x := $(shell mkdir -p $(sort $(dir $(LIBKVM_OBJ)))) 29$(LIBKVM_OBJ): $(OUTPUT)/%.o: %.c 30 $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@ 31 32$(OUTPUT)/libkvm.a: $(LIBKVM_OBJ) 33 $(AR) crs $@ $^ 34 35$(LINUX_HDR_PATH): 36 make -C $(top_srcdir) headers_install 37 38all: $(STATIC_LIBS) $(LINUX_HDR_PATH) 39$(TEST_GEN_PROGS): $(STATIC_LIBS) 40$(TEST_GEN_PROGS) $(LIBKVM_OBJ): | $(LINUX_HDR_PATH) 41