Anthony Liguori | 562593a | 2009-08-04 08:24:23 -0500 | [diff] [blame] | 1 | # -*- Mode: makefile -*- |
| 2 | |
Juan Quintela | deed3cc | 2009-10-07 02:40:57 +0200 | [diff] [blame] | 3 | include ../config-host.mak |
Juan Quintela | 25be210f | 2009-10-07 02:41:00 +0200 | [diff] [blame] | 4 | include config-target.mak |
Paolo Bonzini | f3aa844 | 2013-04-16 10:50:38 +0200 | [diff] [blame] | 5 | include config-devices.mak |
aliguori | 1775918 | 2009-01-21 18:12:52 +0000 | [diff] [blame] | 6 | include $(SRC_PATH)/rules.mak |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 7 | |
Paolo Bonzini | fec90ff | 2012-05-29 11:49:50 +0200 | [diff] [blame] | 8 | $(call set-vpath, $(SRC_PATH)) |
Jan Kiszka | af2be20 | 2011-06-23 10:05:12 +0200 | [diff] [blame] | 9 | ifdef CONFIG_LINUX |
| 10 | QEMU_CFLAGS += -I../linux-headers |
| 11 | endif |
Paolo Bonzini | fec90ff | 2012-05-29 11:49:50 +0200 | [diff] [blame] | 12 | QEMU_CFLAGS += -I.. -I$(SRC_PATH)/target-$(TARGET_BASE_ARCH) -DNEED_CPU_H |
bellard | 1e43adf | 2003-09-30 20:54:24 +0000 | [diff] [blame] | 13 | |
Anthony Liguori | 2f28d2f | 2011-12-03 17:10:08 -0600 | [diff] [blame] | 14 | QEMU_CFLAGS+=-I$(SRC_PATH)/include |
| 15 | |
bellard | 16e9b7d | 2003-10-27 21:09:52 +0000 | [diff] [blame] | 16 | ifdef CONFIG_USER_ONLY |
bellard | 40293e5 | 2008-01-31 11:32:10 +0000 | [diff] [blame] | 17 | # user emulator name |
Paolo Bonzini | c1799a8 | 2013-06-14 15:19:07 +0100 | [diff] [blame] | 18 | QEMU_PROG=qemu-$(TARGET_NAME) |
bellard | 16e9b7d | 2003-10-27 21:09:52 +0000 | [diff] [blame] | 19 | else |
bellard | 40293e5 | 2008-01-31 11:32:10 +0000 | [diff] [blame] | 20 | # system emulator name |
Paolo Bonzini | c12915e | 2013-04-24 22:57:59 +0200 | [diff] [blame] | 21 | ifneq (,$(findstring -mwindows,$(libs_softmmu))) |
Stefan Weil | 0fa5491 | 2011-12-22 11:18:53 +0100 | [diff] [blame] | 22 | # Terminate program name with a 'w' because the linker builds a windows executable. |
Paolo Bonzini | c1799a8 | 2013-06-14 15:19:07 +0100 | [diff] [blame] | 23 | QEMU_PROGW=qemu-system-$(TARGET_NAME)w$(EXESUF) |
Stefan Weil | 0fa5491 | 2011-12-22 11:18:53 +0100 | [diff] [blame] | 24 | endif # windows executable |
Paolo Bonzini | c1799a8 | 2013-06-14 15:19:07 +0100 | [diff] [blame] | 25 | QEMU_PROG=qemu-system-$(TARGET_NAME)$(EXESUF) |
bellard | de5eaa6 | 2003-11-16 23:18:17 +0000 | [diff] [blame] | 26 | endif |
bellard | 728c9fd | 2004-01-05 00:08:14 +0000 | [diff] [blame] | 27 | |
bellard | 40293e5 | 2008-01-31 11:32:10 +0000 | [diff] [blame] | 28 | PROGS=$(QEMU_PROG) |
Stefan Weil | 0fa5491 | 2011-12-22 11:18:53 +0100 | [diff] [blame] | 29 | ifdef QEMU_PROGW |
| 30 | PROGS+=$(QEMU_PROGW) |
| 31 | endif |
Peter Maydell | b884170 | 2010-11-16 20:07:07 +0000 | [diff] [blame] | 32 | STPFILES= |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 33 | |
Juan Quintela | 91880d9 | 2009-10-07 02:41:01 +0200 | [diff] [blame] | 34 | config-target.h: config-target.h-timestamp |
| 35 | config-target.h-timestamp: config-target.mak |
| 36 | |
Lluís | 6d8a764 | 2011-08-31 20:30:43 +0200 | [diff] [blame] | 37 | ifdef CONFIG_TRACE_SYSTEMTAP |
Alon Levy | c14518e | 2013-06-14 15:19:07 +0100 | [diff] [blame] | 38 | stap: $(QEMU_PROG).stp-installed $(QEMU_PROG).stp |
Daniel P. Berrange | c276b17 | 2010-11-12 13:20:25 +0000 | [diff] [blame] | 39 | |
| 40 | ifdef CONFIG_USER_ONLY |
| 41 | TARGET_TYPE=user |
| 42 | else |
| 43 | TARGET_TYPE=system |
| 44 | endif |
| 45 | |
Alon Levy | c14518e | 2013-06-14 15:19:07 +0100 | [diff] [blame] | 46 | $(QEMU_PROG).stp-installed: $(SRC_PATH)/trace-events |
Lluís Vilanova | c042493 | 2012-04-18 20:15:45 +0200 | [diff] [blame] | 47 | $(call quiet-command,$(TRACETOOL) \ |
Lluís Vilanova | 650ab98 | 2012-04-03 20:47:39 +0200 | [diff] [blame] | 48 | --format=stap \ |
| 49 | --backend=$(TRACE_BACKEND) \ |
| 50 | --binary=$(bindir)/$(QEMU_PROG) \ |
Paolo Bonzini | b9a7b74 | 2013-06-04 14:45:26 +0200 | [diff] [blame] | 51 | --target-name=$(TARGET_NAME) \ |
Lluís Vilanova | 650ab98 | 2012-04-03 20:47:39 +0200 | [diff] [blame] | 52 | --target-type=$(TARGET_TYPE) \ |
Alon Levy | c14518e | 2013-06-14 15:19:07 +0100 | [diff] [blame] | 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) \ |
Paolo Bonzini | b9a7b74 | 2013-06-04 14:45:26 +0200 | [diff] [blame] | 60 | --target-name=$(TARGET_NAME) \ |
Alon Levy | c14518e | 2013-06-14 15:19:07 +0100 | [diff] [blame] | 61 | --target-type=$(TARGET_TYPE) \ |
Paolo Bonzini | aaf821f | 2012-12-21 10:45:20 +0100 | [diff] [blame] | 62 | < $< > $@," GEN $(TARGET_DIR)$(QEMU_PROG).stp") |
Alon Levy | c14518e | 2013-06-14 15:19:07 +0100 | [diff] [blame] | 63 | |
Daniel P. Berrange | c276b17 | 2010-11-12 13:20:25 +0000 | [diff] [blame] | 64 | else |
| 65 | stap: |
| 66 | endif |
| 67 | |
| 68 | all: $(PROGS) stap |
Juan Quintela | 91880d9 | 2009-10-07 02:41:01 +0200 | [diff] [blame] | 69 | |
Paul Brook | c2fb263 | 2009-05-25 18:54:53 +0100 | [diff] [blame] | 70 | # Dummy command so that make thinks it has done something |
| 71 | @true |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 72 | |
Igor Mammedov | c4cfef5 | 2013-04-23 10:29:35 +0200 | [diff] [blame] | 73 | CONFIG_NO_PCI = $(if $(subst n,,$(CONFIG_PCI)),n,y) |
| 74 | CONFIG_NO_KVM = $(if $(subst n,,$(CONFIG_KVM)),n,y) |
| 75 | CONFIG_NO_XEN = $(if $(subst n,,$(CONFIG_XEN)),n,y) |
Igor Mammedov | c4cfef5 | 2013-04-23 10:29:35 +0200 | [diff] [blame] | 76 | |
bellard | 40293e5 | 2008-01-31 11:32:10 +0000 | [diff] [blame] | 77 | ######################################################### |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 78 | # cpu emulator library |
Paolo Bonzini | fbe37ef | 2012-05-29 11:48:59 +0200 | [diff] [blame] | 79 | obj-y = exec.o translate-all.o cpu-exec.o |
Paolo Bonzini | 9cdc8df | 2012-05-29 10:55:47 +0200 | [diff] [blame] | 80 | obj-y += tcg/tcg.o tcg/optimize.o |
| 81 | obj-$(CONFIG_TCG_INTERPRETER) += tci.o |
Stefan Weil | 5034833 | 2013-01-01 18:43:56 +0100 | [diff] [blame] | 82 | obj-$(CONFIG_TCG_INTERPRETER) += disas/tci.o |
Paolo Bonzini | 9cdc8df | 2012-05-29 10:55:47 +0200 | [diff] [blame] | 83 | obj-y += fpu/softfloat.o |
Paolo Bonzini | 5e8861a | 2012-05-29 10:23:15 +0200 | [diff] [blame] | 84 | obj-y += target-$(TARGET_BASE_ARCH)/ |
Paolo Bonzini | 76cad71 | 2012-10-24 11:12:21 +0200 | [diff] [blame] | 85 | obj-y += disas.o |
Paolo Bonzini | 9cdc8df | 2012-05-29 10:55:47 +0200 | [diff] [blame] | 86 | obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o |
Igor Mammedov | c4cfef5 | 2013-04-23 10:29:35 +0200 | [diff] [blame] | 87 | obj-$(CONFIG_NO_KVM) += kvm-stub.o |
Paolo Bonzini | 5e8861a | 2012-05-29 10:23:15 +0200 | [diff] [blame] | 88 | |
bellard | 40293e5 | 2008-01-31 11:32:10 +0000 | [diff] [blame] | 89 | ######################################################### |
| 90 | # Linux user emulator target |
| 91 | |
| 92 | ifdef CONFIG_LINUX_USER |
| 93 | |
Mike Frysinger | c3109ba | 2011-02-07 01:05:54 -0500 | [diff] [blame] | 94 | QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) -I$(SRC_PATH)/linux-user |
Blue Swirl | 5ba6531 | 2009-08-15 07:52:19 +0000 | [diff] [blame] | 95 | |
Paolo Bonzini | 7fc5152 | 2012-05-29 09:33:59 +0200 | [diff] [blame] | 96 | obj-y += linux-user/ |
Paolo Bonzini | 8a09070 | 2012-12-20 15:40:20 +0100 | [diff] [blame] | 97 | obj-y += gdbstub.o thunk.o user-exec.o |
bellard | 40293e5 | 2008-01-31 11:32:10 +0000 | [diff] [blame] | 98 | |
bellard | 40293e5 | 2008-01-31 11:32:10 +0000 | [diff] [blame] | 99 | endif #CONFIG_LINUX_USER |
| 100 | |
| 101 | ######################################################### |
blueswir1 | 8477850 | 2008-10-26 20:33:16 +0000 | [diff] [blame] | 102 | # BSD user emulator target |
| 103 | |
| 104 | ifdef CONFIG_BSD_USER |
| 105 | |
Paolo Bonzini | b9a7b74 | 2013-06-04 14:45:26 +0200 | [diff] [blame] | 106 | QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR) |
blueswir1 | 8477850 | 2008-10-26 20:33:16 +0000 | [diff] [blame] | 107 | |
Paolo Bonzini | 7fc5152 | 2012-05-29 09:33:59 +0200 | [diff] [blame] | 108 | obj-y += bsd-user/ |
Paolo Bonzini | 8a09070 | 2012-12-20 15:40:20 +0100 | [diff] [blame] | 109 | obj-y += gdbstub.o user-exec.o |
blueswir1 | 8477850 | 2008-10-26 20:33:16 +0000 | [diff] [blame] | 110 | |
blueswir1 | 8477850 | 2008-10-26 20:33:16 +0000 | [diff] [blame] | 111 | endif #CONFIG_BSD_USER |
| 112 | |
| 113 | ######################################################### |
bellard | 40293e5 | 2008-01-31 11:32:10 +0000 | [diff] [blame] | 114 | # System emulator target |
Juan Quintela | 76dfdd2 | 2009-08-03 14:46:41 +0200 | [diff] [blame] | 115 | ifdef CONFIG_SOFTMMU |
Paolo Bonzini | fbe37ef | 2012-05-29 11:48:59 +0200 | [diff] [blame] | 116 | obj-y += arch_init.o cpus.o monitor.o gdbstub.o balloon.o ioport.o |
Andreas Färber | 872536b | 2013-02-16 22:44:03 +0100 | [diff] [blame] | 117 | obj-y += qtest.o |
Paolo Bonzini | c353f26 | 2012-05-29 11:49:34 +0200 | [diff] [blame] | 118 | obj-y += hw/ |
Paolo Bonzini | 320ba5f | 2013-02-05 12:36:30 +0100 | [diff] [blame] | 119 | obj-$(CONFIG_FDT) += device_tree.o |
Paolo Bonzini | fbe37ef | 2012-05-29 11:48:59 +0200 | [diff] [blame] | 120 | obj-$(CONFIG_KVM) += kvm-all.o |
Blue Swirl | 0cac1b6 | 2012-04-09 16:50:52 +0000 | [diff] [blame] | 121 | obj-y += memory.o savevm.o cputlb.o |
Andreas Färber | c22d8e0 | 2013-05-28 14:53:32 +0200 | [diff] [blame] | 122 | obj-y += memory_mapping.o |
Andreas Färber | 2a78636 | 2013-05-17 11:54:40 +0200 | [diff] [blame] | 123 | obj-y += dump.o |
Paolo Bonzini | f544a48 | 2013-04-17 16:26:44 +0200 | [diff] [blame] | 124 | LIBS+=$(libs_softmmu) |
bellard | 4fb240a | 2007-11-07 19:24:02 +0000 | [diff] [blame] | 125 | |
Anthony PERARD | 3285cf4 | 2010-08-19 12:27:56 +0100 | [diff] [blame] | 126 | # xen support |
Paolo Bonzini | c353f26 | 2012-05-29 11:49:34 +0200 | [diff] [blame] | 127 | obj-$(CONFIG_XEN) += xen-all.o xen-mapcache.o |
Anthony PERARD | 3285cf4 | 2010-08-19 12:27:56 +0100 | [diff] [blame] | 128 | obj-$(CONFIG_NO_XEN) += xen-stub.o |
| 129 | |
bellard | a541f29 | 2004-04-12 20:39:29 +0000 | [diff] [blame] | 130 | # Hardware support |
Paolo Bonzini | b9a7b74 | 2013-06-04 14:45:26 +0200 | [diff] [blame] | 131 | ifeq ($(TARGET_NAME), sparc64) |
Paolo Bonzini | 5e8861a | 2012-05-29 10:23:15 +0200 | [diff] [blame] | 132 | obj-y += hw/sparc64/ |
bellard | 3475187 | 2005-07-02 14:31:34 +0000 | [diff] [blame] | 133 | else |
Paolo Bonzini | 5e8861a | 2012-05-29 10:23:15 +0200 | [diff] [blame] | 134 | obj-y += hw/$(TARGET_BASE_ARCH)/ |
bellard | 3475187 | 2005-07-02 14:31:34 +0000 | [diff] [blame] | 135 | endif |
Juan Quintela | 9637443 | 2009-07-16 18:33:58 +0200 | [diff] [blame] | 136 | |
Blue Swirl | ad96090 | 2010-03-29 19:23:52 +0000 | [diff] [blame] | 137 | main.o: QEMU_CFLAGS+=$(GPROF_CFLAGS) |
blueswir1 | 5824d65 | 2009-03-28 06:44:27 +0000 | [diff] [blame] | 138 | |
Paolo Bonzini | 4115852 | 2012-05-29 12:41:34 +0200 | [diff] [blame] | 139 | GENERATED_HEADERS += hmp-commands.h qmp-commands-old.h |
Andreas Färber | 0e8c921 | 2010-01-06 20:24:05 +0100 | [diff] [blame] | 140 | |
Juan Quintela | 76dfdd2 | 2009-08-03 14:46:41 +0200 | [diff] [blame] | 141 | endif # CONFIG_SOFTMMU |
bellard | 00a67ba | 2006-10-28 12:19:07 +0000 | [diff] [blame] | 142 | |
Paolo Bonzini | cbdd199 | 2012-11-28 09:40:23 +0100 | [diff] [blame] | 143 | # Workaround for http://gcc.gnu.org/PR55489, see configure. |
| 144 | %/translate.o: QEMU_CFLAGS += $(TRANSLATE_OPT_CFLAGS) |
| 145 | |
Paolo Bonzini | 99100dc | 2012-05-22 13:41:27 +0200 | [diff] [blame] | 146 | nested-vars += obj-y |
| 147 | |
| 148 | # This resolves all nested paths, so it must come last |
| 149 | include $(SRC_PATH)/Makefile.objs |
| 150 | |
| 151 | all-obj-y = $(obj-y) |
Paolo Bonzini | 0008234 | 2013-01-19 11:06:47 +0100 | [diff] [blame] | 152 | all-obj-y += $(addprefix ../, $(common-obj-y)) |
Paolo Bonzini | 7fc5152 | 2012-05-29 09:33:59 +0200 | [diff] [blame] | 153 | |
Paolo Bonzini | f544a48 | 2013-04-17 16:26:44 +0200 | [diff] [blame] | 154 | ifndef CONFIG_HAIKU |
| 155 | LIBS+=-lm |
| 156 | endif |
| 157 | |
Stefan Weil | 0fa5491 | 2011-12-22 11:18:53 +0100 | [diff] [blame] | 158 | ifdef QEMU_PROGW |
| 159 | # The linker builds a windows executable. Make also a console executable. |
Paolo Bonzini | 8a09070 | 2012-12-20 15:40:20 +0100 | [diff] [blame] | 160 | $(QEMU_PROGW): $(all-obj-y) ../libqemuutil.a ../libqemustub.a |
Stefan Weil | 0fa5491 | 2011-12-22 11:18:53 +0100 | [diff] [blame] | 161 | $(call LINK,$^) |
| 162 | $(QEMU_PROG): $(QEMU_PROGW) |
| 163 | $(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_PROG)," GEN $(TARGET_DIR)$(QEMU_PROG)") |
| 164 | else |
Paolo Bonzini | 8a09070 | 2012-12-20 15:40:20 +0100 | [diff] [blame] | 165 | $(QEMU_PROG): $(all-obj-y) ../libqemuutil.a ../libqemustub.a |
Lluís | e03b41d | 2011-08-31 20:30:30 +0200 | [diff] [blame] | 166 | $(call LINK,$^) |
Stefan Weil | 0fa5491 | 2011-12-22 11:18:53 +0100 | [diff] [blame] | 167 | endif |
Juan Quintela | 1639448 | 2009-07-16 18:34:04 +0200 | [diff] [blame] | 168 | |
Blue Swirl | 4c3b5a4 | 2011-01-20 20:54:21 +0000 | [diff] [blame] | 169 | gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh |
| 170 | $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES)," GEN $(TARGET_DIR)$@") |
pbrook | 56aebc8 | 2008-10-11 17:55:29 +0000 | [diff] [blame] | 171 | |
Luiz Capitulino | acd0a09 | 2010-09-30 16:00:22 -0300 | [diff] [blame] | 172 | hmp-commands.h: $(SRC_PATH)/hmp-commands.hx |
Blue Swirl | 4c3b5a4 | 2011-01-20 20:54:21 +0000 | [diff] [blame] | 173 | $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@") |
Blue Swirl | 2313086 | 2009-06-06 08:22:04 +0000 | [diff] [blame] | 174 | |
Anthony Liguori | e319360 | 2011-09-02 12:34:47 -0500 | [diff] [blame] | 175 | qmp-commands-old.h: $(SRC_PATH)/qmp-commands.hx |
Blue Swirl | 4c3b5a4 | 2011-01-20 20:54:21 +0000 | [diff] [blame] | 176 | $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@") |
blueswir1 | 5824d65 | 2009-03-28 06:44:27 +0000 | [diff] [blame] | 177 | |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 178 | clean: |
Peter Maydell | b54fa7d | 2012-06-20 18:02:33 +0100 | [diff] [blame] | 179 | rm -f *.a *~ $(PROGS) |
| 180 | rm -f $(shell find . -name '*.[od]') |
Anthony Liguori | e319360 | 2011-09-02 12:34:47 -0500 | [diff] [blame] | 181 | rm -f hmp-commands.h qmp-commands-old.h gdbstub-xml.c |
Lluís | 6d8a764 | 2011-08-31 20:30:43 +0200 | [diff] [blame] | 182 | ifdef CONFIG_TRACE_SYSTEMTAP |
Daniel P. Berrange | c276b17 | 2010-11-12 13:20:25 +0000 | [diff] [blame] | 183 | rm -f *.stp |
| 184 | endif |
bellard | 1e43adf | 2003-09-30 20:54:24 +0000 | [diff] [blame] | 185 | |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 186 | install: all |
bellard | 9b14bb0 | 2004-03-26 22:43:34 +0000 | [diff] [blame] | 187 | ifneq ($(PROGS),) |
Hollis Blanchard | 52ba784 | 2010-08-04 17:21:34 -0700 | [diff] [blame] | 188 | $(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)" |
| 189 | ifneq ($(STRIP),) |
| 190 | $(STRIP) $(patsubst %,"$(DESTDIR)$(bindir)/%",$(PROGS)) |
| 191 | endif |
bellard | 9b14bb0 | 2004-03-26 22:43:34 +0000 | [diff] [blame] | 192 | endif |
Lluís | 6d8a764 | 2011-08-31 20:30:43 +0200 | [diff] [blame] | 193 | ifdef CONFIG_TRACE_SYSTEMTAP |
Eduardo Habkost | 6aae2a2 | 2012-04-18 16:55:41 -0300 | [diff] [blame] | 194 | $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset" |
Alon Levy | c14518e | 2013-06-14 15:19:07 +0100 | [diff] [blame] | 195 | $(INSTALL_DATA) $(QEMU_PROG).stp-installed "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG).stp" |
Daniel P. Berrange | c276b17 | 2010-11-12 13:20:25 +0000 | [diff] [blame] | 196 | endif |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 197 | |
Paolo Bonzini | 4115852 | 2012-05-29 12:41:34 +0200 | [diff] [blame] | 198 | GENERATED_HEADERS += config-target.h |
| 199 | Makefile: $(GENERATED_HEADERS) |