qapi: zero-initialize all QMP command parameters
[qemu/qmp-unstable.git] / Makefile.target
blob998604754507f3e62b1881658e81924bf789c265
1 # -*- Mode: makefile -*-
3 include ../config-host.mak
4 include config-target.mak
5 include config-devices.mak
6 include $(SRC_PATH)/rules.mak
8 $(call set-vpath, $(SRC_PATH))
9 ifdef CONFIG_LINUX
10 QEMU_CFLAGS += -I../linux-headers
11 endif
12 QEMU_CFLAGS += -I.. -I$(SRC_PATH)/target-$(TARGET_BASE_ARCH) -DNEED_CPU_H
14 QEMU_CFLAGS+=-I$(SRC_PATH)/include
16 ifdef CONFIG_USER_ONLY
17 # user emulator name
18 QEMU_PROG=qemu-$(TARGET_NAME)
19 QEMU_PROG_BUILD = $(QEMU_PROG)
20 else
21 # system emulator name
22 QEMU_PROG=qemu-system-$(TARGET_NAME)$(EXESUF)
23 ifneq (,$(findstring -mwindows,$(libs_softmmu)))
24 # Terminate program name with a 'w' because the linker builds a windows executable.
25 QEMU_PROGW=qemu-system-$(TARGET_NAME)w$(EXESUF)
26 $(QEMU_PROG): $(QEMU_PROGW)
27         $(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_PROG),"  GEN   $(TARGET_DIR)$(QEMU_PROG)")
28 QEMU_PROG_BUILD = $(QEMU_PROGW)
29 else
30 QEMU_PROG_BUILD = $(QEMU_PROG)
31 endif
32 endif
34 PROGS=$(QEMU_PROG) $(QEMU_PROGW)
35 STPFILES=
37 config-target.h: config-target.h-timestamp
38 config-target.h-timestamp: config-target.mak
40 ifdef CONFIG_TRACE_SYSTEMTAP
41 stap: $(QEMU_PROG).stp-installed $(QEMU_PROG).stp
43 ifdef CONFIG_USER_ONLY
44 TARGET_TYPE=user
45 else
46 TARGET_TYPE=system
47 endif
49 $(QEMU_PROG).stp-installed: $(SRC_PATH)/trace-events
50         $(call quiet-command,$(TRACETOOL) \
51                 --format=stap \
52                 --backend=$(TRACE_BACKEND) \
53                 --binary=$(bindir)/$(QEMU_PROG) \
54                 --target-name=$(TARGET_NAME) \
55                 --target-type=$(TARGET_TYPE) \
56                 < $< > $@,"  GEN   $(TARGET_DIR)$(QEMU_PROG).stp-installed")
58 $(QEMU_PROG).stp: $(SRC_PATH)/trace-events
59         $(call quiet-command,$(TRACETOOL) \
60                 --format=stap \
61                 --backend=$(TRACE_BACKEND) \
62                 --binary=$(realpath .)/$(QEMU_PROG) \
63                 --target-name=$(TARGET_NAME) \
64                 --target-type=$(TARGET_TYPE) \
65                 < $< > $@,"  GEN   $(TARGET_DIR)$(QEMU_PROG).stp")
67 else
68 stap:
69 endif
71 all: $(PROGS) stap
73 # Dummy command so that make thinks it has done something
74         @true
76 #########################################################
77 # cpu emulator library
78 obj-y = exec.o translate-all.o cpu-exec.o
79 obj-y += tcg/tcg.o tcg/optimize.o
80 obj-$(CONFIG_TCG_INTERPRETER) += tci.o
81 obj-$(CONFIG_TCG_INTERPRETER) += disas/tci.o
82 obj-y += fpu/softfloat.o
83 obj-y += target-$(TARGET_BASE_ARCH)/
84 obj-y += disas.o
85 obj-$(call notempty,$(TARGET_XML_FILES)) += gdbstub-xml.o
86 obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
88 #########################################################
89 # Linux user emulator target
91 ifdef CONFIG_LINUX_USER
93 QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) -I$(SRC_PATH)/linux-user
95 obj-y += linux-user/
96 obj-y += gdbstub.o thunk.o user-exec.o
98 endif #CONFIG_LINUX_USER
100 #########################################################
101 # BSD user emulator target
103 ifdef CONFIG_BSD_USER
105 QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR)
107 obj-y += bsd-user/
108 obj-y += gdbstub.o user-exec.o
110 endif #CONFIG_BSD_USER
112 #########################################################
113 # System emulator target
114 ifdef CONFIG_SOFTMMU
115 obj-y += arch_init.o cpus.o monitor.o gdbstub.o balloon.o ioport.o
116 obj-y += qtest.o
117 obj-y += hw/
118 obj-$(CONFIG_FDT) += device_tree.o
119 obj-$(CONFIG_KVM) += kvm-all.o
120 obj-y += memory.o savevm.o cputlb.o
121 obj-y += memory_mapping.o
122 obj-y += dump.o
123 LIBS+=$(libs_softmmu)
125 # xen support
126 obj-$(CONFIG_XEN) += xen-common.o
127 obj-$(CONFIG_XEN_I386) += xen-hvm.o xen-mapcache.o
128 obj-$(call lnot,$(CONFIG_XEN)) += xen-common-stub.o
129 obj-$(call lnot,$(CONFIG_XEN_I386)) += xen-hvm-stub.o
131 # Hardware support
132 ifeq ($(TARGET_NAME), sparc64)
133 obj-y += hw/sparc64/
134 else
135 obj-y += hw/$(TARGET_BASE_ARCH)/
136 endif
138 GENERATED_HEADERS += hmp-commands.h qmp-commands-old.h
140 endif # CONFIG_SOFTMMU
142 # Workaround for http://gcc.gnu.org/PR55489, see configure.
143 %/translate.o: QEMU_CFLAGS += $(TRANSLATE_OPT_CFLAGS)
145 dummy := $(call unnest-vars,,obj-y)
146 all-obj-y := $(obj-y)
148 block-obj-y :=
149 common-obj-y :=
150 include $(SRC_PATH)/Makefile.objs
151 dummy := $(call unnest-vars,.., \
152                block-obj-y \
153                block-obj-m \
154                common-obj-y \
155                common-obj-m)
156 all-obj-y += $(common-obj-y)
157 all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y)
159 ifndef CONFIG_HAIKU
160 LIBS+=-lm
161 endif
163 # build either PROG or PROGW
164 $(QEMU_PROG_BUILD): $(all-obj-y) ../libqemuutil.a ../libqemustub.a
165         $(call LINK,$^)
167 gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh
168         $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES),"  GEN   $(TARGET_DIR)$@")
170 hmp-commands.h: $(SRC_PATH)/hmp-commands.hx
171         $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
173 qmp-commands-old.h: $(SRC_PATH)/qmp-commands.hx
174         $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
176 clean:
177         rm -f *.a *~ $(PROGS)
178         rm -f $(shell find . -name '*.[od]')
179         rm -f hmp-commands.h qmp-commands-old.h gdbstub-xml.c
180 ifdef CONFIG_TRACE_SYSTEMTAP
181         rm -f *.stp
182 endif
184 install: all
185 ifneq ($(PROGS),)
186         $(INSTALL_PROG) $(PROGS) "$(DESTDIR)$(bindir)"
187 ifneq ($(STRIP),)
188         $(STRIP) $(PROGS:%="$(DESTDIR)$(bindir)/%")
189 endif
190 endif
191 ifdef CONFIG_TRACE_SYSTEMTAP
192         $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
193         $(INSTALL_DATA) $(QEMU_PROG).stp-installed "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG).stp"
194 endif
196 GENERATED_HEADERS += config-target.h
197 Makefile: $(GENERATED_HEADERS)