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 \
12 CFLAGS
+= $(call cc-option
, -fno-stack-protector
, "")
13 CFLAGS
+= $(call cc-option
, -fno-stack-protector-all
, "")
17 CXXFLAGS
= $(autodepend-flags
)
19 autodepend-flags
= -MMD
-MF
$(dir $*).
$(notdir $*).d
23 ifeq ($(shell uname
-m
), x86_64
)
25 cstart.o
= test/cstart64.o
30 cstart.o
= test/cstart.o
35 all: kvmctl libkvm.a flatfiles
37 kvmctl
: LDFLAGS
+= -pthread
-lrt
39 kvmctl
: kvmctl.o main.o
41 balloon_ctl
: balloon_ctl.o
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
))
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
61 gcc
$(CFLAGS
) -nostdlib
-o
$@
-Wl
,-T
,flat.lds
$^
63 test/bootstrap
: test/bootstrap.o
64 gcc
-nostdlib
-o
$@
-Wl
,-T
,bootstrap.lds
$^
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
86 $(RM
) kvmctl
*.o
*.a .
*.d
87 $(RM
) test/bootstrap
test/*.o
test/*.flat
test/.
*.d