]>
Commit | Line | Data |
---|---|---|
562593aa AL |
1 | # -*- Mode: makefile -*- |
2 | ||
deed3ccf | 3 | include ../config-host.mak |
25be210f | 4 | include config-target.mak |
f3aa844b | 5 | include config-devices.mak |
17759187 | 6 | include $(SRC_PATH)/rules.mak |
626df76a | 7 | |
fec90ff0 | 8 | $(call set-vpath, $(SRC_PATH)) |
af2be207 JK |
9 | ifdef CONFIG_LINUX |
10 | QEMU_CFLAGS += -I../linux-headers | |
11 | endif | |
fec90ff0 | 12 | QEMU_CFLAGS += -I.. -I$(SRC_PATH)/target-$(TARGET_BASE_ARCH) -DNEED_CPU_H |
40293e58 | 13 | |
2f28d2ff AL |
14 | QEMU_CFLAGS+=-I$(SRC_PATH)/include |
15 | ||
40293e58 FB |
16 | ifdef CONFIG_USER_ONLY |
17 | # user emulator name | |
c1799a84 | 18 | QEMU_PROG=qemu-$(TARGET_NAME) |
40293e58 | 19 | else |
1e43adfc | 20 | # system emulator name |
c12915e6 | 21 | ifneq (,$(findstring -mwindows,$(libs_softmmu))) |
0fa5491e | 22 | # Terminate program name with a 'w' because the linker builds a windows executable. |
c1799a84 | 23 | QEMU_PROGW=qemu-system-$(TARGET_NAME)w$(EXESUF) |
0fa5491e | 24 | endif # windows executable |
c1799a84 | 25 | QEMU_PROG=qemu-system-$(TARGET_NAME)$(EXESUF) |
a541f297 | 26 | endif |
626df76a | 27 | |
40293e58 | 28 | PROGS=$(QEMU_PROG) |
0fa5491e SW |
29 | ifdef QEMU_PROGW |
30 | PROGS+=$(QEMU_PROGW) | |
31 | endif | |
b8841706 | 32 | STPFILES= |
626df76a | 33 | |
91880d96 JQ |
34 | config-target.h: config-target.h-timestamp |
35 | config-target.h-timestamp: config-target.mak | |
36 | ||
6d8a764e | 37 | ifdef CONFIG_TRACE_SYSTEMTAP |
c14518e9 | 38 | stap: $(QEMU_PROG).stp-installed $(QEMU_PROG).stp |
c276b17d DB |
39 | |
40 | ifdef CONFIG_USER_ONLY | |
41 | TARGET_TYPE=user | |
42 | else | |
43 | TARGET_TYPE=system | |
44 | endif | |
45 | ||
c14518e9 | 46 | $(QEMU_PROG).stp-installed: $(SRC_PATH)/trace-events |
c0424934 | 47 | $(call quiet-command,$(TRACETOOL) \ |
650ab98d LV |
48 | --format=stap \ |
49 | --backend=$(TRACE_BACKEND) \ | |
50 | --binary=$(bindir)/$(QEMU_PROG) \ | |
b9a7b74f | 51 | --target-name=$(TARGET_NAME) \ |
650ab98d | 52 | --target-type=$(TARGET_TYPE) \ |
c14518e9 AL |
53 | < $< > $@," GEN $(TARGET_DIR)$(QEMU_PROG).stp-installed") |
54 | ||
55 | $(QEMU_PROG).stp: $(SRC_PATH)/trace-events | |
56 | $(call quiet-command,$(TRACETOOL) \ | |
57 | --format=stap \ | |
58 | --backend=$(TRACE_BACKEND) \ | |
59 | --binary=$(realpath .)/$(QEMU_PROG) \ | |
b9a7b74f | 60 | --target-name=$(TARGET_NAME) \ |
c14518e9 | 61 | --target-type=$(TARGET_TYPE) \ |
aaf821fd | 62 | < $< > $@," GEN $(TARGET_DIR)$(QEMU_PROG).stp") |
c14518e9 | 63 | |
c276b17d DB |
64 | else |
65 | stap: | |
66 | endif | |
67 | ||
68 | all: $(PROGS) stap | |
91880d96 | 69 | |
c2fb2637 PB |
70 | # Dummy command so that make thinks it has done something |
71 | @true | |
626df76a | 72 | |
40293e58 | 73 | ######################################################### |
626df76a | 74 | # cpu emulator library |
fbe37ef3 | 75 | obj-y = exec.o translate-all.o cpu-exec.o |
9cdc8df3 PB |
76 | obj-y += tcg/tcg.o tcg/optimize.o |
77 | obj-$(CONFIG_TCG_INTERPRETER) += tci.o | |
50348333 | 78 | obj-$(CONFIG_TCG_INTERPRETER) += disas/tci.o |
9cdc8df3 | 79 | obj-y += fpu/softfloat.o |
5e8861a0 | 80 | obj-y += target-$(TARGET_BASE_ARCH)/ |
76cad711 | 81 | obj-y += disas.o |
b77abd95 | 82 | obj-$(call notempty,$(TARGET_XML_FILES)) += gdbstub-xml.o |
cf01ba9e | 83 | obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o |
5e8861a0 | 84 | |
40293e58 FB |
85 | ######################################################### |
86 | # Linux user emulator target | |
87 | ||
88 | ifdef CONFIG_LINUX_USER | |
89 | ||
c3109ba1 | 90 | QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) -I$(SRC_PATH)/linux-user |
1c872672 | 91 | |
7fc5152c | 92 | obj-y += linux-user/ |
8a090705 | 93 | obj-y += gdbstub.o thunk.o user-exec.o |
40293e58 | 94 | |
40293e58 FB |
95 | endif #CONFIG_LINUX_USER |
96 | ||
84778508 BS |
97 | ######################################################### |
98 | # BSD user emulator target | |
99 | ||
100 | ifdef CONFIG_BSD_USER | |
101 | ||
b9a7b74f | 102 | QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR) |
84778508 | 103 | |
7fc5152c | 104 | obj-y += bsd-user/ |
8a090705 | 105 | obj-y += gdbstub.o user-exec.o |
84778508 | 106 | |
84778508 BS |
107 | endif #CONFIG_BSD_USER |
108 | ||
40293e58 FB |
109 | ######################################################### |
110 | # System emulator target | |
76dfdd24 | 111 | ifdef CONFIG_SOFTMMU |
fbe37ef3 | 112 | obj-y += arch_init.o cpus.o monitor.o gdbstub.o balloon.o ioport.o |
872536bf | 113 | obj-y += qtest.o |
c353f261 | 114 | obj-y += hw/ |
320ba5fe | 115 | obj-$(CONFIG_FDT) += device_tree.o |
fbe37ef3 | 116 | obj-$(CONFIG_KVM) += kvm-all.o |
0cac1b66 | 117 | obj-y += memory.o savevm.o cputlb.o |
c22d8e04 | 118 | obj-y += memory_mapping.o |
2a78636b | 119 | obj-y += dump.o |
f544a488 | 120 | LIBS+=$(libs_softmmu) |
4fb240a4 | 121 | |
3285cf4f | 122 | # xen support |
04b0de0e WL |
123 | obj-$(CONFIG_XEN) += xen-common.o |
124 | obj-$(CONFIG_XEN_I386) += xen-hvm.o xen-mapcache.o | |
125 | obj-$(call lnot,$(CONFIG_XEN)) += xen-common-stub.o | |
126 | obj-$(call lnot,$(CONFIG_XEN_I386)) += xen-hvm-stub.o | |
3285cf4f | 127 | |
a541f297 | 128 | # Hardware support |
b9a7b74f | 129 | ifeq ($(TARGET_NAME), sparc64) |
5e8861a0 | 130 | obj-y += hw/sparc64/ |
3475187d | 131 | else |
5e8861a0 | 132 | obj-y += hw/$(TARGET_BASE_ARCH)/ |
9637443f JQ |
133 | endif |
134 | ||
4115852b | 135 | GENERATED_HEADERS += hmp-commands.h qmp-commands-old.h |
0e8c9214 | 136 | |
76dfdd24 | 137 | endif # CONFIG_SOFTMMU |
00a67ba1 | 138 | |
cbdd1999 PB |
139 | # Workaround for http://gcc.gnu.org/PR55489, see configure. |
140 | %/translate.o: QEMU_CFLAGS += $(TRANSLATE_OPT_CFLAGS) | |
141 | ||
ba1183da | 142 | dummy := $(call unnest-vars,,obj-y) |
99100dc3 | 143 | |
ba1183da FZ |
144 | # we are making another call to unnest-vars with different vars, protect obj-y, |
145 | # it can be overriden in subdir Makefile.objs | |
146 | obj-y-save := $(obj-y) | |
147 | ||
148 | block-obj-y := | |
149 | common-obj-y := | |
99100dc3 | 150 | include $(SRC_PATH)/Makefile.objs |
cc475698 FZ |
151 | dummy := $(call unnest-vars,.., \ |
152 | block-obj-y \ | |
153 | block-obj-m \ | |
154 | common-obj-y \ | |
155 | common-obj-m) | |
ba1183da FZ |
156 | |
157 | # Now restore obj-y | |
158 | obj-y := $(obj-y-save) | |
99100dc3 | 159 | |
ba1183da FZ |
160 | all-obj-y = $(obj-y) $(common-obj-y) |
161 | all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y) | |
7fc5152c | 162 | |
f544a488 PB |
163 | ifndef CONFIG_HAIKU |
164 | LIBS+=-lm | |
165 | endif | |
166 | ||
0fa5491e SW |
167 | ifdef QEMU_PROGW |
168 | # The linker builds a windows executable. Make also a console executable. | |
8a090705 | 169 | $(QEMU_PROGW): $(all-obj-y) ../libqemuutil.a ../libqemustub.a |
0fa5491e SW |
170 | $(call LINK,$^) |
171 | $(QEMU_PROG): $(QEMU_PROGW) | |
172 | $(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_PROG)," GEN $(TARGET_DIR)$(QEMU_PROG)") | |
173 | else | |
8a090705 | 174 | $(QEMU_PROG): $(all-obj-y) ../libqemuutil.a ../libqemustub.a |
e03b41d4 | 175 | $(call LINK,$^) |
0fa5491e | 176 | endif |
16394485 | 177 | |
4c3b5a48 BS |
178 | gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh |
179 | $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES)," GEN $(TARGET_DIR)$@") | |
56aebc89 | 180 | |
acd0a093 | 181 | hmp-commands.h: $(SRC_PATH)/hmp-commands.hx |
4c3b5a48 | 182 | $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@") |
2313086a | 183 | |
e3193601 | 184 | qmp-commands-old.h: $(SRC_PATH)/qmp-commands.hx |
4c3b5a48 | 185 | $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@") |
2313086a | 186 | |
626df76a | 187 | clean: |
b54fa7dd PM |
188 | rm -f *.a *~ $(PROGS) |
189 | rm -f $(shell find . -name '*.[od]') | |
e3193601 | 190 | rm -f hmp-commands.h qmp-commands-old.h gdbstub-xml.c |
6d8a764e | 191 | ifdef CONFIG_TRACE_SYSTEMTAP |
c276b17d DB |
192 | rm -f *.stp |
193 | endif | |
1e43adfc | 194 | |
5fafdf24 | 195 | install: all |
9b14bb04 | 196 | ifneq ($(PROGS),) |
52ba784d HB |
197 | $(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)" |
198 | ifneq ($(STRIP),) | |
199 | $(STRIP) $(patsubst %,"$(DESTDIR)$(bindir)/%",$(PROGS)) | |
200 | endif | |
9b14bb04 | 201 | endif |
6d8a764e | 202 | ifdef CONFIG_TRACE_SYSTEMTAP |
6aae2a2e | 203 | $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset" |
c14518e9 | 204 | $(INSTALL_DATA) $(QEMU_PROG).stp-installed "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG).stp" |
c276b17d | 205 | endif |
626df76a | 206 | |
4115852b PB |
207 | GENERATED_HEADERS += config-target.h |
208 | Makefile: $(GENERATED_HEADERS) |