kvm: testsuite: add protected mode smp tests
[qemu-kvm/fedora.git] / kvm / user / Makefile
bloba6cbaf6fabf2dea26c270ae173c5eb42b3f7fb76
2 include config.mak
4 # cc-option
5 # Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0)
7 cc-option = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null \
8 > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
10 CFLAGS = -I $(KERNELDIR)/include $(autodepend-flags) -g -fomit-frame-pointer \
11 -Wall -m$(bits)
12 CFLAGS += $(call cc-option, -fno-stack-protector, "")
13 CFLAGS += $(call cc-option, -fno-stack-protector-all, "")
15 LDFLAGS += $(CFLAGS)
17 CXXFLAGS = $(autodepend-flags)
19 autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d
21 DESTDIR =
23 ifeq ($(shell uname -m), x86_64)
24 LIBDIR = /lib64
25 cstart.o = test/cstart64.o
26 bits = 64
27 ldarch = elf64-x86-64
28 else
29 LIBDIR = /lib
30 cstart.o = test/cstart.o
31 bits = 32
32 ldarch = elf32-i386
33 endif
35 all: kvmctl libkvm.a flatfiles
37 kvmctl: LDFLAGS += -pthread -lrt
39 kvmctl: kvmctl.o main.o
41 balloon_ctl: balloon_ctl.o
43 libkvm.a: kvmctl.o
44 $(AR) rcs $@ $^
46 flatfiles-common = test/bootstrap test/vmexit.flat
48 flatfiles-32 = test/smp.flat
50 flatfiles-64 = test/access.flat test/irq.flat test/sieve.flat test/simple.flat test/stringio.flat test/memtest1.flat
52 flatfiles: $(flatfiles-common) $(flatfiles-$(bits))
54 install:
55 install -D kvmctl.h $(DESTDIR)/$(PREFIX)/include/kvmctl.h
56 install -D $(KERNELDIR)/include/linux/kvm.h \
57 $(DESTDIR)/$(PREFIX)/include/linux/kvm.h
58 install -D libkvm.a $(DESTDIR)/$(PREFIX)/$(LIBDIR)/libkvm.a
60 %.flat: %.o
61 gcc $(CFLAGS) -nostdlib -o $@ -Wl,-T,flat.lds $^
63 test/bootstrap: test/bootstrap.o
64 gcc -nostdlib -o $@ -Wl,-T,bootstrap.lds $^
66 %.o: %.S
67 gcc $(CFLAGS) -c -nostdlib -o $@ $^
69 test/irq.flat: test/print.o
71 test/access.flat: $(cstart.o) test/access.o test/printf.o test/print.o
73 test/sieve.flat: $(cstart.o) test/sieve.o test/print.o test/vm.o
75 test/vmexit.flat: $(cstart.o) test/vmexit.o test/printf.o
77 test/test32.flat: test/test32.o
79 test/smp.flat: $(cstart.o) test/smp.o test/printf.o
81 test/%.o: CFLAGS += -std=gnu99 -ffreestanding
83 -include .*.d
85 clean:
86 $(RM) kvmctl *.o *.a .*.d
87 $(RM) test/bootstrap test/*.o test/*.flat test/.*.d