blob: bad0e3142a6de930b171dbbcec1f0ae97e87ad0a [file] [log] [blame]
pbrook0cb3fb12006-05-14 12:07:53 +00001# Makefile for QEMU.
2
Stefan Weil519e1692011-09-16 21:50:43 +02003# Always point to the root of the build tree (needs GNU make).
4BUILD_DIR=$(CURDIR)
Lluís Vilanova388d4752011-09-15 22:45:35 +02005
Lluís Vilanova250b0862012-03-06 19:50:38 +01006# All following code might depend on configuration variables
aurel3255d7e8f2009-04-15 14:42:57 +00007ifneq ($(wildcard config-host.mak),)
Paul Brook1ad21342009-05-19 16:17:58 +01008# Put the all: rule here so that config-host.mak can contain dependencies.
9all: build-all
pbrookad064842006-04-16 12:41:07 +000010include config-host.mak
aliguori17759182009-01-21 18:12:52 +000011include $(SRC_PATH)/rules.mak
Paolo Bonzini59bc10e2010-01-04 11:02:28 +010012config-host.mak: $(SRC_PATH)/configure
Juan Quintelae5efe7f2009-10-07 02:40:59 +020013 @echo $@ is out-of-date, running configure
14 @sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh
aurel3255d7e8f2009-04-15 14:42:57 +000015else
16config-host.mak:
17 @echo "Please call configure before running make!"
18 @exit 1
19endif
bellard766a4872003-02-18 23:35:48 +000020
Lluís Vilanova250b0862012-03-06 19:50:38 +010021GENERATED_HEADERS = config-host.h trace.h qemu-options.def
22ifeq ($(TRACE_BACKEND),dtrace)
23GENERATED_HEADERS += trace-dtrace.h
24endif
25GENERATED_HEADERS += qmp-commands.h qapi-types.h qapi-visit.h
Lluís Vilanova19ac36b2012-04-18 20:15:39 +020026GENERATED_SOURCES += qmp-marshal.c qapi-types.c qapi-visit.c trace.c
Lluís Vilanova250b0862012-03-06 19:50:38 +010027
Juan Quintelad9ace8b2009-10-06 21:11:15 +020028# Don't try to regenerate Makefile or configure
29# We don't generate any of them
30Makefile: ;
31configure: ;
32
aliguori818220f2008-09-24 01:13:40 +000033.PHONY: all clean cscope distclean dvi html info install install-doc \
Stefan Weil20cc9992010-01-29 23:16:50 +010034 pdf recurse-all speed tar tarbin test build-all
pbrook0cb3fb12006-05-14 12:07:53 +000035
Paolo Bonzinifec90ff2012-05-29 11:49:50 +020036$(call set-vpath, $(SRC_PATH))
pbrook8c462f82007-11-18 21:12:37 +000037
Juan Quintela3e2e0e62009-08-03 14:47:06 +020038LIBS+=-lz $(LIBS_TOOLS)
Juan Quintela67c0f082009-07-27 16:12:51 +020039
Corey Bryant7b93fad2012-01-26 09:42:24 -050040HELPERS-$(CONFIG_LINUX) = qemu-bridge-helper$(EXESUF)
41
pbrookcc8ae6d2006-04-23 17:57:59 +000042ifdef BUILD_DOCS
Jan Kiszkab40292e2010-05-31 14:43:31 -030043DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 QMP/qmp-commands.txt
Meador Inge983eef52012-02-24 14:00:42 +053044ifdef CONFIG_VIRTFS
M. Mohan Kumara2d8f1b2011-12-14 13:58:47 +053045DOCS+=fsdev/virtfs-proxy-helper.1
Meador Inge983eef52012-02-24 14:00:42 +053046endif
pbrookcc8ae6d2006-04-23 17:57:59 +000047else
48DOCS=
49endif
bellard7d132992003-03-06 23:23:54 +000050
Lluís Vilanova388d4752011-09-15 22:45:35 +020051SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory) BUILD_DIR=$(BUILD_DIR)
Juan Quintela1f3d3c82009-10-07 02:41:02 +020052SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
Paul Brookbd9141b2010-11-26 18:47:45 +000053SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %/config-devices.mak.d, $(TARGET_DIRS))
Juan Quintela1f3d3c82009-10-07 02:41:02 +020054
55config-all-devices.mak: $(SUBDIR_DEVICES_MAK)
Stefan Weil01d86a82009-11-19 20:19:56 +010056 $(call quiet-command,cat $(SUBDIR_DEVICES_MAK) | grep =y | sort -u > $@," GEN $@")
Juan Quintela1f3d3c82009-10-07 02:41:02 +020057
Paul Brookbd9141b2010-11-26 18:47:45 +000058-include $(SUBDIR_DEVICES_MAK_DEP)
59
Paul Brooka992fe32009-11-22 16:25:30 +000060%/config-devices.mak: default-configs/%.mak
Blue Swirl4c3b5a42011-01-20 20:54:21 +000061 $(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $@ $<, " GEN $@")
Stefan Weil012f0872009-12-20 15:39:03 +010062 @if test -f $@; then \
Blue Swirl904fe1f2010-10-02 14:28:08 +000063 if cmp -s $@.old $@; then \
Paul Brookbd9141b2010-11-26 18:47:45 +000064 mv $@.tmp $@; \
65 cp -p $@ $@.old; \
Stefan Weil012f0872009-12-20 15:39:03 +010066 else \
67 if test -f $@.old; then \
68 echo "WARNING: $@ (user modified) out of date.";\
69 else \
70 echo "WARNING: $@ out of date.";\
71 fi; \
72 echo "Run \"make defconfig\" to regenerate."; \
73 rm $@.tmp; \
74 fi; \
Paul Brooka992fe32009-11-22 16:25:30 +000075 else \
Stefan Weil012f0872009-12-20 15:39:03 +010076 mv $@.tmp $@; \
77 cp -p $@ $@.old; \
Paul Brooka992fe32009-11-22 16:25:30 +000078 fi
79
80defconfig:
81 rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)
82
Juan Quintela1f3d3c82009-10-07 02:41:02 +020083-include config-all-devices.mak
Juan Quintela1215c6e2009-10-07 02:40:58 +020084
Corey Bryant7b93fad2012-01-26 09:42:24 -050085build-all: $(DOCS) $(TOOLS) $(HELPERS-y) recurse-all
pbrookb9dea4f2006-05-13 16:54:03 +000086
Juan Quintela1215c6e2009-10-07 02:40:58 +020087config-host.h: config-host.h-timestamp
88config-host.h-timestamp: config-host.mak
Blue Swirle14056a2010-11-01 18:09:38 +000089qemu-options.def: $(SRC_PATH)/qemu-options.hx
Blue Swirl4c3b5a42011-01-20 20:54:21 +000090 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $@")
Juan Quintela1215c6e2009-10-07 02:40:58 +020091
pbrookcec7d0b2008-05-28 16:44:57 +000092SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
93
Paolo Bonzini41158522012-05-29 12:41:34 +020094subdir-%:
Paul Brook00873752009-05-07 02:00:31 +010095 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
pbrook4aa42532006-05-13 13:55:08 +000096
Stefan Weilb88bc802010-01-14 18:11:43 +010097ifneq ($(wildcard config-host.mak),)
Andreas Färber0e8c9212010-01-06 20:24:05 +010098include $(SRC_PATH)/Makefile.objs
Stefan Weilb88bc802010-01-14 18:11:43 +010099endif
Andreas Färber0e8c9212010-01-06 20:24:05 +0100100
Anthony Liguori41a74822011-08-20 22:23:03 -0500101subdir-libcacard: $(oslib-obj-y) $(trace-obj-y) qemu-timer-common.o
Paolo Bonzini6774e442011-05-02 09:54:03 +0200102
Paolo Bonziniee204772012-05-22 13:46:08 +0200103$(filter %-softmmu,$(SUBDIR_RULES)): $(universal-obj-y) $(trace-obj-y) $(common-obj-y) $(extra-obj-y) subdir-libdis
Paul Brookc05ac892009-07-31 13:18:32 +0100104
Paolo Bonzini41158522012-05-29 12:41:34 +0200105$(filter %-user,$(SUBDIR_RULES)): $(universal-obj-y) $(trace-obj-y) subdir-libdis-user subdir-libuser
Blue Swirladd16152009-09-27 16:26:02 +0000106
Paul Brookc05ac892009-07-31 13:18:32 +0100107ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
108romsubdir-%:
109 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pc-bios/$* V="$(V)" TARGET_DIR="$*/",)
110
111ALL_SUBDIRS=$(TARGET_DIRS) $(patsubst %,pc-bios/%, $(ROMS))
112
113recurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES)
bellard83f64092006-08-01 16:21:11 +0000114
Juan Quintela98b068a2009-08-03 14:46:57 +0200115audio/audio.o audio/fmodaudio.o: QEMU_CFLAGS += $(FMOD_CFLAGS)
Juan Quintela0e22fd22009-06-25 00:08:09 +0200116
Juan Quintelaa558ee12009-08-03 14:46:21 +0200117QEMU_CFLAGS+=$(CURL_CFLAGS)
Alexander Graf769ce762009-05-11 17:41:42 +0200118
Anthony Liguori2f28d2f2011-12-03 17:10:08 -0600119QEMU_CFLAGS += -I$(SRC_PATH)/include
120
Corentin Chary3e230dd2010-07-07 20:57:52 +0200121ui/cocoa.o: ui/cocoa.m
bellard4fb240a2007-11-07 19:24:02 +0000122
Paolo Bonzini3d5a3f92012-05-29 11:08:47 +0200123ui/sdl.o audio/sdlaudio.o ui/sdl_zoom.o hw/baum.o: QEMU_CFLAGS += $(SDL_CFLAGS)
aliguori04837552009-03-06 20:27:10 +0000124
Corentin Chary3e230dd2010-07-07 20:57:52 +0200125ui/vnc.o: QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
balrog4d3b6f62008-02-10 16:33:14 +0000126
Juan Quintelaa558ee12009-08-03 14:46:21 +0200127bt-host.o: QEMU_CFLAGS += $(BLUEZ_CFLAGS)
bellard4fb240a2007-11-07 19:24:02 +0000128
Blue Swirl7948a662011-09-04 09:32:55 +0000129version.o: $(SRC_PATH)/version.rc config-host.h
Blue Swirl9fe6de92010-09-26 16:07:57 +0000130 $(call quiet-command,$(WINDRES) -I. -o $@ $<," RC $(TARGET_DIR)$@")
131
132version-obj-$(CONFIG_WIN32) += version.o
bellard4fb240a2007-11-07 19:24:02 +0000133######################################################################
Alon Levy44dc0ca2011-05-15 11:51:28 +0300134# Support building shared library libcacard
135
136.PHONY: libcacard.la install-libcacard
137ifeq ($(LIBTOOL),)
138libcacard.la:
139 @echo "libtool is missing, please install and rerun configure"; exit 1
140
141install-libcacard:
142 @echo "libtool is missing, please install and rerun configure"; exit 1
143else
Paolo Bonzini41158522012-05-29 12:41:34 +0200144libcacard.la: $(oslib-obj-y) qemu-timer-common.o $(addsuffix .lo, $(basename $(trace-obj-y)))
Alon Levy44dc0ca2011-05-15 11:51:28 +0300145 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C libcacard V="$(V)" TARGET_DIR="$*/" libcacard.la,)
146
147install-libcacard: libcacard.la
148 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C libcacard V="$(V)" TARGET_DIR="$*/" install-libcacard,)
149endif
Paolo Bonzini00c705f2012-05-29 11:40:24 +0200150
Blue Swirl47ecbdf2012-06-10 10:18:54 +0000151vscclient$(EXESUF): $(libcacard-y) $(oslib-obj-y) $(trace-obj-y) qemu-timer-common.o libcacard/vscclient.o
152 $(call quiet-command,$(CC) $(LDFLAGS) -o $@ $^ $(libcacard_libs) $(LIBS)," LINK $@")
Paolo Bonzini00c705f2012-05-29 11:40:24 +0200153
Alon Levy44dc0ca2011-05-15 11:51:28 +0300154######################################################################
bellard4fb240a2007-11-07 19:24:02 +0000155
Juan Quintela3c089e12010-01-20 20:54:18 +0100156qemu-img.o: qemu-img-cmds.h
Stuart Brady153859b2009-06-07 00:42:17 +0100157
Paolo Bonzinicbcfa042011-09-12 16:20:11 +0200158tools-obj-y = $(oslib-obj-y) $(trace-obj-y) qemu-tool.o qemu-timer.o \
159 qemu-timer-common.o main-loop.o notify.o iohandler.o cutils.o async.o
160tools-obj-$(CONFIG_POSIX) += compatfd.o
bellard4fb240a2007-11-07 19:24:02 +0000161
Paolo Bonzini4ab328d2011-10-24 13:33:01 +0200162qemu-img$(EXESUF): qemu-img.o $(tools-obj-y) $(block-obj-y)
163qemu-nbd$(EXESUF): qemu-nbd.o $(tools-obj-y) $(block-obj-y)
164qemu-io$(EXESUF): qemu-io.o cmd.o $(tools-obj-y) $(block-obj-y)
aliguori0a8e1ac2009-04-05 18:41:23 +0000165
Corey Bryant7b93fad2012-01-26 09:42:24 -0500166qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o
167
M. Mohan Kumarea75fc42011-12-14 13:58:45 +0530168fsdev/virtfs-proxy-helper$(EXESUF): fsdev/virtfs-proxy-helper.o fsdev/virtio-9p-marshal.o oslib-posix.o $(trace-obj-y)
M. Mohan Kumar17bff522011-12-14 13:58:42 +0530169fsdev/virtfs-proxy-helper$(EXESUF): LIBS += -lcap
170
Stuart Brady153859b2009-06-07 00:42:17 +0100171qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
Blue Swirl4c3b5a42011-01-20 20:54:21 +0000172 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $@")
Stuart Brady153859b2009-06-07 00:42:17 +0100173
Michael Roth957f1f92011-08-11 15:38:12 -0500174qemu-ga$(EXESUF): LIBS = $(LIBS_QGA)
Stefan Weil8f0e5c6bb2012-06-09 09:08:39 +0200175qemu-ga$(EXESUF): QEMU_CFLAGS += -I qapi-generated
Michael Roth640e5402011-07-19 14:50:44 -0500176
Avi Kivity19bf7c82011-12-28 12:26:58 +0200177gen-out-type = $(subst .,-,$(suffix $@))
Avi Kivity8d3bc512011-12-27 16:02:16 +0200178
Andreas Färbere454e2e2012-01-17 13:16:05 +0100179ifneq ($(wildcard config-host.mak),)
Anthony Liguoridbfe06c2012-01-10 13:10:43 -0600180include $(SRC_PATH)/tests/Makefile
Andreas Färbere454e2e2012-01-17 13:16:05 +0100181endif
Michael Roth640e5402011-07-19 14:50:44 -0500182
Stefan Weil8f0e5c6bb2012-06-09 09:08:39 +0200183qapi-generated/qga-qapi-types.c qapi-generated/qga-qapi-types.h :\
Michael S. Tsirkin599825c2011-11-16 23:58:18 +0200184$(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-types.py
Stefan Weil8f0e5c6bb2012-06-09 09:08:39 +0200185 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o qapi-generated -p "qga-" < $<, " GEN $@")
186qapi-generated/qga-qapi-visit.c qapi-generated/qga-qapi-visit.h :\
Michael S. Tsirkin599825c2011-11-16 23:58:18 +0200187$(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-visit.py
Stefan Weil8f0e5c6bb2012-06-09 09:08:39 +0200188 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py $(gen-out-type) -o qapi-generated -p "qga-" < $<, " GEN $@")
189qapi-generated/qga-qmp-commands.h qapi-generated/qga-qmp-marshal.c :\
Michael S. Tsirkin599825c2011-11-16 23:58:18 +0200190$(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-commands.py
Stefan Weil8f0e5c6bb2012-06-09 09:08:39 +0200191 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py $(gen-out-type) -o qapi-generated -p "qga-" < $<, " GEN $@")
Michael Rothe3d4d252011-07-19 15:41:55 -0500192
Michael S. Tsirkin599825c2011-11-16 23:58:18 +0200193qapi-types.c qapi-types.h :\
194$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-types.py
Avi Kivity8d3bc512011-12-27 16:02:16 +0200195 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o "." < $<, " GEN $@")
Michael S. Tsirkin599825c2011-11-16 23:58:18 +0200196qapi-visit.c qapi-visit.h :\
197$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-visit.py
Avi Kivity8d3bc512011-12-27 16:02:16 +0200198 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py $(gen-out-type) -o "." < $<, " GEN $@")
Michael S. Tsirkin599825c2011-11-16 23:58:18 +0200199qmp-commands.h qmp-marshal.c :\
200$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py
Avi Kivity8d3bc512011-12-27 16:02:16 +0200201 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py $(gen-out-type) -m -o "." < $<, " GEN $@")
Anthony Liguorie3193602011-09-02 12:34:47 -0500202
Stefan Weil8f0e5c6bb2012-06-09 09:08:39 +0200203QGALIB_OBJ=$(addprefix qapi-generated/, qga-qapi-types.o qga-qapi-visit.o qga-qmp-marshal.o)
204QGALIB_GEN=$(addprefix qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qmp-commands.h)
Paolo Bonzini41158522012-05-29 12:41:34 +0200205$(QGALIB_OBJ): $(QGALIB_GEN)
206$(qga-obj-y) qemu-ga.o: $(QGALIB_GEN)
Michael Roth957f1f92011-08-11 15:38:12 -0500207
Michael Rothd8ca6852012-01-19 22:04:34 -0600208qemu-ga$(EXESUF): qemu-ga.o $(qga-obj-y) $(tools-obj-y) $(qapi-obj-y) $(qobject-obj-y) $(version-obj-y) $(QGALIB_OBJ)
Michael Roth48ff7a62011-07-20 15:19:37 -0500209
Robert Relyea111a38b2010-11-28 16:36:38 +0200210QEMULIBS=libhw32 libhw64 libuser libdis libdis-user
211
bellard31e31b82003-02-18 22:55:36 +0000212clean:
bellard2d80ae82003-08-11 23:01:33 +0000213# avoid old build problems by removing potentially incorrect old files
Juan Quintela25be210f2009-10-07 02:41:00 +0200214 rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
Michael S. Tsirkindf2943b2010-10-26 17:53:41 +0200215 rm -f qemu-options.def
Corey Bryant7b93fad2012-01-26 09:42:24 -0500216 rm -f *.o *.d *.a *.lo $(TOOLS) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~
Alon Levy44dc0ca2011-05-15 11:51:28 +0300217 rm -Rf .libs
Michael Roth13a286d2011-07-19 15:41:53 -0500218 rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d block/*.o block/*.d net/*.o net/*.d fsdev/*.o fsdev/*.d ui/*.o ui/*.d qapi/*.o qapi/*.d qga/*.o qga/*.d
Anthony PERARD53fbf7b2012-04-02 16:10:39 +0100219 rm -f qom/*.o qom/*.d
Paolo Bonzini3d5a3f92012-05-29 11:08:47 +0200220 rm -f usb/*.o usb/*.d hw/*.o hw/*.d
Blue Swirl07b44ce2009-06-09 18:45:16 +0000221 rm -f qemu-img-cmds.h
Lluísedb47ec2011-08-31 20:30:57 +0200222 rm -f trace/*.o trace/*.d
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +0000223 rm -f trace-dtrace.dtrace trace-dtrace.dtrace-timestamp
Lluís Vilanova19ac36b2012-04-18 20:15:39 +0200224 @# May not be present in GENERATED_HEADERS
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +0000225 rm -f trace-dtrace.h trace-dtrace.h-timestamp
Lluís Vilanova19ac36b2012-04-18 20:15:39 +0200226 rm -f $(foreach f,$(GENERATED_HEADERS),$(f) $(f)-timestamp)
227 rm -f $(foreach f,$(GENERATED_SOURCES),$(f) $(f)-timestamp)
Stefan Weil8f0e5c6bb2012-06-09 09:08:39 +0200228 rm -rf qapi-generated
Anthony Liguoric09015d2012-01-10 13:10:42 -0600229 $(MAKE) -C tests/tcg clean
Robert Relyea111a38b2010-11-28 16:36:38 +0200230 for d in $(ALL_SUBDIRS) $(QEMULIBS) libcacard; do \
Magnus Dammfc8e3202009-11-13 18:51:05 +0900231 if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
Michael S. Tsirkindf2943b2010-10-26 17:53:41 +0200232 rm -f $$d/qemu-options.def; \
bellard626df762003-08-10 21:39:31 +0000233 done
bellard31e31b82003-02-18 22:55:36 +0000234
bellard7d132992003-03-06 23:23:54 +0000235distclean: clean
Magnus Dammfc8e3202009-11-13 18:51:05 +0900236 rm -f config-host.mak config-host.h* config-host.ld $(DOCS) qemu-options.texi qemu-img-cmds.texi qemu-monitor.texi
Paul Brooka992fe32009-11-22 16:25:30 +0000237 rm -f config-all-devices.mak
Magnus Dammfc8e3202009-11-13 18:51:05 +0900238 rm -f roms/seabios/config.mak roms/vgabios/config.mak
Brad Hards7a734b82011-04-13 16:42:16 +1000239 rm -f qemu-doc.info qemu-doc.aux qemu-doc.cp qemu-doc.cps qemu-doc.dvi
240 rm -f qemu-doc.fn qemu-doc.fns qemu-doc.info qemu-doc.ky qemu-doc.kys
241 rm -f qemu-doc.log qemu-doc.pdf qemu-doc.pg qemu-doc.toc qemu-doc.tp
242 rm -f qemu-doc.vr
Alexandre Raymond793553a2011-07-25 23:56:02 -0400243 rm -f config.log
Peter Maydell67ed96f2012-02-01 18:50:42 +0000244 rm -f linux-headers/asm
Hidetoshi Setoe1a068b2010-07-08 14:26:18 +0900245 rm -f qemu-tech.info qemu-tech.aux qemu-tech.cp qemu-tech.dvi qemu-tech.fn qemu-tech.info qemu-tech.ky qemu-tech.log qemu-tech.pdf qemu-tech.pg qemu-tech.toc qemu-tech.tp qemu-tech.vr
Robert Relyea111a38b2010-11-28 16:36:38 +0200246 for d in $(TARGET_DIRS) $(QEMULIBS); do \
bellardbc1b0502003-10-28 00:12:52 +0000247 rm -rf $$d || exit 1 ; \
bellard76bc6832003-08-10 23:41:46 +0000248 done
bellard7d132992003-03-06 23:23:54 +0000249
bellardfed4a9a2004-12-12 22:18:34 +0000250KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \
251ar de en-us fi fr-be hr it lv nl pl ru th \
Frédéric Boiteux471fbf42012-06-08 20:06:25 +0200252common de-ch es fo fr-ca hu ja mk nl-be pt sl tr \
253bepo
bellardfed4a9a2004-12-12 22:18:34 +0000254
ths77755342008-11-27 15:45:16 +0000255ifdef INSTALL_BLOBS
Paolo Bonzini63298662011-11-03 15:14:00 +0100256BLOBS=bios.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
Gerd Hoffmann7943a2f2010-11-30 11:54:33 +0100257vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin \
Gerd Hoffmann3b3d4482010-08-23 12:10:46 +0200258ppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc \
Alex Williamson5ee8ad72011-04-18 11:46:01 -0600259pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
260pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
Stefan Weil94b26292012-04-13 22:24:42 +0200261qemu-icon.bmp \
Michal Simek00914b72011-03-14 11:29:19 +0100262bamboo.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
Jan Kiszka2a2af962012-02-17 18:31:18 +0100263multiboot.bin linuxboot.bin kvmvapic.bin \
David Gibson39ac8452011-04-01 15:15:23 +1100264s390-zipl.rom \
Richard Henderson753d11f2011-06-24 11:58:37 -0700265spapr-rtas.bin slof.bin \
266palcode-clipper
ths77755342008-11-27 15:45:16 +0000267else
268BLOBS=
269endif
270
pbrook38954dc2006-04-30 23:54:18 +0000271install-doc: $(DOCS)
Eduardo Habkostd7dd65b2012-04-18 16:55:44 -0300272 $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)"
273 $(INSTALL_DATA) qemu-doc.html qemu-tech.html "$(DESTDIR)$(qemu_docdir)"
Bruce Rogers0cd23fc2012-06-13 16:29:17 -0600274 $(INSTALL_DATA) QMP/qmp-commands.txt "$(DESTDIR)$(qemu_docdir)"
Juan Quintela96d409e2009-08-03 14:47:00 +0200275ifdef CONFIG_POSIX
aliguori58f8aea2009-04-18 15:36:02 +0000276 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
277 $(INSTALL_DATA) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
278 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
279 $(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
pbrook38954dc2006-04-30 23:54:18 +0000280endif
M. Mohan Kumara2d8f1b2011-12-14 13:58:47 +0530281ifdef CONFIG_VIRTFS
282 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
283 $(INSTALL_DATA) fsdev/virtfs-proxy-helper.1 "$(DESTDIR)$(mandir)/man1"
284endif
john cooperb5ec5ce2010-02-20 11:14:59 -0600285
Eduardo Habkoste2d87bf2012-05-02 13:07:30 -0300286install-datadir:
287 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)"
288
289install-confdir:
290 $(INSTALL_DIR) "$(DESTDIR)$(qemu_confdir)"
291
292install-sysconfig: install-datadir install-confdir
293 $(INSTALL_DATA) $(SRC_PATH)/sysconfigs/target/target-x86_64.conf "$(DESTDIR)$(qemu_confdir)"
294 $(INSTALL_DATA) $(SRC_PATH)/sysconfigs/target/cpus-x86_64.conf "$(DESTDIR)$(qemu_datadir)"
295
296install: all $(if $(BUILD_DOCS),install-doc) install-sysconfig install-datadir
aliguori58f8aea2009-04-18 15:36:02 +0000297 $(INSTALL_DIR) "$(DESTDIR)$(bindir)"
ths932a79d2007-10-20 18:29:34 +0000298ifneq ($(TOOLS),)
aliguori58f8aea2009-04-18 15:36:02 +0000299 $(INSTALL_PROG) $(STRIP_OPT) $(TOOLS) "$(DESTDIR)$(bindir)"
ths932a79d2007-10-20 18:29:34 +0000300endif
Corey Bryant7b93fad2012-01-26 09:42:24 -0500301ifneq ($(HELPERS-y),)
302 $(INSTALL_DIR) "$(DESTDIR)$(libexecdir)"
303 $(INSTALL_PROG) $(STRIP_OPT) $(HELPERS-y) "$(DESTDIR)$(libexecdir)"
304endif
ths77755342008-11-27 15:45:16 +0000305ifneq ($(BLOBS),)
ths77755342008-11-27 15:45:16 +0000306 set -e; for x in $(BLOBS); do \
Eduardo Habkost6aae2a22012-04-18 16:55:41 -0300307 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(qemu_datadir)"; \
pbrookad064842006-04-16 12:41:07 +0000308 done
ths77755342008-11-27 15:45:16 +0000309endif
Eduardo Habkost6aae2a22012-04-18 16:55:41 -0300310 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/keymaps"
blueswir118be8d72008-03-05 18:16:09 +0000311 set -e; for x in $(KEYMAPS); do \
Eduardo Habkost6aae2a22012-04-18 16:55:41 -0300312 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
pbrookad064842006-04-16 12:41:07 +0000313 done
bellard626df762003-08-10 21:39:31 +0000314 for d in $(TARGET_DIRS); do \
bellard7d3505c2004-05-12 19:32:15 +0000315 $(MAKE) -C $$d $@ || exit 1 ; \
bellard626df762003-08-10 21:39:31 +0000316 done
bellard612384d2003-03-22 17:31:19 +0000317
bellard367e86e2003-03-01 17:13:26 +0000318# various test targets
bellard9b0b8202007-11-14 10:34:57 +0000319test speed: all
Anthony Liguoric09015d2012-01-10 13:10:42 -0600320 $(MAKE) -C tests/tcg $@
bellard31e31b82003-02-18 22:55:36 +0000321
Alexandre Bique21d4e8e2009-08-07 15:43:11 +0100322.PHONY: TAGS
ths5fafdf22007-09-16 21:08:06 +0000323TAGS:
Alexandre Bique21d4e8e2009-08-07 15:43:11 +0100324 find "$(SRC_PATH)" -name '*.[hc]' -print0 | xargs -0 etags
bellard31e31b82003-02-18 22:55:36 +0000325
bellard6688bc62005-08-21 09:23:39 +0000326cscope:
327 rm -f ./cscope.*
Alexandre Raymond45b75ae2011-07-20 23:12:15 -0400328 find "$(SRC_PATH)" -name "*.[chsS]" -print | sed 's,^\./,,' > ./cscope.files
bellard6688bc62005-08-21 09:23:39 +0000329 cscope -b
330
bellard3ef693a2003-03-23 20:17:16 +0000331# documentation
Stefan Weil01668d92010-03-04 22:21:02 +0100332MAKEINFO=makeinfo
333MAKEINFOFLAGS=--no-headers --no-split --number-sections
Stefan Weil20cc9992010-01-29 23:16:50 +0100334TEXIFLAG=$(if $(V),,--quiet)
335%.dvi: %.texi
336 $(call quiet-command,texi2dvi $(TEXIFLAG) -I . $<," GEN $@")
337
bellard1f673132004-04-04 15:21:17 +0000338%.html: %.texi
Stefan Weil952ef672012-03-27 19:15:27 +0200339 $(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --html $< -o $@, \
Stefan Weil01668d92010-03-04 22:21:02 +0100340 " GEN $@")
bellard3ef693a2003-03-23 20:17:16 +0000341
bellardf3548322006-04-30 22:51:54 +0000342%.info: %.texi
Stefan Weil01668d92010-03-04 22:21:02 +0100343 $(call quiet-command,$(MAKEINFO) $< -o $@," GEN $@")
bellardf3548322006-04-30 22:51:54 +0000344
Stefan Weil20cc9992010-01-29 23:16:50 +0100345%.pdf: %.texi
346 $(call quiet-command,texi2pdf $(TEXIFLAG) -I . $<," GEN $@")
blueswir15824d652009-03-28 06:44:27 +0000347
348qemu-options.texi: $(SRC_PATH)/qemu-options.hx
Blue Swirl4c3b5a42011-01-20 20:54:21 +0000349 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@," GEN $@")
bellardf3548322006-04-30 22:51:54 +0000350
Luiz Capitulinoacd0a092010-09-30 16:00:22 -0300351qemu-monitor.texi: $(SRC_PATH)/hmp-commands.hx
Blue Swirl4c3b5a42011-01-20 20:54:21 +0000352 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@," GEN $@")
Blue Swirl23130862009-06-06 08:22:04 +0000353
Luiz Capitulino82a56f02010-09-13 12:26:00 -0300354QMP/qmp-commands.txt: $(SRC_PATH)/qmp-commands.hx
Blue Swirl4c3b5a42011-01-20 20:54:21 +0000355 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -q < $< > $@," GEN $@")
Jan Kiszkab40292e2010-05-31 14:43:31 -0300356
Stuart Brady153859b2009-06-07 00:42:17 +0100357qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx
Blue Swirl4c3b5a42011-01-20 20:54:21 +0000358 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@," GEN $@")
Stuart Brady153859b2009-06-07 00:42:17 +0100359
Blue Swirl23130862009-06-06 08:22:04 +0000360qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi
aliguori0d00e562009-04-05 17:40:46 +0000361 $(call quiet-command, \
Blue Swirl4c3b5a42011-01-20 20:54:21 +0000362 perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu.pod && \
Michael Tokarev3179d692012-03-20 02:25:57 +0400363 $(POD2MAN) --section=1 --center=" " --release=" " qemu.pod > $@, \
aliguori0d00e562009-04-05 17:40:46 +0000364 " GEN $@")
bellard5a671352003-10-01 00:13:48 +0000365
Stuart Brady153859b2009-06-07 00:42:17 +0100366qemu-img.1: qemu-img.texi qemu-img-cmds.texi
aliguori0d00e562009-04-05 17:40:46 +0000367 $(call quiet-command, \
Blue Swirl4c3b5a42011-01-20 20:54:21 +0000368 perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu-img.pod && \
Michael Tokarev3179d692012-03-20 02:25:57 +0400369 $(POD2MAN) --section=1 --center=" " --release=" " qemu-img.pod > $@, \
aliguori0d00e562009-04-05 17:40:46 +0000370 " GEN $@")
bellardacd935e2004-11-15 22:57:26 +0000371
M. Mohan Kumara2d8f1b2011-12-14 13:58:47 +0530372fsdev/virtfs-proxy-helper.1: fsdev/virtfs-proxy-helper.texi
373 $(call quiet-command, \
374 perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< fsdev/virtfs-proxy-helper.pod && \
Michael Tokarev3179d692012-03-20 02:25:57 +0400375 $(POD2MAN) --section=1 --center=" " --release=" " fsdev/virtfs-proxy-helper.pod > $@, \
M. Mohan Kumara2d8f1b2011-12-14 13:58:47 +0530376 " GEN $@")
377
bellard7a5ca862008-05-27 21:13:40 +0000378qemu-nbd.8: qemu-nbd.texi
aliguori0d00e562009-04-05 17:40:46 +0000379 $(call quiet-command, \
Blue Swirl4c3b5a42011-01-20 20:54:21 +0000380 perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu-nbd.pod && \
Michael Tokarev3179d692012-03-20 02:25:57 +0400381 $(POD2MAN) --section=8 --center=" " --release=" " qemu-nbd.pod > $@, \
aliguori0d00e562009-04-05 17:40:46 +0000382 " GEN $@")
bellard7a5ca862008-05-27 21:13:40 +0000383
pbrook0cb3fb12006-05-14 12:07:53 +0000384dvi: qemu-doc.dvi qemu-tech.dvi
pbrook0cb3fb12006-05-14 12:07:53 +0000385html: qemu-doc.html qemu-tech.html
Stefan Weil20cc9992010-01-29 23:16:50 +0100386info: qemu-doc.info qemu-tech.info
387pdf: qemu-doc.pdf qemu-tech.pdf
pbrook0cb3fb12006-05-14 12:07:53 +0000388
Stefan Weil20cc9992010-01-29 23:16:50 +0100389qemu-doc.dvi qemu-doc.html qemu-doc.info qemu-doc.pdf: \
390 qemu-img.texi qemu-nbd.texi qemu-options.texi \
391 qemu-monitor.texi qemu-img-cmds.texi
aliguori818220f2008-09-24 01:13:40 +0000392
thsdf5cf722007-01-24 22:56:36 +0000393VERSION ?= $(shell cat VERSION)
394FILE = qemu-$(VERSION)
bellard586314f2003-03-03 15:02:29 +0000395
bellard1e43adf2003-09-30 20:54:24 +0000396# tar release (use 'make -k tar' on a checkouted tree)
bellard586314f2003-03-03 15:02:29 +0000397tar:
398 rm -rf /tmp/$(FILE)
bellard1e43adf2003-09-30 20:54:24 +0000399 cp -r . /tmp/$(FILE)
aurel3299c6c082008-04-22 20:45:30 +0000400 cd /tmp && tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS --exclude .git --exclude .svn
bellard586314f2003-03-03 15:02:29 +0000401 rm -rf /tmp/$(FILE)
402
Paolo Bonzini41158522012-05-29 12:41:34 +0200403# Add a dependency on the generated files, so that they are always
404# rebuilt before other object files
405Makefile: $(GENERATED_HEADERS)
406
bellard4fb240a2007-11-07 19:24:02 +0000407# Include automatically generated dependency files
Anthony Liguoridcff25f2012-06-17 19:01:32 -0500408# All subdir dependencies come automatically from our recursive subdir rules
409-include $(wildcard *.d)