Makefile.target 5.5 KB
Newer Older
1 2
# -*- Mode: makefile -*-

3
include ../config-host.mak
4
include config-target.mak
5
include config-devices.mak
A
aliguori 已提交
6
include $(SRC_PATH)/rules.mak
B
bellard 已提交
7

P
Paolo Bonzini 已提交
8
$(call set-vpath, $(SRC_PATH))
9 10 11
ifdef CONFIG_LINUX
QEMU_CFLAGS += -I../linux-headers
endif
P
Paolo Bonzini 已提交
12
QEMU_CFLAGS += -I.. -I$(SRC_PATH)/target-$(TARGET_BASE_ARCH) -DNEED_CPU_H
13

14 15
QEMU_CFLAGS+=-I$(SRC_PATH)/include

16 17
ifdef CONFIG_USER_ONLY
# 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 27 28 29 30
$(QEMU_PROG): $(QEMU_PROGW)
	$(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_PROG),"  GEN   $(TARGET_DIR)$(QEMU_PROG)")
QEMU_PROG_BUILD = $(QEMU_PROGW)
else
QEMU_PROG_BUILD = $(QEMU_PROG)
31
endif
32
endif
33 34

PROGS=$(QEMU_PROG) $(QEMU_PROGW)
35
STPFILES=
B
bellard 已提交
36

37 38 39
config-target.h: config-target.h-timestamp
config-target.h-timestamp: config-target.mak

40
ifdef CONFIG_TRACE_SYSTEMTAP
41
stap: $(QEMU_PROG).stp-installed $(QEMU_PROG).stp
42 43 44 45 46 47 48

ifdef CONFIG_USER_ONLY
TARGET_TYPE=user
else
TARGET_TYPE=system
endif

49
$(QEMU_PROG).stp-installed: $(SRC_PATH)/trace-events
50
	$(call quiet-command,$(TRACETOOL) \
51
		--format=stap \
L
Lluís Vilanova 已提交
52
		--backends=$(TRACE_BACKENDS) \
53
		--binary=$(bindir)/$(QEMU_PROG) \
P
Paolo Bonzini 已提交
54
		--target-name=$(TARGET_NAME) \
55
		--target-type=$(TARGET_TYPE) \
56 57 58 59 60
		< $< > $@,"  GEN   $(TARGET_DIR)$(QEMU_PROG).stp-installed")

$(QEMU_PROG).stp: $(SRC_PATH)/trace-events
	$(call quiet-command,$(TRACETOOL) \
		--format=stap \
L
Lluís Vilanova 已提交
61
		--backends=$(TRACE_BACKENDS) \
62
		--binary=$(realpath .)/$(QEMU_PROG) \
P
Paolo Bonzini 已提交
63
		--target-name=$(TARGET_NAME) \
64
		--target-type=$(TARGET_TYPE) \
65
		< $< > $@,"  GEN   $(TARGET_DIR)$(QEMU_PROG).stp")
66

67 68 69 70 71
else
stap:
endif

all: $(PROGS) stap
72

P
Paul Brook 已提交
73 74
# Dummy command so that make thinks it has done something
	@true
B
bellard 已提交
75

76
#########################################################
B
bellard 已提交
77
# cpu emulator library
78
obj-y = exec.o translate-all.o cpu-exec.o
79 80
obj-y += tcg/tcg.o tcg/optimize.o
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
87

88 89 90 91 92 93
obj-$(CONFIG_LIBDECNUMBER) += libdecnumber/decContext.o
obj-$(CONFIG_LIBDECNUMBER) += libdecnumber/decNumber.o
obj-$(CONFIG_LIBDECNUMBER) += libdecnumber/dpd/decimal32.o
obj-$(CONFIG_LIBDECNUMBER) += libdecnumber/dpd/decimal64.o
obj-$(CONFIG_LIBDECNUMBER) += libdecnumber/dpd/decimal128.o

94 95 96 97 98
#########################################################
# Linux user emulator target

ifdef CONFIG_LINUX_USER

99
QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) -I$(SRC_PATH)/linux-user
100

101
obj-y += linux-user/
102
obj-y += gdbstub.o thunk.o user-exec.o
103 104 105

endif #CONFIG_LINUX_USER

B
blueswir1 已提交
106 107 108 109 110
#########################################################
# BSD user emulator target

ifdef CONFIG_BSD_USER

111 112
QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR) \
			 -I$(SRC_PATH)/bsd-user/$(HOST_VARIANT_DIR)
B
blueswir1 已提交
113

114
obj-y += bsd-user/
115
obj-y += gdbstub.o user-exec.o
B
blueswir1 已提交
116 117 118

endif #CONFIG_BSD_USER

119 120
#########################################################
# System emulator target
121
ifdef CONFIG_SOFTMMU
122
obj-y += arch_init.o cpus.o monitor.o gdbstub.o balloon.o ioport.o numa.o
A
Andreas Färber 已提交
123
obj-y += qtest.o
124
obj-y += hw/
125
obj-$(CONFIG_FDT) += device_tree.o
126
obj-$(CONFIG_KVM) += kvm-all.o
127
obj-y += memory.o savevm.o cputlb.o
128
obj-y += memory_mapping.o
129
obj-y += dump.o
130
LIBS+=$(libs_softmmu)
B
bellard 已提交
131

A
Anthony PERARD 已提交
132
# xen support
W
Wei Liu 已提交
133 134 135 136
obj-$(CONFIG_XEN) += xen-common.o
obj-$(CONFIG_XEN_I386) += xen-hvm.o xen-mapcache.o
obj-$(call lnot,$(CONFIG_XEN)) += xen-common-stub.o
obj-$(call lnot,$(CONFIG_XEN_I386)) += xen-hvm-stub.o
A
Anthony PERARD 已提交
137

138
# Hardware support
P
Paolo Bonzini 已提交
139
ifeq ($(TARGET_NAME), sparc64)
140
obj-y += hw/sparc64/
B
bellard 已提交
141
else
142
obj-y += hw/$(TARGET_BASE_ARCH)/
143 144
endif

145
GENERATED_HEADERS += hmp-commands.h qmp-commands-old.h
146

147
endif # CONFIG_SOFTMMU
148

149 150 151
# Workaround for http://gcc.gnu.org/PR55489, see configure.
%/translate.o: QEMU_CFLAGS += $(TRANSLATE_OPT_CFLAGS)

152
dummy := $(call unnest-vars,,obj-y)
153
all-obj-y := $(obj-y)
154 155 156

block-obj-y :=
common-obj-y :=
157
include $(SRC_PATH)/Makefile.objs
158 159 160 161 162
dummy := $(call unnest-vars,.., \
               block-obj-y \
               block-obj-m \
               common-obj-y \
               common-obj-m)
163
all-obj-y += $(common-obj-y)
164
all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y)
165

166 167
# build either PROG or PROGW
$(QEMU_PROG_BUILD): $(all-obj-y) ../libqemuutil.a ../libqemustub.a
L
Lluís 已提交
168
	$(call LINK,$^)
169

B
Blue Swirl 已提交
170 171
gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh
	$(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES),"  GEN   $(TARGET_DIR)$@")
P
pbrook 已提交
172

173
hmp-commands.h: $(SRC_PATH)/hmp-commands.hx
B
Blue Swirl 已提交
174
	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
175

176
qmp-commands-old.h: $(SRC_PATH)/qmp-commands.hx
B
Blue Swirl 已提交
177
	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
178

B
bellard 已提交
179
clean:
180 181
	rm -f *.a *~ $(PROGS)
	rm -f $(shell find . -name '*.[od]')
182
	rm -f hmp-commands.h qmp-commands-old.h gdbstub-xml.c
183
ifdef CONFIG_TRACE_SYSTEMTAP
184 185
	rm -f *.stp
endif
186

187
install: all
B
bellard 已提交
188
ifneq ($(PROGS),)
189
	$(call install-prog,$(PROGS),$(DESTDIR)$(bindir))
B
bellard 已提交
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
B
bellard 已提交
195

196 197
GENERATED_HEADERS += config-target.h
Makefile: $(GENERATED_HEADERS)