kvm: portability: consolidate x86 user makefiles
[qemu-kvm/fedora.git] / kvm / user / Makefile
blob6628cfdb2e0e2b53fcf55bcd9b82095629003eab
2 include config.mak
4 DESTDIR :=
6 #make sure env CFLAGS variable is not used
7 CFLAGS =
9 #include architecure specific make rules
10 include config-$(ARCH).mak
12 # cc-option
13 # Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0)
15 cc-option = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null \
16 > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
18 CFLAGS += $(autodepend-flags) -g -fomit-frame-pointer -Wall
19 CFLAGS += $(call cc-option, -fno-stack-protector, "")
20 CFLAGS += $(call cc-option, -fno-stack-protector-all, "")
22 LDFLAGS += $(CFLAGS)
24 CXXFLAGS = $(autodepend-flags)
26 autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d
28 install:
29 install -D kvmctl.h $(DESTDIR)/$(PREFIX)/include/kvmctl.h
30 install -D $(KERNELDIR)/include/linux/kvm.h \
31 $(DESTDIR)/$(PREFIX)/include/linux/kvm.h
32 install -D $(KERNELDIR)/include/linux/kvm_para.h \
33 $(DESTDIR)/$(PREFIX)/include/linux/kvm_para.h
34 install -D libkvm.a $(DESTDIR)/$(PREFIX)/$(LIBDIR)/libkvm.a
36 %.flat: %.o
37 $(CC) $(CFLAGS) -nostdlib -o $@ -Wl,-T,flat.lds $^
39 test/bootstrap: test/bootstrap.o
40 $(CC) -nostdlib -o $@ -Wl,-T,bootstrap.lds $^
42 %.o: %.S
43 $(CC) $(CFLAGS) -c -nostdlib -o $@ $^
45 test/irq.flat: test/print.o
47 test/access.flat: $(cstart.o) test/access.o test/printf.o test/print.o \
48 test/smp.o
50 test/sieve.flat: $(cstart.o) test/sieve.o test/print.o test/vm.o
52 test/vmexit.flat: $(cstart.o) test/vmexit.o test/printf.o test/smp.o
54 test/test32.flat: test/test32.o
56 test/smp.flat: $(cstart.o) test/smp.o test/printf.o test/smptest.o
58 test/%.o: CFLAGS += -std=gnu99 -ffreestanding
60 -include .*.d
62 clean:
63 $(RM) kvmctl *.o *.a .*.d
64 $(RM) test/bootstrap test/*.o test/*.flat test/.*.d