Merge remote-tracking branch 'qemu/master'
[qemu/ar7.git] / Makefile.target
blobfd2f486bcdf0636321d08e436a6bd5519e5c3d01
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 ifeq ($(CONFIG_RUBY),y)
38 ifndef CONFIG_WIN32
39 ifneq ($(wildcard /usr/lib/ruby/1.8/i486-linux/ruby.h),)
40 CPPFLAGS += -I/usr/lib/ruby/1.8/i486-linux -DCONFIG_RUBY
41 LIBS += -lruby1.8
42 QEMU_RUBY := qemu.so
43 PROGS += $(QEMU_RUBY)
44 endif
45 endif # !CONFIG_WIN32
46 endif # CONFIG_RUBY
48 ifndef CONFIG_HAIKU
49 LIBS+=-lm
50 endif
52 config-target.h: config-target.h-timestamp
53 config-target.h-timestamp: config-target.mak
55 ifdef CONFIG_TRACE_SYSTEMTAP
56 stap: $(QEMU_PROG).stp-installed $(QEMU_PROG).stp $(QEMU_PROG)-simpletrace.stp
58 ifdef CONFIG_USER_ONLY
59 TARGET_TYPE=user
60 else
61 TARGET_TYPE=system
62 endif
64 $(QEMU_PROG).stp-installed: $(SRC_PATH)/trace-events
65         $(call quiet-command,$(TRACETOOL) \
66                 --format=stap \
67                 --backends=$(TRACE_BACKENDS) \
68                 --binary=$(bindir)/$(QEMU_PROG) \
69                 --target-name=$(TARGET_NAME) \
70                 --target-type=$(TARGET_TYPE) \
71                 < $< > $@,"  GEN   $(TARGET_DIR)$(QEMU_PROG).stp-installed")
73 $(QEMU_PROG).stp: $(SRC_PATH)/trace-events
74         $(call quiet-command,$(TRACETOOL) \
75                 --format=stap \
76                 --backends=$(TRACE_BACKENDS) \
77                 --binary=$(realpath .)/$(QEMU_PROG) \
78                 --target-name=$(TARGET_NAME) \
79                 --target-type=$(TARGET_TYPE) \
80                 < $< > $@,"  GEN   $(TARGET_DIR)$(QEMU_PROG).stp")
82 $(QEMU_PROG)-simpletrace.stp: $(SRC_PATH)/trace-events
83         $(call quiet-command,$(TRACETOOL) \
84                 --format=simpletrace-stap \
85                 --backends=$(TRACE_BACKENDS) \
86                 --probe-prefix=qemu.$(TARGET_TYPE).$(TARGET_NAME) \
87                 < $< > $@,"  GEN   $(TARGET_DIR)$(QEMU_PROG)-simpletrace.stp")
89 else
90 stap:
91 endif
93 all: $(PROGS) stap
95 # Dummy command so that make thinks it has done something
96         @true
98 #########################################################
99 # cpu emulator library
100 obj-y = exec.o translate-all.o cpu-exec.o
101 obj-y += tcg/tcg.o tcg/optimize.o
102 obj-$(CONFIG_TCG_INTERPRETER) += tci.o
103 obj-$(CONFIG_TCG_INTERPRETER) += disas/tci.o
104 obj-y += fpu/softfloat.o
105 obj-y += target-$(TARGET_BASE_ARCH)/
106 obj-y += disas.o
107 obj-$(call notempty,$(TARGET_XML_FILES)) += gdbstub-xml.o
108 obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
110 obj-$(CONFIG_LIBDECNUMBER) += libdecnumber/decContext.o
111 obj-$(CONFIG_LIBDECNUMBER) += libdecnumber/decNumber.o
112 obj-$(CONFIG_LIBDECNUMBER) += libdecnumber/dpd/decimal32.o
113 obj-$(CONFIG_LIBDECNUMBER) += libdecnumber/dpd/decimal64.o
114 obj-$(CONFIG_LIBDECNUMBER) += libdecnumber/dpd/decimal128.o
116 #########################################################
117 # Linux user emulator target
119 ifdef CONFIG_LINUX_USER
121 QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) -I$(SRC_PATH)/linux-user
123 obj-y += linux-user/
124 obj-y += gdbstub.o thunk.o user-exec.o
126 endif #CONFIG_LINUX_USER
128 #########################################################
129 # BSD user emulator target
131 ifdef CONFIG_BSD_USER
133 QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR) \
134                          -I$(SRC_PATH)/bsd-user/$(HOST_VARIANT_DIR)
136 obj-y += bsd-user/
137 obj-y += gdbstub.o user-exec.o
139 endif #CONFIG_BSD_USER
141 #########################################################
142 # System emulator target
143 ifdef CONFIG_SOFTMMU
144 obj-y += arch_init.o cpus.o monitor.o gdbstub.o balloon.o ioport.o numa.o
145 obj-y += qtest.o bootdevice.o
146 obj-y += hw/
147 obj-$(CONFIG_FDT) += device_tree.o
148 obj-$(CONFIG_KVM) += kvm-all.o
149 obj-y += memory.o savevm.o cputlb.o
150 obj-y += memory_mapping.o
151 obj-y += dump.o
152 LIBS+=$(libs_softmmu)
154 # xen support
155 obj-$(CONFIG_XEN) += xen-common.o
156 obj-$(CONFIG_XEN_I386) += xen-hvm.o xen-mapcache.o
157 obj-$(call lnot,$(CONFIG_XEN)) += xen-common-stub.o
158 obj-$(call lnot,$(CONFIG_XEN_I386)) += xen-hvm-stub.o
160 # Hardware support
161 ifeq ($(TARGET_NAME), sparc64)
162 obj-y += hw/sparc64/
163 else
164 obj-y += hw/$(TARGET_BASE_ARCH)/
165 endif
167 ifdef QEMU_RUBY
168 $(QEMU_RUBY): $(OBJS) libqemu.a
169         $(CC) -shared $(VL_LDFLAGS) -o $(QEMU_RUBY) $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
170 endif
172 GENERATED_HEADERS += hmp-commands.h qmp-commands-old.h
174 endif # CONFIG_SOFTMMU
176 # Workaround for http://gcc.gnu.org/PR55489, see configure.
177 %/translate.o: QEMU_CFLAGS += $(TRANSLATE_OPT_CFLAGS)
179 dummy := $(call unnest-vars,,obj-y)
180 all-obj-y := $(obj-y)
182 target-obj-y :=
183 block-obj-y :=
184 common-obj-y :=
185 include $(SRC_PATH)/Makefile.objs
186 dummy := $(call unnest-vars,,target-obj-y)
187 target-obj-y-save := $(target-obj-y)
188 dummy := $(call unnest-vars,.., \
189                block-obj-y \
190                block-obj-m \
191                common-obj-y \
192                common-obj-m)
193 target-obj-y := $(target-obj-y-save)
194 all-obj-y += $(common-obj-y)
195 all-obj-y += $(target-obj-y)
196 all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y)
198 # build either PROG or PROGW
199 $(QEMU_PROG_BUILD): $(all-obj-y) ../libqemuutil.a ../libqemustub.a
200         $(call LINK,$^)
202 gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh
203         $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES),"  GEN   $(TARGET_DIR)$@")
205 hmp-commands.h: $(SRC_PATH)/hmp-commands.hx
206         $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
208 qmp-commands-old.h: $(SRC_PATH)/qmp-commands.hx
209         $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
211 clean:
212         rm -f *.a *~ $(PROGS)
213         rm -f $(shell find . -name '*.[od]')
214         rm -f hmp-commands.h qmp-commands-old.h gdbstub-xml.c
215 ifdef CONFIG_TRACE_SYSTEMTAP
216         rm -f *.stp
217 endif
219 install: all
220 ifneq ($(PROGS),)
221         $(call install-prog,$(PROGS),$(DESTDIR)$(bindir))
222 endif
223 ifdef CONFIG_TRACE_SYSTEMTAP
224         $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
225         $(INSTALL_DATA) $(QEMU_PROG).stp-installed "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG).stp"
226         $(INSTALL_DATA) $(QEMU_PROG)-simpletrace.stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG)-simpletrace.stp"
227 endif
229 GENERATED_HEADERS += config-target.h
230 Makefile: $(GENERATED_HEADERS)