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

3
include ../config-host.mak
4
include config-devices.mak
5
include config-target.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 18 19
ifdef CONFIG_USER_ONLY
# user emulator name
QEMU_PROG=qemu-$(TARGET_ARCH2)
else
20
# system emulator name
21 22 23 24
ifneq (,$(findstring -mwindows,$(LIBS)))
# Terminate program name with a 'w' because the linker builds a windows executable.
QEMU_PROGW=qemu-system-$(TARGET_ARCH2)w$(EXESUF)
endif # windows executable
25
QEMU_PROG=qemu-system-$(TARGET_ARCH2)$(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

A
Andreas Färber 已提交
34
ifndef CONFIG_HAIKU
B
bellard 已提交
35
LIBS+=-lm
A
Andreas Färber 已提交
36
endif
37

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

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

ifdef CONFIG_USER_ONLY
TARGET_TYPE=user
else
TARGET_TYPE=system
endif

50
$(QEMU_PROG).stp: $(SRC_PATH)/trace-events
51
	$(call quiet-command,$(TRACETOOL) \
52 53 54 55 56
		--format=stap \
		--backend=$(TRACE_BACKEND) \
		--binary=$(bindir)/$(QEMU_PROG) \
		--target-arch=$(TARGET_ARCH) \
		--target-type=$(TARGET_TYPE) \
57
		< $< > $@,"  GEN   $(QEMU_PROG).stp")
58 59 60 61 62
else
stap:
endif

all: $(PROGS) stap
63

P
Paul Brook 已提交
64 65
# Dummy command so that make thinks it has done something
	@true
B
bellard 已提交
66

67
#########################################################
B
bellard 已提交
68
# cpu emulator library
69
obj-y = exec.o translate-all.o cpu-exec.o
70 71
obj-y += tcg/tcg.o tcg/optimize.o
obj-$(CONFIG_TCG_INTERPRETER) += tci.o
72
obj-$(CONFIG_TCG_INTERPRETER) += disas/tci.o
73
obj-y += fpu/softfloat.o
74
obj-y += target-$(TARGET_BASE_ARCH)/
75
obj-y += disas.o
76
obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o
77

78 79 80 81 82
#########################################################
# Linux user emulator target

ifdef CONFIG_LINUX_USER

83
QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) -I$(SRC_PATH)/linux-user
84

85
obj-y += linux-user/
86
obj-y += gdbstub.o thunk.o user-exec.o
87 88 89

endif #CONFIG_LINUX_USER

B
blueswir1 已提交
90 91 92 93 94
#########################################################
# BSD user emulator target

ifdef CONFIG_BSD_USER

J
Juan Quintela 已提交
95
QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
B
blueswir1 已提交
96

97
obj-y += bsd-user/
98
obj-y += gdbstub.o user-exec.o
B
blueswir1 已提交
99 100 101

endif #CONFIG_BSD_USER

102 103
#########################################################
# System emulator target
104
ifdef CONFIG_SOFTMMU
105 106 107 108 109
CONFIG_NO_PCI = $(if $(subst n,,$(CONFIG_PCI)),n,y)
CONFIG_NO_KVM = $(if $(subst n,,$(CONFIG_KVM)),n,y)
CONFIG_NO_XEN = $(if $(subst n,,$(CONFIG_XEN)),n,y)
CONFIG_NO_GET_MEMORY_MAPPING = $(if $(subst n,,$(CONFIG_HAVE_GET_MEMORY_MAPPING)),n,y)
CONFIG_NO_CORE_DUMP = $(if $(subst n,,$(CONFIG_HAVE_CORE_DUMP)),n,y)
110

111
obj-y += arch_init.o cpus.o monitor.o gdbstub.o balloon.o ioport.o
112
obj-y += hw/
113
obj-$(CONFIG_KVM) += kvm-all.o
114
obj-$(CONFIG_NO_KVM) += kvm-stub.o
115
obj-y += memory.o savevm.o cputlb.o
116 117
obj-$(CONFIG_HAVE_GET_MEMORY_MAPPING) += memory_mapping.o
obj-$(CONFIG_HAVE_CORE_DUMP) += dump.o
118 119
obj-$(CONFIG_NO_GET_MEMORY_MAPPING) += memory_mapping-stub.o
obj-$(CONFIG_NO_CORE_DUMP) += dump-stub.o
120
LIBS+=-lz
B
bellard 已提交
121

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

126
# Hardware support
B
bellard 已提交
127
ifeq ($(TARGET_ARCH), 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 143 144 145 146 147 148 149 150 151 152
nested-vars += obj-y

# This resolves all nested paths, so it must come last
include $(SRC_PATH)/Makefile.objs

all-obj-y = $(obj-y)
all-obj-y += $(addprefix ../, $(universal-obj-y))

ifdef CONFIG_SOFTMMU
all-obj-y += $(addprefix ../, $(common-obj-y))
else
P
Paolo Bonzini 已提交
153
all-obj-y += $(addprefix ../, $(user-obj-y))
154
endif #CONFIG_LINUX_USER
155

156 157
ifdef QEMU_PROGW
# The linker builds a windows executable. Make also a console executable.
158
$(QEMU_PROGW): $(all-obj-y) ../libqemuutil.a ../libqemustub.a
159 160 161 162
	$(call LINK,$^)
$(QEMU_PROG): $(QEMU_PROGW)
	$(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_PROG),"  GEN   $(TARGET_DIR)$(QEMU_PROG)")
else
163
$(QEMU_PROG): $(all-obj-y) ../libqemuutil.a ../libqemustub.a
L
Lluís 已提交
164
	$(call LINK,$^)
165
endif
166

B
Blue Swirl 已提交
167 168
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 已提交
169

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

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

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

184
install: all
B
bellard 已提交
185
ifneq ($(PROGS),)
186 187 188 189
	$(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)"
ifneq ($(STRIP),)
	$(STRIP) $(patsubst %,"$(DESTDIR)$(bindir)/%",$(PROGS))
endif
B
bellard 已提交
190
endif
191
ifdef CONFIG_TRACE_SYSTEMTAP
192 193
	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
	$(INSTALL_DATA) $(QEMU_PROG).stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
194
endif
B
bellard 已提交
195

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