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