block: Check bdrv_getlength() return value in bdrv_append_temp_snapshot()
[qemu/ar7.git] / Makefile.target
blobba1234063eae2c453eedc53ec00372d9e6fc102d
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 else
20 # system emulator name
21 ifneq (,$(findstring -mwindows,$(libs_softmmu)))
22 # Terminate program name with a 'w' because the linker builds a windows executable.
23 QEMU_PROGW=qemu-system-$(TARGET_NAME)w$(EXESUF)
24 endif # windows executable
25 QEMU_PROG=qemu-system-$(TARGET_NAME)$(EXESUF)
26 endif
28 PROGS=$(QEMU_PROG)
29 ifdef QEMU_PROGW
30 PROGS+=$(QEMU_PROGW)
31 endif
32 STPFILES=
34 config-target.h: config-target.h-timestamp
35 config-target.h-timestamp: config-target.mak
37 ifdef CONFIG_TRACE_SYSTEMTAP
38 stap: $(QEMU_PROG).stp-installed $(QEMU_PROG).stp
40 ifdef CONFIG_USER_ONLY
41 TARGET_TYPE=user
42 else
43 TARGET_TYPE=system
44 endif
46 $(QEMU_PROG).stp-installed: $(SRC_PATH)/trace-events
47         $(call quiet-command,$(TRACETOOL) \
48                 --format=stap \
49                 --backend=$(TRACE_BACKEND) \
50                 --binary=$(bindir)/$(QEMU_PROG) \
51                 --target-name=$(TARGET_NAME) \
52                 --target-type=$(TARGET_TYPE) \
53                 < $< > $@,"  GEN   $(TARGET_DIR)$(QEMU_PROG).stp-installed")
55 $(QEMU_PROG).stp: $(SRC_PATH)/trace-events
56         $(call quiet-command,$(TRACETOOL) \
57                 --format=stap \
58                 --backend=$(TRACE_BACKEND) \
59                 --binary=$(realpath .)/$(QEMU_PROG) \
60                 --target-name=$(TARGET_NAME) \
61                 --target-type=$(TARGET_TYPE) \
62                 < $< > $@,"  GEN   $(TARGET_DIR)$(QEMU_PROG).stp")
64 else
65 stap:
66 endif
68 all: $(PROGS) stap
70 # Dummy command so that make thinks it has done something
71         @true
73 #########################################################
74 # cpu emulator library
75 obj-y = exec.o translate-all.o cpu-exec.o
76 obj-y += tcg/tcg.o tcg/optimize.o
77 obj-$(CONFIG_TCG_INTERPRETER) += tci.o
78 obj-$(CONFIG_TCG_INTERPRETER) += disas/tci.o
79 obj-y += fpu/softfloat.o
80 obj-y += target-$(TARGET_BASE_ARCH)/
81 obj-y += disas.o
82 obj-$(call notempty,$(TARGET_XML_FILES)) += gdbstub-xml.o
83 obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
85 #########################################################
86 # Linux user emulator target
88 ifdef CONFIG_LINUX_USER
90 QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) -I$(SRC_PATH)/linux-user
92 obj-y += linux-user/
93 obj-y += gdbstub.o thunk.o user-exec.o
95 endif #CONFIG_LINUX_USER
97 #########################################################
98 # BSD user emulator target
100 ifdef CONFIG_BSD_USER
102 QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR)
104 obj-y += bsd-user/
105 obj-y += gdbstub.o user-exec.o
107 endif #CONFIG_BSD_USER
109 #########################################################
110 # System emulator target
111 ifdef CONFIG_SOFTMMU
112 obj-y += arch_init.o cpus.o monitor.o gdbstub.o balloon.o ioport.o
113 obj-y += qtest.o
114 obj-y += hw/
115 obj-$(CONFIG_FDT) += device_tree.o
116 obj-$(CONFIG_KVM) += kvm-all.o
117 obj-y += memory.o savevm.o cputlb.o
118 obj-y += memory_mapping.o
119 obj-y += dump.o
120 LIBS+=$(libs_softmmu)
122 # xen support
123 obj-$(CONFIG_XEN) += xen-all.o xen-mapcache.o
124 obj-$(call lnot,$(CONFIG_XEN)) += xen-stub.o
126 # Hardware support
127 ifeq ($(TARGET_NAME), sparc64)
128 obj-y += hw/sparc64/
129 else
130 obj-y += hw/$(TARGET_BASE_ARCH)/
131 endif
133 GENERATED_HEADERS += hmp-commands.h qmp-commands-old.h
135 endif # CONFIG_SOFTMMU
137 # Workaround for http://gcc.gnu.org/PR55489, see configure.
138 %/translate.o: QEMU_CFLAGS += $(TRANSLATE_OPT_CFLAGS)
140 dummy := $(call unnest-vars,,obj-y)
142 # we are making another call to unnest-vars with different vars, protect obj-y,
143 # it can be overriden in subdir Makefile.objs
144 obj-y-save := $(obj-y)
146 block-obj-y :=
147 common-obj-y :=
148 include $(SRC_PATH)/Makefile.objs
149 dummy := $(call unnest-vars,.., \
150                block-obj-y \
151                block-obj-m \
152                common-obj-y \
153                common-obj-m)
155 # Now restore obj-y
156 obj-y := $(obj-y-save)
158 all-obj-y = $(obj-y) $(common-obj-y)
159 all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y)
161 ifndef CONFIG_HAIKU
162 LIBS+=-lm
163 endif
165 ifdef QEMU_PROGW
166 # The linker builds a windows executable. Make also a console executable.
167 $(QEMU_PROGW): $(all-obj-y) ../libqemuutil.a ../libqemustub.a
168         $(call LINK,$^)
169 $(QEMU_PROG): $(QEMU_PROGW)
170         $(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_PROG),"  GEN   $(TARGET_DIR)$(QEMU_PROG)")
171 else
172 $(QEMU_PROG): $(all-obj-y) ../libqemuutil.a ../libqemustub.a
173         $(call LINK,$^)
174 endif
176 gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh
177         $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES),"  GEN   $(TARGET_DIR)$@")
179 hmp-commands.h: $(SRC_PATH)/hmp-commands.hx
180         $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
182 qmp-commands-old.h: $(SRC_PATH)/qmp-commands.hx
183         $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
185 clean:
186         rm -f *.a *~ $(PROGS)
187         rm -f $(shell find . -name '*.[od]')
188         rm -f hmp-commands.h qmp-commands-old.h gdbstub-xml.c
189 ifdef CONFIG_TRACE_SYSTEMTAP
190         rm -f *.stp
191 endif
193 install: all
194 ifneq ($(PROGS),)
195         $(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)"
196 ifneq ($(STRIP),)
197         $(STRIP) $(patsubst %,"$(DESTDIR)$(bindir)/%",$(PROGS))
198 endif
199 endif
200 ifdef CONFIG_TRACE_SYSTEMTAP
201         $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
202         $(INSTALL_DATA) $(QEMU_PROG).stp-installed "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG).stp"
203 endif
205 GENERATED_HEADERS += config-target.h
206 Makefile: $(GENERATED_HEADERS)