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
6
include $(SRC_PATH)/rules.mak
7

8
$(call set-vpath, $(SRC_PATH))
9 10 11
ifdef CONFIG_LINUX
QEMU_CFLAGS += -I../linux-headers
endif
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
27

28
PROGS=$(QEMU_PROG)
29 30 31
ifdef QEMU_PROGW
PROGS+=$(QEMU_PROGW)
endif
32
STPFILES=
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) \
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) \
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

70 71
# Dummy command so that make thinks it has done something
	@true
72

73
#########################################################
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

97 98 99 100 101
#########################################################
# BSD user emulator target

ifdef CONFIG_BSD_USER

102
QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR)
103

104
obj-y += bsd-user/
105
obj-y += gdbstub.o user-exec.o
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
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)
bellard's avatar
bellard committed
121

122
# xen support
123
obj-$(CONFIG_XEN) += xen-all.o xen-mapcache.o
124
obj-$(call lnot,$(CONFIG_XEN)) += xen-stub.o
125

126
# Hardware support
127
ifeq ($(TARGET_NAME), sparc64)
128
obj-y += hw/sparc64/
bellard's avatar
bellard committed
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
nested-vars += obj-y

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

all-obj-y = $(obj-y)
148
all-obj-y += $(addprefix ../, $(common-obj-y))
149

150 151 152 153
ifndef CONFIG_HAIKU
LIBS+=-lm
endif

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

Blue Swirl's avatar
Blue Swirl committed
165 166
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)$@")
167

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

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

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

182
install: all
bellard's avatar
bellard committed
183
ifneq ($(PROGS),)
184 185 186 187
	$(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)"
ifneq ($(STRIP),)
	$(STRIP) $(patsubst %,"$(DESTDIR)$(bindir)/%",$(PROGS))
endif
bellard's avatar
bellard committed
188
endif
189
ifdef CONFIG_TRACE_SYSTEMTAP
190
	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
191
	$(INSTALL_DATA) $(QEMU_PROG).stp-installed "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG).stp"
192
endif
193

194 195
GENERATED_HEADERS += config-target.h
Makefile: $(GENERATED_HEADERS)