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
, "")
15 CXXFLAGS
= $(autodepend-flags
)
17 autodepend-flags
= -MMD
-MF
$(dir $*).
$(notdir $*).d
21 ifeq ($(shell uname
-m
), x86_64
)
23 cstart.o
= test/cstart64.o
28 cstart.o
= test/cstart.o
33 all: kvmctl libkvm.a flatfiles
35 kvmctl
: kvmctl.o main.o
37 balloon_ctl
: balloon_ctl.o
42 flatfiles-common
= test/simple.flat
test/stringio.flat
test/memtest1.flat \
43 test/bootstrap
test/vmexit.flat
47 flatfiles-64
= test/access.flat
test/irq.flat
test/sieve.flat
49 flatfiles
: $(flatfiles-common
) $(flatfiles-
$(bits
))
52 install -D kvmctl.h
$(DESTDIR
)/$(PREFIX
)/include/kvmctl.h
53 install -D
$(KERNELDIR
)/include/linux
/kvm.h \
54 $(DESTDIR
)/$(PREFIX
)/include/linux
/kvm.h
55 install -D libkvm.a
$(DESTDIR
)/$(PREFIX
)/$(LIBDIR
)/libkvm.a
58 gcc
$(CFLAGS
) -nostdlib
-o
$@
-Wl
,-T
,flat.lds
$^
60 test/bootstrap
: test/bootstrap.o
61 gcc
-nostdlib
-o
$@
-Wl
,-T
,bootstrap.lds
$^
64 gcc
$(CFLAGS
) -c
-nostdlib
-o
$@
$^
66 test/irq.flat
: test/print.o
68 test/access.flat
: $(cstart.o
) test/access.o
test/printf.o
test/print.o
70 test/sieve.flat
: $(cstart.o
) test/sieve.o
test/print.o
test/vm.o
72 test/vmexit.flat
: $(cstart.o
) test/vmexit.o
test/printf.o
74 test/test32.flat
: test/test32.o
76 test/%.o
: CFLAGS
+= -std
=gnu99
-ffreestanding
81 $(RM
) kvmctl
*.o
*.a .
*.d
82 $(RM
) test/bootstrap
test/*.o
test/*.flat
test/.
*.d