2 # Define WERROR=0 to disable -Werror.
14 include config
/utilities.mak
15 include config
/feature-tests.mak
23 GUEST_INIT
:= guest
/init
25 OBJS
+= builtin-balloon.o
26 OBJS
+= builtin-debug.o
27 OBJS
+= builtin-help.o
28 OBJS
+= builtin-list.o
29 OBJS
+= builtin-stat.o
30 OBJS
+= builtin-pause.o
31 OBJS
+= builtin-resume.o
33 OBJS
+= builtin-setup.o
34 OBJS
+= builtin-stop.o
35 OBJS
+= builtin-version.o
39 OBJS
+= guest_compat.o
53 OBJS
+= virtio
/console.o
57 OBJS
+= virtio
/balloon.o
64 OBJS
+= net
/uip
/core.o
66 OBJS
+= net
/uip
/icmp.o
67 OBJS
+= net
/uip
/ipv4.o
71 OBJS
+= net
/uip
/csum.o
72 OBJS
+= net
/uip
/dhcp.o
77 OBJS
+= util
/parse-options.o
78 OBJS
+= util
/rbtree-interval.o
81 OBJS
+= virtio
/9p-pdu.o
84 OBJS
+= hw
/pci-shmem.o
86 FLAGS_BFD
:= $(CFLAGS
) -lbfd
87 has_bfd
:= $(call try-cc
,$(SOURCE_BFD
),$(FLAGS_BFD
))
89 CFLAGS
+= -DCONFIG_HAS_BFD
94 FLAGS_VNCSERVER
:= $(CFLAGS
) -lvncserver
95 has_vncserver
:= $(call try-cc
,$(SOURCE_VNCSERVER
),$(FLAGS_VNCSERVER
))
96 ifeq ($(has_vncserver
),y
)
98 CFLAGS
+= -DCONFIG_HAS_VNCSERVER
102 FLAGS_SDL
:= $(CFLAGS
) -lSDL
103 has_SDL
:= $(call try-cc
,$(SOURCE_SDL
),$(FLAGS_SDL
))
106 CFLAGS
+= -DCONFIG_HAS_SDL
110 DEPS
:= $(patsubst %.o
,%.d
,$(OBJS
))
112 # Exclude BIOS object files from header dependencies.
114 OBJS
+= bios
/bios-rom.o
119 # Additional ARCH settings for x86
120 ARCH ?
= $(shell echo
$(uname_M
) | sed
-e s
/i
.86/i386
/ -e s
/sun4u
/sparc64
/ \
121 -e s
/arm.
*/arm
/ -e s
/sa110
/arm
/ \
122 -e s
/s390x
/s390
/ -e s
/parisc64
/parisc
/ \
123 -e s
/ppc.
*/powerpc
/ -e s
/mips.
*/mips
/ \
126 uname_M
:= $(shell uname
-m | sed
-e s
/i
.86/i386
/)
127 ifeq ($(uname_M
),i386
)
129 DEFINES
+= -DCONFIG_X86_32
131 ifeq ($(uname_M
),x86_64
)
133 DEFINES
+= -DCONFIG_X86_64
136 DEFINES
+= -D_FILE_OFFSET_BITS
=64
137 DEFINES
+= -D_GNU_SOURCE
138 DEFINES
+= -DKVMTOOLS_VERSION
='"$(KVMTOOLS_VERSION)"'
140 KVM_INCLUDE
:= include
141 CFLAGS
+= $(CPPFLAGS
) $(DEFINES
) -I
$(KVM_INCLUDE
) -I..
/..
/include -I..
/..
/arch
/$(ARCH
)/include/ -Os
-g
148 WARNINGS
+= -Wcast-align
149 WARNINGS
+= -Wformat
=2
150 WARNINGS
+= -Winit-self
151 WARNINGS
+= -Wmissing-declarations
152 WARNINGS
+= -Wmissing-prototypes
153 WARNINGS
+= -Wnested-externs
154 WARNINGS
+= -Wno-system-headers
155 WARNINGS
+= -Wold-style-definition
156 WARNINGS
+= -Wredundant-decls
157 WARNINGS
+= -Wsign-compare
158 WARNINGS
+= -Wstrict-prototypes
160 WARNINGS
+= -Wvolatile-register-var
161 WARNINGS
+= -Wwrite-strings
162 WARNINGS
+= -Wunused-result
164 CFLAGS
+= $(WARNINGS
)
166 all: $(PROGRAM
) $(GUEST_INIT
)
168 KVMTOOLS-VERSION-FILE
:
169 @
$(SHELL_PATH
) util
/KVMTOOLS-VERSION-GEN
$(OUTPUT
)
170 -include $(OUTPUT
)KVMTOOLS-VERSION-FILE
172 $(PROGRAM
): $(DEPS
) $(OBJS
)
174 $(Q
) $(CC
) $(OBJS
) $(LIBS
) -o
$@
176 $(GUEST_INIT
): guest
/init.c
178 $(Q
) $(CC
) -static guest
/init.c
-o
$@
183 $(Q
) $(CC
) -M
-MT
$(patsubst %.d
,%.o
,$@
) $(CFLAGS
) $< -o
$@
185 # The header file common-cmds.h is needed for compilation of builtin-help.c.
186 builtin-help.d
: $(KVM_INCLUDE
)/common-cmds.h
190 rbtree.o
: ..
/..
/lib
/rbtree.c
191 $(Q
) $(CC
) -c
$(CFLAGS
) $< -o
$@
195 $(Q
) $(CC
) -c
$(CFLAGS
) $< -o
$@
198 $(KVM_INCLUDE
)/common-cmds.h
: util
/generate-cmdlist.sh command-list.txt
200 $(KVM_INCLUDE
)/common-cmds.h
: $(wildcard Documentation
/kvm-
*.txt
)
202 $(Q
) util
/generate-cmdlist.sh
> $@
+ && mv
$@
+ $@
205 # BIOS assembly weirdness
208 BIOS_CFLAGS
+= -march
=i386
209 BIOS_CFLAGS
+= -mregparm
=3
211 bios.o
: bios
/bios.bin bios
/bios-rom.h
213 bios
/bios.bin.elf
: bios
/entry.S bios
/e820.c bios
/int10.c bios
/int15.c bios
/rom.
ld.S
214 $(E
) " CC bios/e820.o"
215 $(Q
) $(CC
) -include code16gcc.h
$(CFLAGS
) $(BIOS_CFLAGS
) -c
-s bios
/e820.c
-o bios
/e820.o
216 $(E
) " CC bios/int10.o"
217 $(Q
) $(CC
) -include code16gcc.h
$(CFLAGS
) $(BIOS_CFLAGS
) -c
-s bios
/int10.c
-o bios
/int10.o
218 $(E
) " CC bios/int15.o"
219 $(Q
) $(CC
) -include code16gcc.h
$(CFLAGS
) $(BIOS_CFLAGS
) -c
-s bios
/int15.c
-o bios
/int15.o
220 $(E
) " CC bios/entry.o"
221 $(Q
) $(CC
) $(CFLAGS
) $(BIOS_CFLAGS
) -c
-s bios
/entry.S
-o bios
/entry.o
223 $(Q
) ld -T bios
/rom.
ld.S
-o bios
/bios.bin.elf bios
/entry.o bios
/e820.o bios
/int10.o bios
/int15.o
225 bios
/bios.bin
: bios
/bios.bin.elf
227 $(Q
) objcopy
-O binary
-j .text bios
/bios.bin.elf bios
/bios.bin
229 bios
/bios-rom.o
: bios
/bios-rom.S bios
/bios.bin bios
/bios-rom.h
231 $(Q
) $(CC
) -c
$(CFLAGS
) bios
/bios-rom.S
-o bios
/bios-rom.o
233 bios
/bios-rom.h
: bios
/bios.bin.elf
235 $(Q
) cd bios
&& sh gen-offsets.sh
> bios-rom.h
&& cd ..
239 .
/$(PROGRAM
) run tests
/pit
/tick.bin
240 .
/$(PROGRAM
) run
-d tests
/boot
/boot_test.iso
-p
"init=init"
245 $(Q
) rm -f bios
/*.bin
246 $(Q
) rm -f bios
/*.elf
248 $(Q
) rm -f bios
/bios-rom.h
249 $(Q
) rm -f tests
/boot
/boot_test.iso
250 $(Q
) rm -rf tests
/boot
/rootfs
/
251 $(Q
) rm -f
$(DEPS
) $(OBJS
) $(PROGRAM
) $(GUEST_INIT
)
253 $(Q
) rm -f
$(KVM_INCLUDE
)/common-cmds.h
254 $(Q
) rm -f KVMTOOLS-VERSION-FILE
261 $(Q
) mknod
$@ char
10 232
269 $(Q
) $(FIND
) .
-name
'*.[hcS]' -print | xargs etags
-a
275 $(Q
) $(FIND
) .
-name
'*.[hcS]' -print | xargs ctags
-a
280 $(Q
) $(FIND
) .
-name
'*.[hcS]' -print > cscope.files