Makefile.target 5.1 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 18 19
ifdef CONFIG_USER_ONLY
# user emulator name
QEMU_PROG=qemu-$(TARGET_ARCH2)
else
20
# system emulator name
21
ifneq (,$(findstring -mwindows,$(libs_softmmu)))
22 23 24
# 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

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

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

ifdef CONFIG_USER_ONLY
TARGET_TYPE=user
else
TARGET_TYPE=system
endif

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

all: $(PROGS) stap
59

P
Paul Brook 已提交
60 61
# Dummy command so that make thinks it has done something
	@true
B
bellard 已提交
62

63 64 65 66 67
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)

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

80 81 82 83 84
#########################################################
# Linux user emulator target

ifdef CONFIG_LINUX_USER

85
QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) -I$(SRC_PATH)/linux-user
86

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

endif #CONFIG_LINUX_USER

B
blueswir1 已提交
92 93 94 95 96
#########################################################
# BSD user emulator target

ifdef CONFIG_BSD_USER

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

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

endif #CONFIG_BSD_USER

104 105
#########################################################
# System emulator target
106
ifdef CONFIG_SOFTMMU
107
obj-y += arch_init.o cpus.o monitor.o gdbstub.o balloon.o ioport.o
A
Andreas Färber 已提交
108
obj-y += qtest.o
109
obj-y += hw/
110
obj-$(CONFIG_FDT) += device_tree.o
111
obj-$(CONFIG_KVM) += kvm-all.o
112
obj-y += memory.o savevm.o cputlb.o
113 114
obj-$(CONFIG_HAVE_GET_MEMORY_MAPPING) += memory_mapping.o
obj-$(CONFIG_HAVE_CORE_DUMP) += dump.o
115
obj-$(CONFIG_NO_GET_MEMORY_MAPPING) += memory_mapping-stub.o
116
LIBS+=$(libs_softmmu)
B
bellard 已提交
117

A
Anthony PERARD 已提交
118
# xen support
119
obj-$(CONFIG_XEN) += xen-all.o xen-mapcache.o
A
Anthony PERARD 已提交
120 121
obj-$(CONFIG_NO_XEN) += xen-stub.o

122
# Hardware support
B
bellard 已提交
123
ifeq ($(TARGET_ARCH), sparc64)
124
obj-y += hw/sparc64/
B
bellard 已提交
125
else
126
obj-y += hw/$(TARGET_BASE_ARCH)/
127 128
endif

129
main.o: QEMU_CFLAGS+=$(GPROF_CFLAGS)
130

131
GENERATED_HEADERS += hmp-commands.h qmp-commands-old.h
132

133
endif # CONFIG_SOFTMMU
134

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

138 139 140 141 142 143
nested-vars += obj-y

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

all-obj-y = $(obj-y)
P
Paolo Bonzini 已提交
144
all-obj-y += $(addprefix ../, $(common-obj-y))
145

146 147 148 149
ifndef CONFIG_HAIKU
LIBS+=-lm
endif

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

B
Blue Swirl 已提交
161 162
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 已提交
163

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

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

B
bellard 已提交
170
clean:
171 172
	rm -f *.a *~ $(PROGS)
	rm -f $(shell find . -name '*.[od]')
173
	rm -f hmp-commands.h qmp-commands-old.h gdbstub-xml.c
174
ifdef CONFIG_TRACE_SYSTEMTAP
175 176
	rm -f *.stp
endif
177

178
install: all
B
bellard 已提交
179
ifneq ($(PROGS),)
180 181 182 183
	$(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)"
ifneq ($(STRIP),)
	$(STRIP) $(patsubst %,"$(DESTDIR)$(bindir)/%",$(PROGS))
endif
B
bellard 已提交
184
endif
185
ifdef CONFIG_TRACE_SYSTEMTAP
186 187
	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
	$(INSTALL_DATA) $(QEMU_PROG).stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
188
endif
B
bellard 已提交
189

190 191
GENERATED_HEADERS += config-target.h
Makefile: $(GENERATED_HEADERS)