]> git.ipfire.org Git - thirdparty/qemu.git/blame - Makefile.target
Merge remote-tracking branch 'remotes/cleber/tags/python-next-pull-request' into...
[thirdparty/qemu.git] / Makefile.target
CommitLineData
562593aa
AL
1# -*- Mode: makefile -*-
2
6b4ad3b2
PC
3BUILD_DIR?=$(CURDIR)/..
4
deed3ccf 5include ../config-host.mak
25be210f 6include config-target.mak
17759187 7include $(SRC_PATH)/rules.mak
626df76a 8
e0e312f3
PB
9ifdef CONFIG_SOFTMMU
10include config-devices.mak
11endif
12
12a1ddc1 13$(call set-vpath, $(SRC_PATH):$(BUILD_DIR))
af2be207 14ifdef CONFIG_LINUX
67cf3f5c 15QEMU_CFLAGS += -isystem ../linux-headers
af2be207 16endif
9edc19c9 17QEMU_CFLAGS += -iquote .. -iquote $(SRC_PATH)/target/$(TARGET_BASE_ARCH) -DNEED_CPU_H
40293e58 18
9edc19c9 19QEMU_CFLAGS+=-iquote $(SRC_PATH)/include
2f28d2ff 20
40293e58
FB
21ifdef CONFIG_USER_ONLY
22# user emulator name
c1799a84 23QEMU_PROG=qemu-$(TARGET_NAME)
5c40c739 24QEMU_PROG_BUILD = $(QEMU_PROG)
40293e58 25else
1e43adfc 26# system emulator name
5c40c739 27QEMU_PROG=qemu-system-$(TARGET_NAME)$(EXESUF)
2fe47fce 28ifneq (,$(findstring -mwindows,$(SDL_LIBS)))
0fa5491e 29# Terminate program name with a 'w' because the linker builds a windows executable.
c1799a84 30QEMU_PROGW=qemu-system-$(TARGET_NAME)w$(EXESUF)
5c40c739 31$(QEMU_PROG): $(QEMU_PROGW)
0bdb12c7 32 $(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_PROG),"GEN","$(TARGET_DIR)$(QEMU_PROG)")
5c40c739
MT
33QEMU_PROG_BUILD = $(QEMU_PROGW)
34else
35QEMU_PROG_BUILD = $(QEMU_PROG)
a541f297 36endif
0fa5491e 37endif
5c40c739
MT
38
39PROGS=$(QEMU_PROG) $(QEMU_PROGW)
b8841706 40STPFILES=
626df76a 41
91880d96
JQ
42config-target.h: config-target.h-timestamp
43config-target.h-timestamp: config-target.mak
44
6c22ea9d
JM
45config-devices.h: config-devices.h-timestamp
46config-devices.h-timestamp: config-devices.mak
47
6d8a764e 48ifdef CONFIG_TRACE_SYSTEMTAP
62dd1048 49stap: $(QEMU_PROG).stp-installed $(QEMU_PROG).stp $(QEMU_PROG)-simpletrace.stp $(QEMU_PROG)-log.stp
c276b17d
DB
50
51ifdef CONFIG_USER_ONLY
52TARGET_TYPE=user
53else
54TARGET_TYPE=system
55endif
56
ed865058
DB
57tracetool-y = $(SRC_PATH)/scripts/tracetool.py
58tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py")
59
60$(QEMU_PROG).stp-installed: $(BUILD_DIR)/trace-events-all $(tracetool-y)
c0424934 61 $(call quiet-command,$(TRACETOOL) \
2098c56a 62 --group=all \
650ab98d 63 --format=stap \
5b808275 64 --backends=$(TRACE_BACKENDS) \
650ab98d 65 --binary=$(bindir)/$(QEMU_PROG) \
b9a7b74f 66 --target-name=$(TARGET_NAME) \
650ab98d 67 --target-type=$(TARGET_TYPE) \
0bc6484d 68 $< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG).stp-installed")
c14518e9 69
ed865058 70$(QEMU_PROG).stp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
c14518e9 71 $(call quiet-command,$(TRACETOOL) \
2098c56a 72 --group=all \
c14518e9 73 --format=stap \
5b808275 74 --backends=$(TRACE_BACKENDS) \
c14518e9 75 --binary=$(realpath .)/$(QEMU_PROG) \
b9a7b74f 76 --target-name=$(TARGET_NAME) \
c14518e9 77 --target-type=$(TARGET_TYPE) \
0bc6484d 78 $< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG).stp")
c14518e9 79
ed865058 80$(QEMU_PROG)-simpletrace.stp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
e0b2fd0e 81 $(call quiet-command,$(TRACETOOL) \
2098c56a 82 --group=all \
e0b2fd0e
SH
83 --format=simpletrace-stap \
84 --backends=$(TRACE_BACKENDS) \
85 --probe-prefix=qemu.$(TARGET_TYPE).$(TARGET_NAME) \
0bc6484d 86 $< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG)-simpletrace.stp")
e0b2fd0e 87
62dd1048
DB
88$(QEMU_PROG)-log.stp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
89 $(call quiet-command,$(TRACETOOL) \
90 --group=all \
91 --format=log-stap \
92 --backends=$(TRACE_BACKENDS) \
93 --probe-prefix=qemu.$(TARGET_TYPE).$(TARGET_NAME) \
94 $< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG)-log.stp")
95
c276b17d
DB
96else
97stap:
98endif
a273f4ce 99.PHONY: stap
c276b17d
DB
100
101all: $(PROGS) stap
91880d96 102
c2fb2637
PB
103# Dummy command so that make thinks it has done something
104 @true
626df76a 105
310b3fe9
PB
106obj-y += trace/
107
40293e58 108#########################################################
626df76a 109# cpu emulator library
7886cefe 110obj-y += exec.o exec-vary.o
d9bb58e5 111obj-y += accel/
db432672 112obj-$(CONFIG_TCG) += tcg/tcg.o tcg/tcg-op.o tcg/tcg-op-vec.o tcg/tcg-op-gvec.o
d2fd745f 113obj-$(CONFIG_TCG) += tcg/tcg-common.o tcg/optimize.o
8dfaf23a 114obj-$(CONFIG_TCG_INTERPRETER) += tcg/tci.o
50348333 115obj-$(CONFIG_TCG_INTERPRETER) += disas/tci.o
8f971cf0 116obj-$(CONFIG_TCG) += fpu/softfloat.o
fcf5ef2a 117obj-y += target/$(TARGET_BASE_ARCH)/
76cad711 118obj-y += disas.o
b77abd95 119obj-$(call notempty,$(TARGET_XML_FILES)) += gdbstub-xml.o
02f9135b 120LIBS := $(libs_cpu) $(LIBS)
5e8861a0 121
54cb65d8
EC
122obj-$(CONFIG_PLUGIN) += plugins/
123
40293e58
FB
124#########################################################
125# Linux user emulator target
126
127ifdef CONFIG_LINUX_USER
128
4d330cee 129QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) \
ba453780 130 -I$(SRC_PATH)/linux-user/host/$(ARCH) \
4d330cee 131 -I$(SRC_PATH)/linux-user
1c872672 132
7fc5152c 133obj-y += linux-user/
58410666 134obj-y += gdbstub.o thunk.o
40293e58 135
40293e58
FB
136endif #CONFIG_LINUX_USER
137
84778508
BS
138#########################################################
139# BSD user emulator target
140
141ifdef CONFIG_BSD_USER
142
adfc3e91
SS
143QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR) \
144 -I$(SRC_PATH)/bsd-user/$(HOST_VARIANT_DIR)
84778508 145
7fc5152c 146obj-y += bsd-user/
58410666 147obj-y += gdbstub.o
84778508 148
84778508
BS
149endif #CONFIG_BSD_USER
150
40293e58
FB
151#########################################################
152# System emulator target
76dfdd24 153ifdef CONFIG_SOFTMMU
ac057879 154obj-y += arch_init.o cpus.o gdbstub.o balloon.o ioport.o
5ddc6482 155obj-y += qtest.o
c2a87148 156obj-y += dump/
c353f261 157obj-y += hw/
e84328fa 158obj-y += monitor/
88554a20 159obj-y += qapi/
d9bb58e5 160obj-y += memory.o
c22d8e04 161obj-y += memory_mapping.o
46d702b1 162obj-y += migration/ram.o
bac068e0 163obj-y += softmmu/
7398dfc7 164LIBS := $(libs_softmmu) $(LIBS)
4fb240a4 165
a541f297 166# Hardware support
b9a7b74f 167ifeq ($(TARGET_NAME), sparc64)
5e8861a0 168obj-y += hw/sparc64/
3475187d 169else
5e8861a0 170obj-y += hw/$(TARGET_BASE_ARCH)/
9637443f
JQ
171endif
172
3dff199c 173generated-files-y += hmp-commands.h hmp-commands-info.h
6c22ea9d 174generated-files-y += config-devices.h
0e8c9214 175
76dfdd24 176endif # CONFIG_SOFTMMU
00a67ba1 177
ba1183da 178dummy := $(call unnest-vars,,obj-y)
d608cc5c 179all-obj-y := $(obj-y)
ba1183da 180
99100dc3 181include $(SRC_PATH)/Makefile.objs
cc475698 182dummy := $(call unnest-vars,.., \
5b76dd13 183 authz-obj-y \
cc475698
FZ
184 block-obj-y \
185 block-obj-m \
32d955a4 186 chardev-obj-y \
fb37726d 187 crypto-obj-y \
0c7012e0 188 qom-obj-y \
666a3af9 189 io-obj-y \
cc475698 190 common-obj-y \
675b9b53 191 common-obj-m)
d608cc5c 192all-obj-y += $(common-obj-y)
0c7012e0 193all-obj-y += $(qom-obj-y)
5b76dd13 194all-obj-$(CONFIG_SOFTMMU) += $(authz-obj-y)
32d955a4 195all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y) $(chardev-obj-y)
fb37726d 196all-obj-$(CONFIG_SOFTMMU) += $(crypto-obj-y)
666a3af9 197all-obj-$(CONFIG_SOFTMMU) += $(io-obj-y)
7fc5152c 198
e0e312f3 199ifdef CONFIG_SOFTMMU
a9ad5e1e 200$(QEMU_PROG_BUILD): config-devices.mak
e0e312f3 201endif
a9ad5e1e 202
ebedb37c 203COMMON_LDADDS = ../libqemuutil.a
0ab8ed18 204
5c40c739 205# build either PROG or PROGW
7b733862 206$(QEMU_PROG_BUILD): $(all-obj-y) $(COMMON_LDADDS) $(softmmu-main-y)
a9ad5e1e 207 $(call LINK, $(filter-out %.mak, $^))
4e34017c 208ifdef CONFIG_DARWIN
0bdb12c7
PM
209 $(call quiet-command,Rez -append $(SRC_PATH)/pc-bios/qemu.rsrc -o $@,"REZ","$(TARGET_DIR)$@")
210 $(call quiet-command,SetFile -a C $@,"SETFILE","$(TARGET_DIR)$@")
4e34017c 211endif
16394485 212
4c3b5a48 213gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh
0bdb12c7 214 $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES),"GEN","$(TARGET_DIR)$@")
56aebc89 215
077de81a 216hmp-commands.h: $(SRC_PATH)/hmp-commands.hx $(SRC_PATH)/scripts/hxtool
0bdb12c7 217 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$(TARGET_DIR)$@")
2313086a 218
077de81a 219hmp-commands-info.h: $(SRC_PATH)/hmp-commands-info.hx $(SRC_PATH)/scripts/hxtool
0bdb12c7 220 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$(TARGET_DIR)$@")
da76ee76 221
dced7eec 222clean: clean-target
b54fa7dd
PM
223 rm -f *.a *~ $(PROGS)
224 rm -f $(shell find . -name '*.[od]')
84289499 225 rm -f hmp-commands.h gdbstub-xml.c
74970d35 226 rm -f trace/generated-helpers.c trace/generated-helpers.c-timestamp
6d8a764e 227ifdef CONFIG_TRACE_SYSTEMTAP
c276b17d
DB
228 rm -f *.stp
229endif
1e43adfc 230
c621dc3e
AB
231ifdef CONFIG_FUZZ
232include $(SRC_PATH)/tests/qtest/fuzz/Makefile.include
233include $(SRC_PATH)/tests/qtest/Makefile.include
234
235fuzz: fuzz-vars
236fuzz-vars: QEMU_CFLAGS := $(FUZZ_CFLAGS) $(QEMU_CFLAGS)
237fuzz-vars: QEMU_LDFLAGS := $(FUZZ_LDFLAGS) $(QEMU_LDFLAGS)
238fuzz-vars: $(QEMU_PROG_FUZZ)
239dummy := $(call unnest-vars,, fuzz-obj-y)
240
241
242$(QEMU_PROG_FUZZ): config-devices.mak $(all-obj-y) $(COMMON_LDADDS) $(fuzz-obj-y)
243 $(call LINK, $(filter-out %.mak, $^))
244
245endif
246
5fafdf24 247install: all
9b14bb04 248ifneq ($(PROGS),)
0d659426 249 $(call install-prog,$(PROGS),$(DESTDIR)$(bindir))
9b14bb04 250endif
6d8a764e 251ifdef CONFIG_TRACE_SYSTEMTAP
6aae2a2e 252 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
c14518e9 253 $(INSTALL_DATA) $(QEMU_PROG).stp-installed "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG).stp"
e0b2fd0e 254 $(INSTALL_DATA) $(QEMU_PROG)-simpletrace.stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG)-simpletrace.stp"
62dd1048 255 $(INSTALL_DATA) $(QEMU_PROG)-log.stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG)-log.stp"
c276b17d 256endif
626df76a 257
3dff199c
LV
258generated-files-y += config-target.h
259Makefile: $(generated-files-y)
90e671a9
AB
260
261# Reports/Analysis
262#
263# The target specific coverage report only cares about target specific
264# blobs and not the shared code.
265#
266
267%/coverage-report.html:
268 @mkdir -p $*
269 $(call quiet-command,\
270 gcovr -r $(SRC_PATH) --object-directory $(CURDIR) \
271 -p --html --html-details -o $@, \
272 "GEN", "coverage-report.html")
273
274.PHONY: coverage-report
275coverage-report: $(CURDIR)/reports/coverage/coverage-report.html