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

3
include ../config-host.mak
4
include config-devices.mak
5
include config-target.mak
6
include $(SRC_PATH)/rules.mak
7 8 9
ifneq ($(HWDIR),)
include $(HWDIR)/config.mak
endif
10

bellard's avatar
bellard committed
11
TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
Paolo Bonzini's avatar
Paolo Bonzini committed
12
$(call set-vpath, $(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw)
13 14 15 16
ifdef CONFIG_LINUX
QEMU_CFLAGS += -I../linux-headers
endif
QEMU_CFLAGS += -I.. -I$(TARGET_PATH) -DNEED_CPU_H
17

18 19
QEMU_CFLAGS+=-I$(SRC_PATH)/include

20 21 22 23
ifdef CONFIG_USER_ONLY
# user emulator name
QEMU_PROG=qemu-$(TARGET_ARCH2)
else
24
# system emulator name
25 26 27 28
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
29
QEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF)
30
endif
31

32
PROGS=$(QEMU_PROG)
33 34 35
ifdef QEMU_PROGW
PROGS+=$(QEMU_PROGW)
endif
36
STPFILES=
37

38
ifndef CONFIG_HAIKU
39
LIBS+=-lm
40
endif
41

42 43 44
config-target.h: config-target.h-timestamp
config-target.h-timestamp: config-target.mak

45
ifdef CONFIG_TRACE_SYSTEMTAP
46 47 48 49 50 51 52 53
stap: $(QEMU_PROG).stp

ifdef CONFIG_USER_ONLY
TARGET_TYPE=user
else
TARGET_TYPE=system
endif

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

all: $(PROGS) stap
67

68 69
# Dummy command so that make thinks it has done something
	@true
70

71
#########################################################
72
# cpu emulator library
73
obj-y = exec.o translate-all.o cpu-exec.o
74 75 76 77 78
obj-y += tcg/tcg.o tcg/optimize.o
obj-$(CONFIG_TCG_INTERPRETER) += tci.o
obj-y += fpu/softfloat.o
obj-y += disas.o
obj-$(CONFIG_TCI_DIS) += tci-dis.o
79
obj-y += target-$(TARGET_BASE_ARCH)/
80
obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o
81

82
tci-dis.o: QEMU_CFLAGS += -I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/tci
83

84
# HELPER_CFLAGS is used for all the legacy code compiled with static register
85
# variables
86
user-exec.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
87

Juan Quintela's avatar
Juan Quintela committed
88
# Note: this is a workaround. The real fix is to avoid compiling
89
# cpu_signal_handler() in user-exec.c.
90
%/signal.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
Juan Quintela's avatar
Juan Quintela committed
91

92 93 94 95 96
#########################################################
# Linux user emulator target

ifdef CONFIG_LINUX_USER

97
QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) -I$(SRC_PATH)/linux-user
98

99 100
obj-y += linux-user/
obj-y += gdbstub.o thunk.o user-exec.o $(oslib-obj-y)
101 102 103

endif #CONFIG_LINUX_USER

104 105 106 107 108
#########################################################
# BSD user emulator target

ifdef CONFIG_BSD_USER

109
QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
110

111 112
obj-y += bsd-user/
obj-y += gdbstub.o user-exec.o
113 114 115

endif #CONFIG_BSD_USER

116 117
#########################################################
# System emulator target
118
ifdef CONFIG_SOFTMMU
119 120 121 122 123
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)
124

125
obj-y += arch_init.o cpus.o monitor.o gdbstub.o balloon.o ioport.o
126
obj-y += hw/
127
obj-$(CONFIG_KVM) += kvm-all.o
128
obj-$(CONFIG_NO_KVM) += kvm-stub.o
129
obj-y += memory.o savevm.o cputlb.o
130 131
obj-$(CONFIG_HAVE_GET_MEMORY_MAPPING) += memory_mapping.o
obj-$(CONFIG_HAVE_CORE_DUMP) += dump.o
132 133
obj-$(CONFIG_NO_GET_MEMORY_MAPPING) += memory_mapping-stub.o
obj-$(CONFIG_NO_CORE_DUMP) += dump-stub.o
134
LIBS+=-lz
bellard's avatar
bellard committed
135

136 137
QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
QEMU_CFLAGS += $(VNC_SASL_CFLAGS)
138
QEMU_CFLAGS += $(VNC_JPEG_CFLAGS)
139
QEMU_CFLAGS += $(VNC_PNG_CFLAGS)
140

141
# xen support
142
obj-$(CONFIG_XEN) += xen-all.o xen-mapcache.o
143 144
obj-$(CONFIG_NO_XEN) += xen-stub.o

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

152
main.o: QEMU_CFLAGS+=$(GPROF_CFLAGS)
153

154
GENERATED_HEADERS += hmp-commands.h qmp-commands-old.h
155

156
endif # CONFIG_SOFTMMU
157

158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
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))
all-obj-y += $(addprefix ../libdis/, $(libdis-y))
all-obj-y += $(addprefix $(HWDIR)/, $(hw-obj-y))
all-obj-y += $(addprefix ../, $(trace-obj-y))
else
all-obj-y += $(addprefix ../libuser/, $(user-obj-y))
all-obj-y += $(addprefix ../libdis-user/, $(libdis-y))
endif #CONFIG_LINUX_USER
175

176 177
ifdef QEMU_PROGW
# The linker builds a windows executable. Make also a console executable.
178
$(QEMU_PROGW): $(all-obj-y)
179 180 181 182
	$(call LINK,$^)
$(QEMU_PROG): $(QEMU_PROGW)
	$(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_PROG),"  GEN   $(TARGET_DIR)$(QEMU_PROG)")
else
183
$(QEMU_PROG): $(all-obj-y)
Lluís's avatar
Lluís committed
184
	$(call LINK,$^)
185
endif
186

Blue Swirl's avatar
Blue Swirl committed
187 188
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)$@")
189

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

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

196
clean:
197
	rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o
198
	rm -f *.d */*.d tcg/*.o ide/*.o 9pfs/*.o kvm/*.o
199
	rm -f hmp-commands.h qmp-commands-old.h gdbstub-xml.c
200
ifdef CONFIG_TRACE_SYSTEMTAP
201 202
	rm -f *.stp
endif
203

204
install: all
bellard's avatar
bellard committed
205
ifneq ($(PROGS),)
206 207 208 209
	$(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)"
ifneq ($(STRIP),)
	$(STRIP) $(patsubst %,"$(DESTDIR)$(bindir)/%",$(PROGS))
endif
bellard's avatar
bellard committed
210
endif
211
ifdef CONFIG_TRACE_SYSTEMTAP
212 213
	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
	$(INSTALL_DATA) $(QEMU_PROG).stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
214
endif
215

216 217 218
GENERATED_HEADERS += config-target.h
Makefile: $(GENERATED_HEADERS)

219 220
# Include automatically generated dependency files
-include $(wildcard *.d */*.d)