blob: 0838bc4474bfb7e03e9aa9f0dcefb4691e795298 [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
Michael S. Tsirkindf2943b2010-10-26 17:53:41 +02006GENERATED_HEADERS = config-host.h trace.h qemu-options.def
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00007ifeq ($(TRACE_BACKEND),dtrace)
8GENERATED_HEADERS += trace-dtrace.h
9endif
Anthony Liguorie3193602011-09-02 12:34:47 -050010GENERATED_HEADERS += qmp-commands.h qapi-types.h qapi-visit.h
Michael S. Tsirkin611b7272011-11-16 23:58:46 +020011GENERATED_SOURCES += qmp-marshal.c qapi-types.c qapi-visit.c
Juan Quintelaf527c572009-11-05 17:19:57 +010012
aurel3255d7e8f2009-04-15 14:42:57 +000013ifneq ($(wildcard config-host.mak),)
Paul Brook1ad21342009-05-19 16:17:58 +010014# Put the all: rule here so that config-host.mak can contain dependencies.
15all: build-all
pbrookad064842006-04-16 12:41:07 +000016include config-host.mak
aliguori17759182009-01-21 18:12:52 +000017include $(SRC_PATH)/rules.mak
Paolo Bonzini59bc10e2010-01-04 11:02:28 +010018config-host.mak: $(SRC_PATH)/configure
Juan Quintelae5efe7f2009-10-07 02:40:59 +020019 @echo $@ is out-of-date, running configure
20 @sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh
aurel3255d7e8f2009-04-15 14:42:57 +000021else
22config-host.mak:
23 @echo "Please call configure before running make!"
24 @exit 1
25endif
bellard766a4872003-02-18 23:35:48 +000026
Juan Quintelad9ace8b2009-10-06 21:11:15 +020027# Don't try to regenerate Makefile or configure
28# We don't generate any of them
29Makefile: ;
30configure: ;
31
aliguori818220f2008-09-24 01:13:40 +000032.PHONY: all clean cscope distclean dvi html info install install-doc \
Stefan Weil20cc9992010-01-29 23:16:50 +010033 pdf recurse-all speed tar tarbin test build-all
pbrook0cb3fb12006-05-14 12:07:53 +000034
Paolo Bonzini076d2472009-12-21 10:06:55 +010035$(call set-vpath, $(SRC_PATH):$(SRC_PATH)/hw)
pbrook8c462f82007-11-18 21:12:37 +000036
Juan Quintela3e2e0e62009-08-03 14:47:06 +020037LIBS+=-lz $(LIBS_TOOLS)
Juan Quintela67c0f082009-07-27 16:12:51 +020038
pbrookcc8ae6d2006-04-23 17:57:59 +000039ifdef BUILD_DOCS
Jan Kiszkab40292e2010-05-31 14:43:31 -030040DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 QMP/qmp-commands.txt
pbrookcc8ae6d2006-04-23 17:57:59 +000041else
42DOCS=
43endif
bellard7d132992003-03-06 23:23:54 +000044
Lluís Vilanova388d4752011-09-15 22:45:35 +020045SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory) BUILD_DIR=$(BUILD_DIR)
Juan Quintela1f3d3c82009-10-07 02:41:02 +020046SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
Paul Brookbd9141b2010-11-26 18:47:45 +000047SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %/config-devices.mak.d, $(TARGET_DIRS))
Juan Quintela1f3d3c82009-10-07 02:41:02 +020048
49config-all-devices.mak: $(SUBDIR_DEVICES_MAK)
Stefan Weil01d86a82009-11-19 20:19:56 +010050 $(call quiet-command,cat $(SUBDIR_DEVICES_MAK) | grep =y | sort -u > $@," GEN $@")
Juan Quintela1f3d3c82009-10-07 02:41:02 +020051
Paul Brookbd9141b2010-11-26 18:47:45 +000052-include $(SUBDIR_DEVICES_MAK_DEP)
53
Paul Brooka992fe32009-11-22 16:25:30 +000054%/config-devices.mak: default-configs/%.mak
Blue Swirl4c3b5a42011-01-20 20:54:21 +000055 $(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $@ $<, " GEN $@")
Stefan Weil012f0872009-12-20 15:39:03 +010056 @if test -f $@; then \
Blue Swirl904fe1f2010-10-02 14:28:08 +000057 if cmp -s $@.old $@; then \
Paul Brookbd9141b2010-11-26 18:47:45 +000058 mv $@.tmp $@; \
59 cp -p $@ $@.old; \
Stefan Weil012f0872009-12-20 15:39:03 +010060 else \
61 if test -f $@.old; then \
62 echo "WARNING: $@ (user modified) out of date.";\
63 else \
64 echo "WARNING: $@ out of date.";\
65 fi; \
66 echo "Run \"make defconfig\" to regenerate."; \
67 rm $@.tmp; \
68 fi; \
Paul Brooka992fe32009-11-22 16:25:30 +000069 else \
Stefan Weil012f0872009-12-20 15:39:03 +010070 mv $@.tmp $@; \
71 cp -p $@ $@.old; \
Paul Brooka992fe32009-11-22 16:25:30 +000072 fi
73
74defconfig:
75 rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)
76
Juan Quintela1f3d3c82009-10-07 02:41:02 +020077-include config-all-devices.mak
Juan Quintela1215c6e2009-10-07 02:40:58 +020078
Gerd Hoffmannfffbeb72011-09-01 17:42:17 +020079build-all: $(DOCS) $(TOOLS) $(CHECKS) recurse-all
pbrookb9dea4f2006-05-13 16:54:03 +000080
Juan Quintela1215c6e2009-10-07 02:40:58 +020081config-host.h: config-host.h-timestamp
82config-host.h-timestamp: config-host.mak
Blue Swirle14056a2010-11-01 18:09:38 +000083qemu-options.def: $(SRC_PATH)/qemu-options.hx
Blue Swirl4c3b5a42011-01-20 20:54:21 +000084 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $@")
Juan Quintela1215c6e2009-10-07 02:40:58 +020085
pbrookcec7d0b2008-05-28 16:44:57 +000086SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
87
Juan Quintelaf527c572009-11-05 17:19:57 +010088subdir-%: $(GENERATED_HEADERS)
Paul Brook00873752009-05-07 02:00:31 +010089 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
pbrook4aa42532006-05-13 13:55:08 +000090
Stefan Weilb88bc802010-01-14 18:11:43 +010091ifneq ($(wildcard config-host.mak),)
Andreas Färber0e8c9212010-01-06 20:24:05 +010092include $(SRC_PATH)/Makefile.objs
Stefan Weilb88bc802010-01-14 18:11:43 +010093endif
Andreas Färber0e8c9212010-01-06 20:24:05 +010094
95$(common-obj-y): $(GENERATED_HEADERS)
Anthony Liguori41a74822011-08-20 22:23:03 -050096subdir-libcacard: $(oslib-obj-y) $(trace-obj-y) qemu-timer-common.o
Paolo Bonzini6774e442011-05-02 09:54:03 +020097
Andreas Färber91f16902010-09-12 17:21:36 +020098$(filter %-softmmu,$(SUBDIR_RULES)): $(trace-obj-y) $(common-obj-y) subdir-libdis
Paul Brookc05ac892009-07-31 13:18:32 +010099
Andreas Färber91f16902010-09-12 17:21:36 +0200100$(filter %-user,$(SUBDIR_RULES)): $(GENERATED_HEADERS) $(trace-obj-y) subdir-libdis-user subdir-libuser
Blue Swirladd16152009-09-27 16:26:02 +0000101
Paul Brookc05ac892009-07-31 13:18:32 +0100102ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
103romsubdir-%:
104 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pc-bios/$* V="$(V)" TARGET_DIR="$*/",)
105
106ALL_SUBDIRS=$(TARGET_DIRS) $(patsubst %,pc-bios/%, $(ROMS))
107
108recurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES)
bellard83f64092006-08-01 16:21:11 +0000109
Juan Quintela98b068a2009-08-03 14:46:57 +0200110audio/audio.o audio/fmodaudio.o: QEMU_CFLAGS += $(FMOD_CFLAGS)
Juan Quintela0e22fd22009-06-25 00:08:09 +0200111
Juan Quintelaa558ee12009-08-03 14:46:21 +0200112QEMU_CFLAGS+=$(CURL_CFLAGS)
Alexander Graf769ce762009-05-11 17:41:42 +0200113
Anthony Liguorie18df142011-07-19 14:50:29 -0500114QEMU_CFLAGS+=$(GLIB_CFLAGS)
115
Corentin Chary3e230dd2010-07-07 20:57:52 +0200116ui/cocoa.o: ui/cocoa.m
bellard4fb240a2007-11-07 19:24:02 +0000117
Corentin Chary3e230dd2010-07-07 20:57:52 +0200118ui/sdl.o audio/sdlaudio.o ui/sdl_zoom.o baum.o: QEMU_CFLAGS += $(SDL_CFLAGS)
aliguori04837552009-03-06 20:27:10 +0000119
Corentin Chary3e230dd2010-07-07 20:57:52 +0200120ui/vnc.o: QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
balrog4d3b6f62008-02-10 16:33:14 +0000121
Juan Quintelaa558ee12009-08-03 14:46:21 +0200122bt-host.o: QEMU_CFLAGS += $(BLUEZ_CFLAGS)
bellard4fb240a2007-11-07 19:24:02 +0000123
Blue Swirl7948a662011-09-04 09:32:55 +0000124version.o: $(SRC_PATH)/version.rc config-host.h
Blue Swirl9fe6de92010-09-26 16:07:57 +0000125 $(call quiet-command,$(WINDRES) -I. -o $@ $<," RC $(TARGET_DIR)$@")
126
127version-obj-$(CONFIG_WIN32) += version.o
bellard4fb240a2007-11-07 19:24:02 +0000128######################################################################
Alon Levy44dc0ca2011-05-15 11:51:28 +0300129# Support building shared library libcacard
130
131.PHONY: libcacard.la install-libcacard
132ifeq ($(LIBTOOL),)
133libcacard.la:
134 @echo "libtool is missing, please install and rerun configure"; exit 1
135
136install-libcacard:
137 @echo "libtool is missing, please install and rerun configure"; exit 1
138else
Anthony Liguori92f562e2011-08-21 08:36:21 -0500139libcacard.la: $(GENERATED_HEADERS) $(oslib-obj-y) qemu-timer-common.o $(addsuffix .lo, $(basename $(trace-obj-y)))
Alon Levy44dc0ca2011-05-15 11:51:28 +0300140 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C libcacard V="$(V)" TARGET_DIR="$*/" libcacard.la,)
141
142install-libcacard: libcacard.la
143 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C libcacard V="$(V)" TARGET_DIR="$*/" install-libcacard,)
144endif
145######################################################################
bellard4fb240a2007-11-07 19:24:02 +0000146
Juan Quintela3c089e12010-01-20 20:54:18 +0100147qemu-img.o: qemu-img-cmds.h
Michael Roth48ff7a62011-07-20 15:19:37 -0500148qemu-img.o qemu-tool.o qemu-nbd.o qemu-io.o cmd.o qemu-ga.o: $(GENERATED_HEADERS)
Stuart Brady153859b2009-06-07 00:42:17 +0100149
Paolo Bonzinicbcfa042011-09-12 16:20:11 +0200150tools-obj-y = $(oslib-obj-y) $(trace-obj-y) qemu-tool.o qemu-timer.o \
151 qemu-timer-common.o main-loop.o notify.o iohandler.o cutils.o async.o
152tools-obj-$(CONFIG_POSIX) += compatfd.o
bellard4fb240a2007-11-07 19:24:02 +0000153
Paolo Bonzini4ab328d2011-10-24 13:33:01 +0200154qemu-img$(EXESUF): qemu-img.o $(tools-obj-y) $(block-obj-y)
155qemu-nbd$(EXESUF): qemu-nbd.o $(tools-obj-y) $(block-obj-y)
156qemu-io$(EXESUF): qemu-io.o cmd.o $(tools-obj-y) $(block-obj-y)
aliguori0a8e1ac2009-04-05 18:41:23 +0000157
Stuart Brady153859b2009-06-07 00:42:17 +0100158qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
Blue Swirl4c3b5a42011-01-20 20:54:21 +0000159 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $@")
Stuart Brady153859b2009-06-07 00:42:17 +0100160
Stefan Hajnocziaa7ee422011-05-10 10:21:18 +0100161check-qint.o check-qstring.o check-qdict.o check-qlist.o check-qfloat.o check-qjson.o test-coroutine.o: $(GENERATED_HEADERS)
Jan Kiszka4091da42010-05-20 09:18:52 +0200162
Paolo Bonzini4ab328d2011-10-24 13:33:01 +0200163check-qint: check-qint.o qint.o $(tools-obj-y)
164check-qstring: check-qstring.o qstring.o $(tools-obj-y)
165check-qdict: check-qdict.o qdict.o qfloat.o qint.o qstring.o qbool.o qlist.o $(tools-obj-y)
166check-qlist: check-qlist.o qlist.o qint.o $(tools-obj-y)
167check-qfloat: check-qfloat.o qfloat.o $(tools-obj-y)
168check-qjson: check-qjson.o $(qobject-obj-y) $(tools-obj-y)
169test-coroutine: test-coroutine.o qemu-timer-common.o async.o $(coroutine-obj-y) $(tools-obj-y)
Luiz Capitulino33837ba2009-08-28 15:27:29 -0300170
Michael Roth640e5402011-07-19 14:50:44 -0500171$(qapi-obj-y): $(GENERATED_HEADERS)
Michael Roth9b129402011-11-29 16:47:49 -0600172qapi-dir := $(BUILD_DIR)/qapi-generated
Luiz Capitulino81244ff2011-11-21 14:28:29 -0200173test-qmp-input-visitor.o test-qmp-output-visitor.o test-qmp-commands.o qemu-ga$(EXESUF): QEMU_CFLAGS += -I $(qapi-dir)
Michael Roth957f1f92011-08-11 15:38:12 -0500174qemu-ga$(EXESUF): LIBS = $(LIBS_QGA)
Michael Roth640e5402011-07-19 14:50:44 -0500175
Avi Kivity8d3bc512011-12-27 16:02:16 +0200176gen-out-type = $(subst .,-,$@)
177
Michael S. Tsirkin599825c2011-11-16 23:58:18 +0200178$(qapi-dir)/test-qapi-types.c $(qapi-dir)/test-qapi-types.h :\
179$(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-types.py
Avi Kivity8d3bc512011-12-27 16:02:16 +0200180 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o "$(qapi-dir)" -p "test-" < $<, " GEN $@")
Michael S. Tsirkin599825c2011-11-16 23:58:18 +0200181$(qapi-dir)/test-qapi-visit.c $(qapi-dir)/test-qapi-visit.h :\
182$(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-visit.py
Avi Kivity8d3bc512011-12-27 16:02:16 +0200183 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py $(gen-out-type) -o "$(qapi-dir)" -p "test-" < $<, " GEN $@")
Michael S. Tsirkin599825c2011-11-16 23:58:18 +0200184$(qapi-dir)/test-qmp-commands.h $(qapi-dir)/test-qmp-marshal.c :\
185$(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-commands.py
Avi Kivity8d3bc512011-12-27 16:02:16 +0200186 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py $(gen-out-type) -o "$(qapi-dir)" -p "test-" < $<, " GEN $@")
Michael Roth640e5402011-07-19 14:50:44 -0500187
Michael S. Tsirkin599825c2011-11-16 23:58:18 +0200188$(qapi-dir)/qga-qapi-types.c $(qapi-dir)/qga-qapi-types.h :\
189$(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-types.py
Avi Kivity8d3bc512011-12-27 16:02:16 +0200190 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o "$(qapi-dir)" -p "qga-" < $<, " GEN $@")
Michael S. Tsirkin599825c2011-11-16 23:58:18 +0200191$(qapi-dir)/qga-qapi-visit.c $(qapi-dir)/qga-qapi-visit.h :\
192$(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-visit.py
Avi Kivity8d3bc512011-12-27 16:02:16 +0200193 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py $(gen-out-type) -o "$(qapi-dir)" -p "qga-" < $<, " GEN $@")
Michael S. Tsirkin599825c2011-11-16 23:58:18 +0200194$(qapi-dir)/qga-qmp-commands.h $(qapi-dir)/qga-qmp-marshal.c :\
195$(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-commands.py
Avi Kivity8d3bc512011-12-27 16:02:16 +0200196 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py $(gen-out-type) -o "$(qapi-dir)" -p "qga-" < $<, " GEN $@")
Michael Rothe3d4d252011-07-19 15:41:55 -0500197
Michael S. Tsirkin599825c2011-11-16 23:58:18 +0200198qapi-types.c qapi-types.h :\
199$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-types.py
Avi Kivity8d3bc512011-12-27 16:02:16 +0200200 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o "." < $<, " GEN $@")
Michael S. Tsirkin599825c2011-11-16 23:58:18 +0200201qapi-visit.c qapi-visit.h :\
202$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-visit.py
Avi Kivity8d3bc512011-12-27 16:02:16 +0200203 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py $(gen-out-type) -o "." < $<, " GEN $@")
Michael S. Tsirkin599825c2011-11-16 23:58:18 +0200204qmp-commands.h qmp-marshal.c :\
205$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py
Avi Kivity8d3bc512011-12-27 16:02:16 +0200206 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py $(gen-out-type) -m -o "." < $<, " GEN $@")
Anthony Liguorie3193602011-09-02 12:34:47 -0500207
Luiz Capitulinof294f822011-11-14 19:05:29 -0200208test-qmp-output-visitor.o: $(addprefix $(qapi-dir)/, test-qapi-types.c test-qapi-types.h test-qapi-visit.c test-qapi-visit.h) $(qapi-obj-y)
209test-qmp-output-visitor: test-qmp-output-visitor.o $(qobject-obj-y) $(qapi-obj-y) $(tools-obj-y) $(qapi-dir)/test-qapi-visit.o $(qapi-dir)/test-qapi-types.o
210
Luiz Capitulinod88f5fd2011-11-14 23:31:51 -0200211test-qmp-input-visitor.o: $(addprefix $(qapi-dir)/, test-qapi-types.c test-qapi-types.h test-qapi-visit.c test-qapi-visit.h) $(qapi-obj-y)
212test-qmp-input-visitor: test-qmp-input-visitor.o $(qobject-obj-y) $(qapi-obj-y) $(tools-obj-y) $(qapi-dir)/test-qapi-visit.o $(qapi-dir)/test-qapi-types.o
213
Michael Roth69ed8362011-07-19 14:50:45 -0500214test-qmp-commands.o: $(addprefix $(qapi-dir)/, test-qapi-types.c test-qapi-types.h test-qapi-visit.c test-qapi-visit.h test-qmp-marshal.c test-qmp-commands.h) $(qapi-obj-y)
Paolo Bonzini4ab328d2011-10-24 13:33:01 +0200215test-qmp-commands: test-qmp-commands.o $(qobject-obj-y) $(qapi-obj-y) $(tools-obj-y) $(qapi-dir)/test-qapi-visit.o $(qapi-dir)/test-qapi-types.o $(qapi-dir)/test-qmp-marshal.o module.o
Michael Roth69ed8362011-07-19 14:50:45 -0500216
Michael S. Tsirkin1b142542011-11-16 23:58:31 +0200217QGALIB_OBJ=$(addprefix $(qapi-dir)/, qga-qapi-types.o qga-qapi-visit.o qga-qmp-marshal.o)
218QGALIB_GEN=$(addprefix $(qapi-dir)/, qga-qapi-types.h qga-qapi-visit.h qga-qmp-commands.h)
219$(QGALIB_OBJ): $(QGALIB_GEN) $(GENERATED_HEADERS)
220$(qga-obj-y) qemu-ga.o: $(QGALIB_GEN) $(GENERATED_HEADERS)
Michael Roth957f1f92011-08-11 15:38:12 -0500221
Michael S. Tsirkin1b142542011-11-16 23:58:31 +0200222qemu-ga$(EXESUF): qemu-ga.o $(qga-obj-y) $(qapi-obj-y) $(tools-obj-y) $(qobject-obj-y) $(version-obj-y) $(QGALIB_OBJ)
Michael Roth48ff7a62011-07-20 15:19:37 -0500223
Robert Relyea111a38b2010-11-28 16:36:38 +0200224QEMULIBS=libhw32 libhw64 libuser libdis libdis-user
225
bellard31e31b82003-02-18 22:55:36 +0000226clean:
bellard2d80ae82003-08-11 23:01:33 +0000227# avoid old build problems by removing potentially incorrect old files
Juan Quintela25be2102009-10-07 02:41:00 +0200228 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 +0200229 rm -f qemu-options.def
Gerd Hoffmannfffbeb72011-09-01 17:42:17 +0200230 rm -f *.o *.d *.a *.lo $(TOOLS) $(CHECKS) qemu-ga TAGS cscope.* *.pod *~ */*~
Alon Levy44dc0ca2011-05-15 11:51:28 +0300231 rm -Rf .libs
Michael Roth13a286d2011-07-19 15:41:53 -0500232 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
Blue Swirl07b44ce2009-06-09 18:45:16 +0000233 rm -f qemu-img-cmds.h
Lluísedb47ec2011-08-31 20:30:57 +0200234 rm -f trace/*.o trace/*.d
Blue Swirld7489b72010-10-09 08:24:17 +0000235 rm -f trace.c trace.h trace.c-timestamp trace.h-timestamp
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +0000236 rm -f trace-dtrace.dtrace trace-dtrace.dtrace-timestamp
237 rm -f trace-dtrace.h trace-dtrace.h-timestamp
Michael S. Tsirkin611b7272011-11-16 23:58:46 +0200238 rm -f $(GENERATED_SOURCES)
Michael Roth640e5402011-07-19 14:50:44 -0500239 rm -rf $(qapi-dir)
bellard7d3505c2004-05-12 19:32:15 +0000240 $(MAKE) -C tests clean
Robert Relyea111a38b2010-11-28 16:36:38 +0200241 for d in $(ALL_SUBDIRS) $(QEMULIBS) libcacard; do \
Magnus Dammfc8e3202009-11-13 18:51:05 +0900242 if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
Michael S. Tsirkindf2943b2010-10-26 17:53:41 +0200243 rm -f $$d/qemu-options.def; \
bellard626df762003-08-10 21:39:31 +0000244 done
bellard31e31b82003-02-18 22:55:36 +0000245
bellard7d132992003-03-06 23:23:54 +0000246distclean: clean
Magnus Dammfc8e3202009-11-13 18:51:05 +0900247 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 +0000248 rm -f config-all-devices.mak
Magnus Dammfc8e3202009-11-13 18:51:05 +0900249 rm -f roms/seabios/config.mak roms/vgabios/config.mak
Brad Hards7a734b82011-04-13 16:42:16 +1000250 rm -f qemu-doc.info qemu-doc.aux qemu-doc.cp qemu-doc.cps qemu-doc.dvi
251 rm -f qemu-doc.fn qemu-doc.fns qemu-doc.info qemu-doc.ky qemu-doc.kys
252 rm -f qemu-doc.log qemu-doc.pdf qemu-doc.pg qemu-doc.toc qemu-doc.tp
253 rm -f qemu-doc.vr
Alexandre Raymond793553a2011-07-25 23:56:02 -0400254 rm -f config.log
Hidetoshi Setoe1a068b2010-07-08 14:26:18 +0900255 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 +0200256 for d in $(TARGET_DIRS) $(QEMULIBS); do \
bellardbc1b0502003-10-28 00:12:52 +0000257 rm -rf $$d || exit 1 ; \
bellard76bc6832003-08-10 23:41:46 +0000258 done
bellard7d132992003-03-06 23:23:54 +0000259
bellardfed4a9a2004-12-12 22:18:34 +0000260KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \
261ar de en-us fi fr-be hr it lv nl pl ru th \
262common de-ch es fo fr-ca hu ja mk nl-be pt sl tr
263
ths77755342008-11-27 15:45:16 +0000264ifdef INSTALL_BLOBS
Paolo Bonzini63298662011-11-03 15:14:00 +0100265BLOBS=bios.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
Gerd Hoffmann7943a2f2010-11-30 11:54:33 +0100266vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin \
Gerd Hoffmann3b3d4482010-08-23 12:10:46 +0200267ppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc \
Alex Williamson5ee8ad72011-04-18 11:46:01 -0600268pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
269pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
Michal Simek00914b72011-03-14 11:29:19 +0100270bamboo.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
Alexander Graffbd659b2011-05-25 23:49:41 +0200271mpc8544ds.dtb \
Alexander Graffe270d02010-04-20 19:37:13 +0200272multiboot.bin linuxboot.bin \
David Gibson39ac8452011-04-01 15:15:23 +1100273s390-zipl.rom \
Richard Henderson753d11f2011-06-24 11:58:37 -0700274spapr-rtas.bin slof.bin \
275palcode-clipper
ths77755342008-11-27 15:45:16 +0000276else
277BLOBS=
278endif
279
pbrook38954dc2006-04-30 23:54:18 +0000280install-doc: $(DOCS)
aliguori58f8aea2009-04-18 15:36:02 +0000281 $(INSTALL_DIR) "$(DESTDIR)$(docdir)"
282 $(INSTALL_DATA) qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)"
Juan Quintela96d409e2009-08-03 14:47:00 +0200283ifdef CONFIG_POSIX
aliguori58f8aea2009-04-18 15:36:02 +0000284 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
285 $(INSTALL_DATA) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
286 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
287 $(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
pbrook38954dc2006-04-30 23:54:18 +0000288endif
289
john cooperb5ec5ce2010-02-20 11:14:59 -0600290install-sysconfig:
Andre Przywara990caaf2010-03-08 15:43:41 +0100291 $(INSTALL_DIR) "$(DESTDIR)$(sysconfdir)/qemu"
292 $(INSTALL_DATA) $(SRC_PATH)/sysconfigs/target/target-x86_64.conf "$(DESTDIR)$(sysconfdir)/qemu"
john cooperb5ec5ce2010-02-20 11:14:59 -0600293
294install: all $(if $(BUILD_DOCS),install-doc) install-sysconfig
aliguori58f8aea2009-04-18 15:36:02 +0000295 $(INSTALL_DIR) "$(DESTDIR)$(bindir)"
ths932a79d2007-10-20 18:29:34 +0000296ifneq ($(TOOLS),)
aliguori58f8aea2009-04-18 15:36:02 +0000297 $(INSTALL_PROG) $(STRIP_OPT) $(TOOLS) "$(DESTDIR)$(bindir)"
ths932a79d2007-10-20 18:29:34 +0000298endif
ths77755342008-11-27 15:45:16 +0000299ifneq ($(BLOBS),)
aliguori58f8aea2009-04-18 15:36:02 +0000300 $(INSTALL_DIR) "$(DESTDIR)$(datadir)"
ths77755342008-11-27 15:45:16 +0000301 set -e; for x in $(BLOBS); do \
aliguori58f8aea2009-04-18 15:36:02 +0000302 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
pbrookad064842006-04-16 12:41:07 +0000303 done
ths77755342008-11-27 15:45:16 +0000304endif
aliguori58f8aea2009-04-18 15:36:02 +0000305 $(INSTALL_DIR) "$(DESTDIR)$(datadir)/keymaps"
blueswir118be8d72008-03-05 18:16:09 +0000306 set -e; for x in $(KEYMAPS); do \
Anthony Liguori79fd42a2009-05-28 03:11:42 -0500307 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
pbrookad064842006-04-16 12:41:07 +0000308 done
bellard626df762003-08-10 21:39:31 +0000309 for d in $(TARGET_DIRS); do \
bellard7d3505c2004-05-12 19:32:15 +0000310 $(MAKE) -C $$d $@ || exit 1 ; \
bellard626df762003-08-10 21:39:31 +0000311 done
bellard612384d2003-03-22 17:31:19 +0000312
bellard367e86e2003-03-01 17:13:26 +0000313# various test targets
bellard9b0b8202007-11-14 10:34:57 +0000314test speed: all
bellard7d3505c2004-05-12 19:32:15 +0000315 $(MAKE) -C tests $@
bellard31e31b82003-02-18 22:55:36 +0000316
Gerd Hoffmannea7f7802011-09-01 17:42:18 +0200317.PHONY: check
318check: $(patsubst %,run-check-%,$(CHECKS))
319
320run-check-%: %
321 ./$<
322
Alexandre Bique21d4e8e2009-08-07 15:43:11 +0100323.PHONY: TAGS
ths5fafdf22007-09-16 21:08:06 +0000324TAGS:
Alexandre Bique21d4e8e2009-08-07 15:43:11 +0100325 find "$(SRC_PATH)" -name '*.[hc]' -print0 | xargs -0 etags
bellard31e31b82003-02-18 22:55:36 +0000326
bellard6688bc62005-08-21 09:23:39 +0000327cscope:
328 rm -f ./cscope.*
Alexandre Raymond45b75ae2011-07-20 23:12:15 -0400329 find "$(SRC_PATH)" -name "*.[chsS]" -print | sed 's,^\./,,' > ./cscope.files
bellard6688bc62005-08-21 09:23:39 +0000330 cscope -b
331
bellard3ef693a2003-03-23 20:17:16 +0000332# documentation
Stefan Weil01668d92010-03-04 22:21:02 +0100333MAKEINFO=makeinfo
334MAKEINFOFLAGS=--no-headers --no-split --number-sections
Stefan Weil20cc9992010-01-29 23:16:50 +0100335TEXIFLAG=$(if $(V),,--quiet)
336%.dvi: %.texi
337 $(call quiet-command,texi2dvi $(TEXIFLAG) -I . $<," GEN $@")
338
bellard1f673132004-04-04 15:21:17 +0000339%.html: %.texi
Stefan Weil01668d92010-03-04 22:21:02 +0100340 $(call quiet-command,$(MAKEINFO) $(MAKEINFOFLAGS) --html $< -o $@, \
341 " GEN $@")
bellard3ef693a2003-03-23 20:17:16 +0000342
bellardf3548322006-04-30 22:51:54 +0000343%.info: %.texi
Stefan Weil01668d92010-03-04 22:21:02 +0100344 $(call quiet-command,$(MAKEINFO) $< -o $@," GEN $@")
bellardf3548322006-04-30 22:51:54 +0000345
Stefan Weil20cc9992010-01-29 23:16:50 +0100346%.pdf: %.texi
347 $(call quiet-command,texi2pdf $(TEXIFLAG) -I . $<," GEN $@")
blueswir15824d652009-03-28 06:44:27 +0000348
349qemu-options.texi: $(SRC_PATH)/qemu-options.hx
Blue Swirl4c3b5a42011-01-20 20:54:21 +0000350 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@," GEN $@")
bellardf3548322006-04-30 22:51:54 +0000351
Luiz Capitulinoacd0a092010-09-30 16:00:22 -0300352qemu-monitor.texi: $(SRC_PATH)/hmp-commands.hx
Blue Swirl4c3b5a42011-01-20 20:54:21 +0000353 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@," GEN $@")
Blue Swirl23130862009-06-06 08:22:04 +0000354
Luiz Capitulino82a56f02010-09-13 12:26:00 -0300355QMP/qmp-commands.txt: $(SRC_PATH)/qmp-commands.hx
Blue Swirl4c3b5a42011-01-20 20:54:21 +0000356 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -q < $< > $@," GEN $@")
Jan Kiszkab40292e2010-05-31 14:43:31 -0300357
Stuart Brady153859b2009-06-07 00:42:17 +0100358qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx
Blue Swirl4c3b5a42011-01-20 20:54:21 +0000359 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@," GEN $@")
Stuart Brady153859b2009-06-07 00:42:17 +0100360
Blue Swirl23130862009-06-06 08:22:04 +0000361qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi
aliguori0d00e562009-04-05 17:40:46 +0000362 $(call quiet-command, \
Blue Swirl4c3b5a42011-01-20 20:54:21 +0000363 perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu.pod && \
aliguori0d00e562009-04-05 17:40:46 +0000364 pod2man --section=1 --center=" " --release=" " qemu.pod > $@, \
365 " GEN $@")
bellard5a671352003-10-01 00:13:48 +0000366
Stuart Brady153859b2009-06-07 00:42:17 +0100367qemu-img.1: qemu-img.texi qemu-img-cmds.texi
aliguori0d00e562009-04-05 17:40:46 +0000368 $(call quiet-command, \
Blue Swirl4c3b5a42011-01-20 20:54:21 +0000369 perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu-img.pod && \
aliguori0d00e562009-04-05 17:40:46 +0000370 pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@, \
371 " GEN $@")
bellardacd935e2004-11-15 22:57:26 +0000372
bellard7a5ca862008-05-27 21:13:40 +0000373qemu-nbd.8: qemu-nbd.texi
aliguori0d00e562009-04-05 17:40:46 +0000374 $(call quiet-command, \
Blue Swirl4c3b5a42011-01-20 20:54:21 +0000375 perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu-nbd.pod && \
aliguori0d00e562009-04-05 17:40:46 +0000376 pod2man --section=8 --center=" " --release=" " qemu-nbd.pod > $@, \
377 " GEN $@")
bellard7a5ca862008-05-27 21:13:40 +0000378
pbrook0cb3fb12006-05-14 12:07:53 +0000379dvi: qemu-doc.dvi qemu-tech.dvi
pbrook0cb3fb12006-05-14 12:07:53 +0000380html: qemu-doc.html qemu-tech.html
Stefan Weil20cc9992010-01-29 23:16:50 +0100381info: qemu-doc.info qemu-tech.info
382pdf: qemu-doc.pdf qemu-tech.pdf
pbrook0cb3fb12006-05-14 12:07:53 +0000383
Stefan Weil20cc9992010-01-29 23:16:50 +0100384qemu-doc.dvi qemu-doc.html qemu-doc.info qemu-doc.pdf: \
385 qemu-img.texi qemu-nbd.texi qemu-options.texi \
386 qemu-monitor.texi qemu-img-cmds.texi
aliguori818220f2008-09-24 01:13:40 +0000387
thsdf5cf722007-01-24 22:56:36 +0000388VERSION ?= $(shell cat VERSION)
389FILE = qemu-$(VERSION)
bellard586314f2003-03-03 15:02:29 +0000390
bellard1e43adf2003-09-30 20:54:24 +0000391# tar release (use 'make -k tar' on a checkouted tree)
bellard586314f2003-03-03 15:02:29 +0000392tar:
393 rm -rf /tmp/$(FILE)
bellard1e43adf2003-09-30 20:54:24 +0000394 cp -r . /tmp/$(FILE)
aurel3299c6c082008-04-22 20:45:30 +0000395 cd /tmp && tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS --exclude .git --exclude .svn
bellard586314f2003-03-03 15:02:29 +0000396 rm -rf /tmp/$(FILE)
397
bellard4fb240a2007-11-07 19:24:02 +0000398# Include automatically generated dependency files
Michael Roth48ff7a62011-07-20 15:19:37 -0500399-include $(wildcard *.d audio/*.d slirp/*.d block/*.d net/*.d ui/*.d qapi/*.d qga/*.d)