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

3
include ../config-host.mak
4
include config-target.mak
5
include config-devices.mak
6
include $(SRC_PATH)/rules.mak
7

8
$(call set-vpath, $(SRC_PATH))
9 10 11
ifdef CONFIG_LINUX
QEMU_CFLAGS += -I../linux-headers
endif
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=
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 $(QEMU_PROG)-simpletrace.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 \
52
		--backends=$(TRACE_BACKENDS) \
53
		--binary=$(bindir)/$(QEMU_PROG) \
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 \
61
		--backends=$(TRACE_BACKENDS) \
62
		--binary=$(realpath .)/$(QEMU_PROG) \
63
		--target-name=$(TARGET_NAME) \
64
		--target-type=$(TARGET_TYPE) \
65
		< $< > $@,"  GEN   $(TARGET_DIR)$(QEMU_PROG).stp")
66

67 68 69 70 71 72 73
$(QEMU_PROG)-simpletrace.stp: $(SRC_PATH)/trace-events
	$(call quiet-command,$(TRACETOOL) \
		--format=simpletrace-stap \
		--backends=$(TRACE_BACKENDS) \
		--probe-prefix=qemu.$(TARGET_TYPE).$(TARGET_NAME) \
		< $< > $@,"  GEN   $(TARGET_DIR)$(QEMU_PROG)-simpletrace.stp")

74 75 76 77 78
else
stap:
endif

all: $(PROGS) stap
79

80 81
# Dummy command so that make thinks it has done something
	@true
82

83
#########################################################
84
# cpu emulator library
85
obj-y = exec.o translate-all.o cpu-exec.o
86 87
obj-y += tcg/tcg.o tcg/optimize.o
obj-$(CONFIG_TCG_INTERPRETER) += tci.o
88
obj-$(CONFIG_TCG_INTERPRETER) += disas/tci.o
89
obj-y += fpu/softfloat.o
90
obj-y += target-$(TARGET_BASE_ARCH)/
91
obj-y += disas.o
92
obj-$(call notempty,$(TARGET_XML_FILES)) += gdbstub-xml.o
93
obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
94

95 96 97 98 99 100
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

101 102 103 104 105
#########################################################
# Linux user emulator target

ifdef CONFIG_LINUX_USER

106
QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) -I$(SRC_PATH)/linux-user
107

108
obj-y += linux-user/
109
obj-y += gdbstub.o thunk.o user-exec.o
110 111 112

endif #CONFIG_LINUX_USER

113 114 115 116 117
#########################################################
# BSD user emulator target

ifdef CONFIG_BSD_USER

118 119
QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR) \
			 -I$(SRC_PATH)/bsd-user/$(HOST_VARIANT_DIR)
120

121
obj-y += bsd-user/
122
obj-y += gdbstub.o user-exec.o
123 124 125

endif #CONFIG_BSD_USER

126 127
#########################################################
# System emulator target
128
ifdef CONFIG_SOFTMMU
129
obj-y += arch_init.o cpus.o monitor.o gdbstub.o balloon.o ioport.o numa.o
130
obj-y += qtest.o bootdevice.o
131
obj-y += hw/
132
obj-$(CONFIG_FDT) += device_tree.o
133
obj-$(CONFIG_KVM) += kvm-all.o
134
obj-y += memory.o savevm.o cputlb.o
135
obj-y += memory_mapping.o
136
obj-y += dump.o
137
LIBS+=$(libs_softmmu)
bellard's avatar
bellard committed
138

139
# xen support
140 141 142 143
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
144

145
# Hardware support
146
ifeq ($(TARGET_NAME), sparc64)
147
obj-y += hw/sparc64/
bellard's avatar
bellard committed
148
else
149
obj-y += hw/$(TARGET_BASE_ARCH)/
150 151
endif

152
GENERATED_HEADERS += hmp-commands.h qmp-commands-old.h
153

154
endif # CONFIG_SOFTMMU
155

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

159
dummy := $(call unnest-vars,,obj-y)
160
all-obj-y := $(obj-y)
161

162
target-obj-y :=
163 164
block-obj-y :=
common-obj-y :=
165
include $(SRC_PATH)/Makefile.objs
166 167
dummy := $(call unnest-vars,,target-obj-y)
target-obj-y-save := $(target-obj-y)
168 169 170 171 172
dummy := $(call unnest-vars,.., \
               block-obj-y \
               block-obj-m \
               common-obj-y \
               common-obj-m)
173
target-obj-y := $(target-obj-y-save)
174
all-obj-y += $(common-obj-y)
175
all-obj-y += $(target-obj-y)
176
all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y)
177

178 179
# build either PROG or PROGW
$(QEMU_PROG_BUILD): $(all-obj-y) ../libqemuutil.a ../libqemustub.a
Lluís's avatar
Lluís committed
180
	$(call LINK,$^)
181

Blue Swirl's avatar
Blue Swirl committed
182 183
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)$@")
184

185
hmp-commands.h: $(SRC_PATH)/hmp-commands.hx
Blue Swirl's avatar
Blue Swirl committed
186
	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
187

188
qmp-commands-old.h: $(SRC_PATH)/qmp-commands.hx
Blue Swirl's avatar
Blue Swirl committed
189
	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
190

191
clean:
192 193
	rm -f *.a *~ $(PROGS)
	rm -f $(shell find . -name '*.[od]')
194
	rm -f hmp-commands.h qmp-commands-old.h gdbstub-xml.c
195
ifdef CONFIG_TRACE_SYSTEMTAP
196 197
	rm -f *.stp
endif
198

199
install: all
bellard's avatar
bellard committed
200
ifneq ($(PROGS),)
201
	$(call install-prog,$(PROGS),$(DESTDIR)$(bindir))
bellard's avatar
bellard committed
202
endif
203
ifdef CONFIG_TRACE_SYSTEMTAP
204
	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
205
	$(INSTALL_DATA) $(QEMU_PROG).stp-installed "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG).stp"
206
	$(INSTALL_DATA) $(QEMU_PROG)-simpletrace.stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG)-simpletrace.stp"
207
endif
208

209 210
GENERATED_HEADERS += config-target.h
Makefile: $(GENERATED_HEADERS)