Makefile.target 5.3 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
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
B
bellard 已提交
27

28
PROGS=$(QEMU_PROG)
29 30 31
ifdef QEMU_PROGW
PROGS+=$(QEMU_PROGW)
endif
32
STPFILES=
B
bellard 已提交
33

34 35 36
config-target.h: config-target.h-timestamp
config-target.h-timestamp: config-target.mak

37
ifdef CONFIG_TRACE_SYSTEMTAP
38
stap: $(QEMU_PROG).stp-installed $(QEMU_PROG).stp
39 40 41 42 43 44 45

ifdef CONFIG_USER_ONLY
TARGET_TYPE=user
else
TARGET_TYPE=system
endif

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

$(QEMU_PROG).stp: $(SRC_PATH)/trace-events
	$(call quiet-command,$(TRACETOOL) \
		--format=stap \
		--backend=$(TRACE_BACKEND) \
		--binary=$(realpath .)/$(QEMU_PROG) \
P
Paolo Bonzini 已提交
60
		--target-name=$(TARGET_NAME) \
61
		--target-type=$(TARGET_TYPE) \
62
		< $< > $@,"  GEN   $(TARGET_DIR)$(QEMU_PROG).stp")
63

64 65 66 67 68
else
stap:
endif

all: $(PROGS) stap
69

P
Paul Brook 已提交
70 71
# Dummy command so that make thinks it has done something
	@true
B
bellard 已提交
72

73
#########################################################
B
bellard 已提交
74
# cpu emulator library
75
obj-y = exec.o translate-all.o cpu-exec.o
76 77
obj-y += tcg/tcg.o tcg/optimize.o
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
84

85 86 87 88 89
#########################################################
# Linux user emulator target

ifdef CONFIG_LINUX_USER

90
QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) -I$(SRC_PATH)/linux-user
91

92
obj-y += linux-user/
93
obj-y += gdbstub.o thunk.o user-exec.o
94 95 96

endif #CONFIG_LINUX_USER

B
blueswir1 已提交
97 98 99 100 101
#########################################################
# BSD user emulator target

ifdef CONFIG_BSD_USER

P
Paolo Bonzini 已提交
102
QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR)
B
blueswir1 已提交
103

104
obj-y += bsd-user/
105
obj-y += gdbstub.o user-exec.o
B
blueswir1 已提交
106 107 108

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
A
Andreas Färber 已提交
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)
B
bellard 已提交
121

A
Anthony PERARD 已提交
122
# xen support
123
obj-$(CONFIG_XEN) += xen-all.o xen-mapcache.o
124
obj-$(call lnot,$(CONFIG_XEN)) += xen-stub.o
A
Anthony PERARD 已提交
125

126
# Hardware support
P
Paolo Bonzini 已提交
127
ifeq ($(TARGET_NAME), sparc64)
128
obj-y += hw/sparc64/
B
bellard 已提交
129
else
130
obj-y += hw/$(TARGET_BASE_ARCH)/
131 132
endif

133
main.o: QEMU_CFLAGS+=$(GPROF_CFLAGS)
134

135
GENERATED_HEADERS += hmp-commands.h qmp-commands-old.h
136

137
endif # CONFIG_SOFTMMU
138

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

142
dummy := $(call unnest-vars,,obj-y)
143

144 145 146 147 148 149
# we are making another call to unnest-vars with different vars, protect obj-y,
# it can be overriden in subdir Makefile.objs
obj-y-save := $(obj-y)

block-obj-y :=
common-obj-y :=
150
include $(SRC_PATH)/Makefile.objs
151 152 153 154
dummy := $(call unnest-vars,..,block-obj-y common-obj-y)

# Now restore obj-y
obj-y := $(obj-y-save)
155

156 157
all-obj-y = $(obj-y) $(common-obj-y)
all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y)
158

159 160 161 162
ifndef CONFIG_HAIKU
LIBS+=-lm
endif

163 164
ifdef QEMU_PROGW
# The linker builds a windows executable. Make also a console executable.
165
$(QEMU_PROGW): $(all-obj-y) ../libqemuutil.a ../libqemustub.a
166 167 168 169
	$(call LINK,$^)
$(QEMU_PROG): $(QEMU_PROGW)
	$(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_PROG),"  GEN   $(TARGET_DIR)$(QEMU_PROG)")
else
170
$(QEMU_PROG): $(all-obj-y) ../libqemuutil.a ../libqemustub.a
L
Lluís 已提交
171
	$(call LINK,$^)
172
endif
173

B
Blue Swirl 已提交
174 175
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 已提交
176

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

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

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

191
install: all
B
bellard 已提交
192
ifneq ($(PROGS),)
193 194 195 196
	$(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)"
ifneq ($(STRIP),)
	$(STRIP) $(patsubst %,"$(DESTDIR)$(bindir)/%",$(PROGS))
endif
B
bellard 已提交
197
endif
198
ifdef CONFIG_TRACE_SYSTEMTAP
199
	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
200
	$(INSTALL_DATA) $(QEMU_PROG).stp-installed "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG).stp"
201
endif
B
bellard 已提交
202

203 204
GENERATED_HEADERS += config-target.h
Makefile: $(GENERATED_HEADERS)