blob: f3a03ad87eebdf7629e803ad1dc052e8ad0b1398 [file] [log] [blame]
pbrook0cb3fb12006-05-14 12:07:53 +00001# Makefile for QEMU.
2
Michael S. Tsirkindf2943b2010-10-26 17:53:41 +02003GENERATED_HEADERS = config-host.h trace.h qemu-options.def
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00004ifeq ($(TRACE_BACKEND),dtrace)
5GENERATED_HEADERS += trace-dtrace.h
6endif
Juan Quintelaf527c572009-11-05 17:19:57 +01007
aurel3255d7e8f2009-04-15 14:42:57 +00008ifneq ($(wildcard config-host.mak),)
Paul Brook1ad21342009-05-19 16:17:58 +01009# Put the all: rule here so that config-host.mak can contain dependencies.
10all: build-all
pbrookad064842006-04-16 12:41:07 +000011include config-host.mak
aliguori17759182009-01-21 18:12:52 +000012include $(SRC_PATH)/rules.mak
Paolo Bonzini59bc10e2010-01-04 11:02:28 +010013config-host.mak: $(SRC_PATH)/configure
Juan Quintelae5efe7f2009-10-07 02:40:59 +020014 @echo $@ is out-of-date, running configure
15 @sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh
aurel3255d7e8f2009-04-15 14:42:57 +000016else
17config-host.mak:
18 @echo "Please call configure before running make!"
19 @exit 1
20endif
bellard766a4872003-02-18 23:35:48 +000021
Juan Quintelad9ace8b2009-10-06 21:11:15 +020022# Don't try to regenerate Makefile or configure
23# We don't generate any of them
24Makefile: ;
25configure: ;
26
aliguori818220f2008-09-24 01:13:40 +000027.PHONY: all clean cscope distclean dvi html info install install-doc \
Stefan Weil20cc9992010-01-29 23:16:50 +010028 pdf recurse-all speed tar tarbin test build-all
pbrook0cb3fb12006-05-14 12:07:53 +000029
Paolo Bonzini076d2472009-12-21 10:06:55 +010030$(call set-vpath, $(SRC_PATH):$(SRC_PATH)/hw)
pbrook8c462f82007-11-18 21:12:37 +000031
Juan Quintela3e2e0e62009-08-03 14:47:06 +020032LIBS+=-lz $(LIBS_TOOLS)
Juan Quintela67c0f082009-07-27 16:12:51 +020033
pbrookcc8ae6d2006-04-23 17:57:59 +000034ifdef BUILD_DOCS
Jan Kiszkab40292e2010-05-31 14:43:31 -030035DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 QMP/qmp-commands.txt
pbrookcc8ae6d2006-04-23 17:57:59 +000036else
37DOCS=
38endif
bellard7d132992003-03-06 23:23:54 +000039
Juan Quintela1215c6e2009-10-07 02:40:58 +020040SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory)
Juan Quintela1f3d3c82009-10-07 02:41:02 +020041SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
Paul Brookbd9141b2010-11-26 18:47:45 +000042SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %/config-devices.mak.d, $(TARGET_DIRS))
Juan Quintela1f3d3c82009-10-07 02:41:02 +020043
44config-all-devices.mak: $(SUBDIR_DEVICES_MAK)
Stefan Weil01d86a82009-11-19 20:19:56 +010045 $(call quiet-command,cat $(SUBDIR_DEVICES_MAK) | grep =y | sort -u > $@," GEN $@")
Juan Quintela1f3d3c82009-10-07 02:41:02 +020046
Paul Brookbd9141b2010-11-26 18:47:45 +000047-include $(SUBDIR_DEVICES_MAK_DEP)
48
Paul Brooka992fe32009-11-22 16:25:30 +000049%/config-devices.mak: default-configs/%.mak
Blue Swirl4c3b5a42011-01-20 20:54:21 +000050 $(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $@ $<, " GEN $@")
Stefan Weil012f0872009-12-20 15:39:03 +010051 @if test -f $@; then \
Blue Swirl904fe1f2010-10-02 14:28:08 +000052 if cmp -s $@.old $@; then \
Paul Brookbd9141b2010-11-26 18:47:45 +000053 mv $@.tmp $@; \
54 cp -p $@ $@.old; \
Stefan Weil012f0872009-12-20 15:39:03 +010055 else \
56 if test -f $@.old; then \
57 echo "WARNING: $@ (user modified) out of date.";\
58 else \
59 echo "WARNING: $@ out of date.";\
60 fi; \
61 echo "Run \"make defconfig\" to regenerate."; \
62 rm $@.tmp; \
63 fi; \
Paul Brooka992fe32009-11-22 16:25:30 +000064 else \
Stefan Weil012f0872009-12-20 15:39:03 +010065 mv $@.tmp $@; \
66 cp -p $@ $@.old; \
Paul Brooka992fe32009-11-22 16:25:30 +000067 fi
68
69defconfig:
70 rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)
71
Juan Quintela1f3d3c82009-10-07 02:41:02 +020072-include config-all-devices.mak
Juan Quintela1215c6e2009-10-07 02:40:58 +020073
Juan Quintelaf527c572009-11-05 17:19:57 +010074build-all: $(DOCS) $(TOOLS) recurse-all
pbrookb9dea4f2006-05-13 16:54:03 +000075
Juan Quintela1215c6e2009-10-07 02:40:58 +020076config-host.h: config-host.h-timestamp
77config-host.h-timestamp: config-host.mak
Blue Swirle14056a2010-11-01 18:09:38 +000078qemu-options.def: $(SRC_PATH)/qemu-options.hx
Blue Swirl4c3b5a42011-01-20 20:54:21 +000079 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $@")
Juan Quintela1215c6e2009-10-07 02:40:58 +020080
pbrookcec7d0b2008-05-28 16:44:57 +000081SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
82
Juan Quintelaf527c572009-11-05 17:19:57 +010083subdir-%: $(GENERATED_HEADERS)
Paul Brook00873752009-05-07 02:00:31 +010084 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
pbrook4aa42532006-05-13 13:55:08 +000085
Stefan Weilb88bc802010-01-14 18:11:43 +010086ifneq ($(wildcard config-host.mak),)
Andreas Färber0e8c9212010-01-06 20:24:05 +010087include $(SRC_PATH)/Makefile.objs
Stefan Weilb88bc802010-01-14 18:11:43 +010088endif
Andreas Färber0e8c9212010-01-06 20:24:05 +010089
90$(common-obj-y): $(GENERATED_HEADERS)
Paolo Bonzini6774e442011-05-02 09:54:03 +020091subdir-libcacard: $(oslib-obj-y) $(trace-obj-y) qemu-malloc.o qemu-timer-common.o
92
Andreas Färber91f16902010-09-12 17:21:36 +020093$(filter %-softmmu,$(SUBDIR_RULES)): $(trace-obj-y) $(common-obj-y) subdir-libdis
Paul Brookc05ac892009-07-31 13:18:32 +010094
Andreas Färber91f16902010-09-12 17:21:36 +020095$(filter %-user,$(SUBDIR_RULES)): $(GENERATED_HEADERS) $(trace-obj-y) subdir-libdis-user subdir-libuser
Blue Swirladd16152009-09-27 16:26:02 +000096
Paul Brookc05ac892009-07-31 13:18:32 +010097ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
98romsubdir-%:
99 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pc-bios/$* V="$(V)" TARGET_DIR="$*/",)
100
101ALL_SUBDIRS=$(TARGET_DIRS) $(patsubst %,pc-bios/%, $(ROMS))
102
103recurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES)
bellard83f64092006-08-01 16:21:11 +0000104
Juan Quintela98b068a2009-08-03 14:46:57 +0200105audio/audio.o audio/fmodaudio.o: QEMU_CFLAGS += $(FMOD_CFLAGS)
Juan Quintela0e22fd22009-06-25 00:08:09 +0200106
Juan Quintelaa558ee12009-08-03 14:46:21 +0200107QEMU_CFLAGS+=$(CURL_CFLAGS)
Alexander Graf769ce762009-05-11 17:41:42 +0200108
Anthony Liguorie18df142011-07-19 14:50:29 -0500109QEMU_CFLAGS+=$(GLIB_CFLAGS)
110
Corentin Chary3e230dd2010-07-07 20:57:52 +0200111ui/cocoa.o: ui/cocoa.m
bellard4fb240a2007-11-07 19:24:02 +0000112
Corentin Chary3e230dd2010-07-07 20:57:52 +0200113ui/sdl.o audio/sdlaudio.o ui/sdl_zoom.o baum.o: QEMU_CFLAGS += $(SDL_CFLAGS)
aliguori04837552009-03-06 20:27:10 +0000114
Corentin Chary3e230dd2010-07-07 20:57:52 +0200115ui/vnc.o: QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
balrog4d3b6f62008-02-10 16:33:14 +0000116
Juan Quintelaa558ee12009-08-03 14:46:21 +0200117bt-host.o: QEMU_CFLAGS += $(BLUEZ_CFLAGS)
bellard4fb240a2007-11-07 19:24:02 +0000118
Blue Swirl9fe6de92010-09-26 16:07:57 +0000119version.o: $(SRC_PATH)/version.rc config-host.mak
120 $(call quiet-command,$(WINDRES) -I. -o $@ $<," RC $(TARGET_DIR)$@")
121
122version-obj-$(CONFIG_WIN32) += version.o
bellard4fb240a2007-11-07 19:24:02 +0000123######################################################################
Alon Levy44dc0ca2011-05-15 11:51:28 +0300124# Support building shared library libcacard
125
126.PHONY: libcacard.la install-libcacard
127ifeq ($(LIBTOOL),)
128libcacard.la:
129 @echo "libtool is missing, please install and rerun configure"; exit 1
130
131install-libcacard:
132 @echo "libtool is missing, please install and rerun configure"; exit 1
133else
134libcacard.la: $(GENERATED_HEADERS) $(oslib-obj-y) qemu-malloc.o qemu-timer-common.o $(addsuffix .lo, $(basename $(trace-obj-y)))
135 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C libcacard V="$(V)" TARGET_DIR="$*/" libcacard.la,)
136
137install-libcacard: libcacard.la
138 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C libcacard V="$(V)" TARGET_DIR="$*/" install-libcacard,)
139endif
140######################################################################
bellard4fb240a2007-11-07 19:24:02 +0000141
Juan Quintela3c089e12010-01-20 20:54:18 +0100142qemu-img.o: qemu-img-cmds.h
Michael Roth48ff7a62011-07-20 15:19:37 -0500143qemu-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 +0100144
Jes Sorensenc1b0b932010-10-26 10:39:19 +0200145qemu-img$(EXESUF): qemu-img.o qemu-tool.o qemu-error.o $(oslib-obj-y) $(trace-obj-y) $(block-obj-y) $(qobject-obj-y) $(version-obj-y) qemu-timer-common.o
bellard4fb240a2007-11-07 19:24:02 +0000146
Jes Sorensenc1b0b932010-10-26 10:39:19 +0200147qemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o qemu-error.o $(oslib-obj-y) $(trace-obj-y) $(block-obj-y) $(qobject-obj-y) $(version-obj-y) qemu-timer-common.o
aliguori3aa892d2009-01-21 18:13:02 +0000148
Jes Sorensenc1b0b932010-10-26 10:39:19 +0200149qemu-io$(EXESUF): qemu-io.o cmd.o qemu-tool.o qemu-error.o $(oslib-obj-y) $(trace-obj-y) $(block-obj-y) $(qobject-obj-y) $(version-obj-y) qemu-timer-common.o
aliguori0a8e1ac2009-04-05 18:41:23 +0000150
Stuart Brady153859b2009-06-07 00:42:17 +0100151qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
Blue Swirl4c3b5a42011-01-20 20:54:21 +0000152 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $@")
Stuart Brady153859b2009-06-07 00:42:17 +0100153
Jan Kiszka4091da42010-05-20 09:18:52 +0200154check-qint.o check-qstring.o check-qdict.o check-qlist.o check-qfloat.o check-qjson.o: $(GENERATED_HEADERS)
155
Anthony Liguorief749d02011-06-01 12:14:50 -0500156CHECK_PROG_DEPS = qemu-malloc.o $(oslib-obj-y) $(trace-obj-y) qemu-tool.o
Luiz Capitulinoe71e00e2010-11-12 12:55:46 -0200157
158check-qint: check-qint.o qint.o $(CHECK_PROG_DEPS)
159check-qstring: check-qstring.o qstring.o $(CHECK_PROG_DEPS)
160check-qdict: check-qdict.o qdict.o qfloat.o qint.o qstring.o qbool.o qlist.o $(CHECK_PROG_DEPS)
161check-qlist: check-qlist.o qlist.o qint.o $(CHECK_PROG_DEPS)
162check-qfloat: check-qfloat.o qfloat.o $(CHECK_PROG_DEPS)
Anthony Liguorief749d02011-06-01 12:14:50 -0500163check-qjson: check-qjson.o qfloat.o qint.o qdict.o qstring.o qlist.o qbool.o qjson.o json-streamer.o json-lexer.o json-parser.o error.o qerror.o qemu-error.o $(CHECK_PROG_DEPS)
Luiz Capitulino33837ba2009-08-28 15:27:29 -0300164
Michael Roth640e5402011-07-19 14:50:44 -0500165$(qapi-obj-y): $(GENERATED_HEADERS)
166qapi-dir := qapi-generated
Michael Rothe3d4d252011-07-19 15:41:55 -0500167test-visitor.o test-qmp-commands.o qemu-ga$(EXESUF): QEMU_CFLAGS += -I $(qapi-dir)
Michael Roth640e5402011-07-19 14:50:44 -0500168
169$(qapi-dir)/test-qapi-types.c: $(qapi-dir)/test-qapi-types.h
170$(qapi-dir)/test-qapi-types.h: $(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-types.py
171 $(call quiet-command,python $(SRC_PATH)/scripts/qapi-types.py -o "$(qapi-dir)" -p "test-" < $<, " GEN $@")
172$(qapi-dir)/test-qapi-visit.c: $(qapi-dir)/test-qapi-visit.h
173$(qapi-dir)/test-qapi-visit.h: $(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-visit.py
174 $(call quiet-command,python $(SRC_PATH)/scripts/qapi-visit.py -o "$(qapi-dir)" -p "test-" < $<, " GEN $@")
Michael Roth69ed8362011-07-19 14:50:45 -0500175$(qapi-dir)/test-qmp-commands.h: $(qapi-dir)/test-qmp-marshal.c
176$(qapi-dir)/test-qmp-marshal.c: $(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-commands.py
177 $(call quiet-command,python $(SRC_PATH)/scripts/qapi-commands.py -o "$(qapi-dir)" -p "test-" < $<, " GEN $@")
Michael Roth640e5402011-07-19 14:50:44 -0500178
Michael Rothe3d4d252011-07-19 15:41:55 -0500179$(qapi-dir)/qga-qapi-types.c: $(qapi-dir)/qga-qapi-types.h
180$(qapi-dir)/qga-qapi-types.h: $(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-types.py
181 $(call quiet-command,python $(SRC_PATH)/scripts/qapi-types.py -o "$(qapi-dir)" -p "qga-" < $<, " GEN $@")
182$(qapi-dir)/qga-qapi-visit.c: $(qapi-dir)/qga-qapi-visit.h
183$(qapi-dir)/qga-qapi-visit.h: $(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-visit.py
184 $(call quiet-command,python $(SRC_PATH)/scripts/qapi-visit.py -o "$(qapi-dir)" -p "qga-" < $<, " GEN $@")
185$(qapi-dir)/qga-qmp-marshal.c: $(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-commands.py
186 $(call quiet-command,python $(SRC_PATH)/scripts/qapi-commands.py -o "$(qapi-dir)" -p "qga-" < $<, " GEN $@")
187
Michael Roth640e5402011-07-19 14:50:44 -0500188test-visitor.o: $(addprefix $(qapi-dir)/, test-qapi-types.c test-qapi-types.h test-qapi-visit.c test-qapi-visit.h) $(qapi-obj-y)
189test-visitor: test-visitor.o qfloat.o qint.o qdict.o qstring.o qlist.o qbool.o $(qapi-obj-y) error.o osdep.o qemu-malloc.o $(oslib-obj-y) qjson.o json-streamer.o json-lexer.o json-parser.o qerror.o qemu-error.o qemu-tool.o $(qapi-dir)/test-qapi-visit.o $(qapi-dir)/test-qapi-types.o
190
Michael Roth69ed8362011-07-19 14:50:45 -0500191test-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)
192test-qmp-commands: test-qmp-commands.o qfloat.o qint.o qdict.o qstring.o qlist.o qbool.o $(qapi-obj-y) error.o osdep.o qemu-malloc.o $(oslib-obj-y) qjson.o json-streamer.o json-lexer.o json-parser.o qerror.o qemu-error.o qemu-tool.o $(qapi-dir)/test-qapi-visit.o $(qapi-dir)/test-qapi-types.o $(qapi-dir)/test-qmp-marshal.o module.o
193
Michael Rothe3d4d252011-07-19 15:41:55 -0500194QGALIB=qga/guest-agent-command-state.o qga/guest-agent-commands.o
Michael Roth13a286d2011-07-19 15:41:53 -0500195
Michael Rothe3d4d252011-07-19 15:41:55 -0500196qemu-ga.o: $(addprefix $(qapi-dir)/, qga-qapi-types.c qga-qapi-types.h qga-qapi-visit.c qga-qmp-marshal.c) $(qapi-obj-y)
197qemu-ga$(EXESUF): qemu-ga.o $(QGALIB) qemu-tool.o qemu-error.o error.o $(oslib-obj-y) $(trace-obj-y) $(block-obj-y) $(qobject-obj-y) $(version-obj-y) $(qapi-obj-y) qemu-timer-common.o qemu-sockets.o module.o qapi/qmp-dispatch.o qapi/qmp-registry.o $(qapi-dir)/qga-qapi-visit.o $(qapi-dir)/qga-qapi-types.o $(qapi-dir)/qga-qmp-marshal.o
Michael Roth48ff7a62011-07-20 15:19:37 -0500198
Robert Relyea111a38b2010-11-28 16:36:38 +0200199QEMULIBS=libhw32 libhw64 libuser libdis libdis-user
200
bellard31e31b82003-02-18 22:55:36 +0000201clean:
bellard2d80ae82003-08-11 23:01:33 +0000202# avoid old build problems by removing potentially incorrect old files
Juan Quintela25be210f2009-10-07 02:41:00 +0200203 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 +0200204 rm -f qemu-options.def
Michael Roth48ff7a62011-07-20 15:19:37 -0500205 rm -f *.o *.d *.a *.lo $(TOOLS) qemu-ga TAGS cscope.* *.pod *~ */*~
Alon Levy44dc0ca2011-05-15 11:51:28 +0300206 rm -Rf .libs
Michael Roth13a286d2011-07-19 15:41:53 -0500207 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 +0000208 rm -f qemu-img-cmds.h
Blue Swirld7489b72010-10-09 08:24:17 +0000209 rm -f trace.c trace.h trace.c-timestamp trace.h-timestamp
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +0000210 rm -f trace-dtrace.dtrace trace-dtrace.dtrace-timestamp
211 rm -f trace-dtrace.h trace-dtrace.h-timestamp
Michael Roth640e5402011-07-19 14:50:44 -0500212 rm -rf $(qapi-dir)
bellard7d3505c2004-05-12 19:32:15 +0000213 $(MAKE) -C tests clean
Robert Relyea111a38b2010-11-28 16:36:38 +0200214 for d in $(ALL_SUBDIRS) $(QEMULIBS) libcacard; do \
Magnus Dammfc8e3202009-11-13 18:51:05 +0900215 if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
Michael S. Tsirkindf2943b2010-10-26 17:53:41 +0200216 rm -f $$d/qemu-options.def; \
bellard626df762003-08-10 21:39:31 +0000217 done
bellard31e31b82003-02-18 22:55:36 +0000218
bellard7d132992003-03-06 23:23:54 +0000219distclean: clean
Magnus Dammfc8e3202009-11-13 18:51:05 +0900220 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 +0000221 rm -f config-all-devices.mak
Magnus Dammfc8e3202009-11-13 18:51:05 +0900222 rm -f roms/seabios/config.mak roms/vgabios/config.mak
Brad Hards7a734b82011-04-13 16:42:16 +1000223 rm -f qemu-doc.info qemu-doc.aux qemu-doc.cp qemu-doc.cps qemu-doc.dvi
224 rm -f qemu-doc.fn qemu-doc.fns qemu-doc.info qemu-doc.ky qemu-doc.kys
225 rm -f qemu-doc.log qemu-doc.pdf qemu-doc.pg qemu-doc.toc qemu-doc.tp
226 rm -f qemu-doc.vr
Hidetoshi Setoe1a068b2010-07-08 14:26:18 +0900227 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 +0200228 for d in $(TARGET_DIRS) $(QEMULIBS); do \
bellardbc1b0502003-10-28 00:12:52 +0000229 rm -rf $$d || exit 1 ; \
bellard76bc6832003-08-10 23:41:46 +0000230 done
bellard7d132992003-03-06 23:23:54 +0000231
bellardfed4a9a2004-12-12 22:18:34 +0000232KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \
233ar de en-us fi fr-be hr it lv nl pl ru th \
234common de-ch es fo fr-ca hu ja mk nl-be pt sl tr
235
ths77755342008-11-27 15:45:16 +0000236ifdef INSTALL_BLOBS
Gerd Hoffmann3b3d4482010-08-23 12:10:46 +0200237BLOBS=bios.bin vgabios.bin vgabios-cirrus.bin \
Gerd Hoffmann7943a2f2010-11-30 11:54:33 +0100238vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin \
Gerd Hoffmann3b3d4482010-08-23 12:10:46 +0200239ppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc \
Alex Williamson5ee8ad72011-04-18 11:46:01 -0600240pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
241pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
Michal Simek00914b72011-03-14 11:29:19 +0100242bamboo.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
Alexander Graffbd659b2011-05-25 23:49:41 +0200243mpc8544ds.dtb \
Alexander Graffe270d02010-04-20 19:37:13 +0200244multiboot.bin linuxboot.bin \
David Gibson39ac8452011-04-01 15:15:23 +1100245s390-zipl.rom \
David Gibsona9f8ad82011-04-01 15:15:34 +1100246spapr-rtas.bin slof.bin
ths77755342008-11-27 15:45:16 +0000247else
248BLOBS=
249endif
250
pbrook38954dc2006-04-30 23:54:18 +0000251install-doc: $(DOCS)
aliguori58f8aea2009-04-18 15:36:02 +0000252 $(INSTALL_DIR) "$(DESTDIR)$(docdir)"
253 $(INSTALL_DATA) qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)"
Juan Quintela96d409e2009-08-03 14:47:00 +0200254ifdef CONFIG_POSIX
aliguori58f8aea2009-04-18 15:36:02 +0000255 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
256 $(INSTALL_DATA) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
257 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
258 $(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
pbrook38954dc2006-04-30 23:54:18 +0000259endif
260
john cooperb5ec5ce2010-02-20 11:14:59 -0600261install-sysconfig:
Andre Przywara990caaf2010-03-08 15:43:41 +0100262 $(INSTALL_DIR) "$(DESTDIR)$(sysconfdir)/qemu"
263 $(INSTALL_DATA) $(SRC_PATH)/sysconfigs/target/target-x86_64.conf "$(DESTDIR)$(sysconfdir)/qemu"
john cooperb5ec5ce2010-02-20 11:14:59 -0600264
265install: all $(if $(BUILD_DOCS),install-doc) install-sysconfig
aliguori58f8aea2009-04-18 15:36:02 +0000266 $(INSTALL_DIR) "$(DESTDIR)$(bindir)"
ths932a79d2007-10-20 18:29:34 +0000267ifneq ($(TOOLS),)
aliguori58f8aea2009-04-18 15:36:02 +0000268 $(INSTALL_PROG) $(STRIP_OPT) $(TOOLS) "$(DESTDIR)$(bindir)"
ths932a79d2007-10-20 18:29:34 +0000269endif
ths77755342008-11-27 15:45:16 +0000270ifneq ($(BLOBS),)
aliguori58f8aea2009-04-18 15:36:02 +0000271 $(INSTALL_DIR) "$(DESTDIR)$(datadir)"
ths77755342008-11-27 15:45:16 +0000272 set -e; for x in $(BLOBS); do \
aliguori58f8aea2009-04-18 15:36:02 +0000273 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
pbrookad064842006-04-16 12:41:07 +0000274 done
ths77755342008-11-27 15:45:16 +0000275endif
aliguori58f8aea2009-04-18 15:36:02 +0000276 $(INSTALL_DIR) "$(DESTDIR)$(datadir)/keymaps"
blueswir118be8d72008-03-05 18:16:09 +0000277 set -e; for x in $(KEYMAPS); do \
Anthony Liguori79fd42a2009-05-28 03:11:42 -0500278 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
pbrookad064842006-04-16 12:41:07 +0000279 done
bellard626df762003-08-10 21:39:31 +0000280 for d in $(TARGET_DIRS); do \
bellard7d3505c2004-05-12 19:32:15 +0000281 $(MAKE) -C $$d $@ || exit 1 ; \
bellard626df762003-08-10 21:39:31 +0000282 done
bellard612384d2003-03-22 17:31:19 +0000283
bellard367e86e2003-03-01 17:13:26 +0000284# various test targets
bellard9b0b8202007-11-14 10:34:57 +0000285test speed: all
bellard7d3505c2004-05-12 19:32:15 +0000286 $(MAKE) -C tests $@
bellard31e31b82003-02-18 22:55:36 +0000287
Alexandre Bique21d4e8e2009-08-07 15:43:11 +0100288.PHONY: TAGS
ths5fafdf22007-09-16 21:08:06 +0000289TAGS:
Alexandre Bique21d4e8e2009-08-07 15:43:11 +0100290 find "$(SRC_PATH)" -name '*.[hc]' -print0 | xargs -0 etags
bellard31e31b82003-02-18 22:55:36 +0000291
bellard6688bc62005-08-21 09:23:39 +0000292cscope:
293 rm -f ./cscope.*
aurel32ede46082008-10-01 21:46:58 +0000294 find . -name "*.[ch]" -print | sed 's,^\./,,' > ./cscope.files
bellard6688bc62005-08-21 09:23:39 +0000295 cscope -b
296
bellard3ef693a2003-03-23 20:17:16 +0000297# documentation
Stefan Weil01668d92010-03-04 22:21:02 +0100298MAKEINFO=makeinfo
299MAKEINFOFLAGS=--no-headers --no-split --number-sections
Stefan Weil20cc9992010-01-29 23:16:50 +0100300TEXIFLAG=$(if $(V),,--quiet)
301%.dvi: %.texi
302 $(call quiet-command,texi2dvi $(TEXIFLAG) -I . $<," GEN $@")
303
bellard1f673132004-04-04 15:21:17 +0000304%.html: %.texi
Stefan Weil01668d92010-03-04 22:21:02 +0100305 $(call quiet-command,$(MAKEINFO) $(MAKEINFOFLAGS) --html $< -o $@, \
306 " GEN $@")
bellard3ef693a2003-03-23 20:17:16 +0000307
bellardf3548322006-04-30 22:51:54 +0000308%.info: %.texi
Stefan Weil01668d92010-03-04 22:21:02 +0100309 $(call quiet-command,$(MAKEINFO) $< -o $@," GEN $@")
bellardf3548322006-04-30 22:51:54 +0000310
Stefan Weil20cc9992010-01-29 23:16:50 +0100311%.pdf: %.texi
312 $(call quiet-command,texi2pdf $(TEXIFLAG) -I . $<," GEN $@")
blueswir15824d652009-03-28 06:44:27 +0000313
314qemu-options.texi: $(SRC_PATH)/qemu-options.hx
Blue Swirl4c3b5a42011-01-20 20:54:21 +0000315 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@," GEN $@")
bellardf3548322006-04-30 22:51:54 +0000316
Luiz Capitulinoacd0a092010-09-30 16:00:22 -0300317qemu-monitor.texi: $(SRC_PATH)/hmp-commands.hx
Blue Swirl4c3b5a42011-01-20 20:54:21 +0000318 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@," GEN $@")
Blue Swirl23130862009-06-06 08:22:04 +0000319
Luiz Capitulino82a56f02010-09-13 12:26:00 -0300320QMP/qmp-commands.txt: $(SRC_PATH)/qmp-commands.hx
Blue Swirl4c3b5a42011-01-20 20:54:21 +0000321 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -q < $< > $@," GEN $@")
Jan Kiszkab40292e2010-05-31 14:43:31 -0300322
Stuart Brady153859b2009-06-07 00:42:17 +0100323qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx
Blue Swirl4c3b5a42011-01-20 20:54:21 +0000324 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@," GEN $@")
Stuart Brady153859b2009-06-07 00:42:17 +0100325
Blue Swirl23130862009-06-06 08:22:04 +0000326qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi
aliguori0d00e562009-04-05 17:40:46 +0000327 $(call quiet-command, \
Blue Swirl4c3b5a42011-01-20 20:54:21 +0000328 perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu.pod && \
aliguori0d00e562009-04-05 17:40:46 +0000329 pod2man --section=1 --center=" " --release=" " qemu.pod > $@, \
330 " GEN $@")
bellard5a671352003-10-01 00:13:48 +0000331
Stuart Brady153859b2009-06-07 00:42:17 +0100332qemu-img.1: qemu-img.texi qemu-img-cmds.texi
aliguori0d00e562009-04-05 17:40:46 +0000333 $(call quiet-command, \
Blue Swirl4c3b5a42011-01-20 20:54:21 +0000334 perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu-img.pod && \
aliguori0d00e562009-04-05 17:40:46 +0000335 pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@, \
336 " GEN $@")
bellardacd935e2004-11-15 22:57:26 +0000337
bellard7a5ca862008-05-27 21:13:40 +0000338qemu-nbd.8: qemu-nbd.texi
aliguori0d00e562009-04-05 17:40:46 +0000339 $(call quiet-command, \
Blue Swirl4c3b5a42011-01-20 20:54:21 +0000340 perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu-nbd.pod && \
aliguori0d00e562009-04-05 17:40:46 +0000341 pod2man --section=8 --center=" " --release=" " qemu-nbd.pod > $@, \
342 " GEN $@")
bellard7a5ca862008-05-27 21:13:40 +0000343
pbrook0cb3fb12006-05-14 12:07:53 +0000344dvi: qemu-doc.dvi qemu-tech.dvi
pbrook0cb3fb12006-05-14 12:07:53 +0000345html: qemu-doc.html qemu-tech.html
Stefan Weil20cc9992010-01-29 23:16:50 +0100346info: qemu-doc.info qemu-tech.info
347pdf: qemu-doc.pdf qemu-tech.pdf
pbrook0cb3fb12006-05-14 12:07:53 +0000348
Stefan Weil20cc9992010-01-29 23:16:50 +0100349qemu-doc.dvi qemu-doc.html qemu-doc.info qemu-doc.pdf: \
350 qemu-img.texi qemu-nbd.texi qemu-options.texi \
351 qemu-monitor.texi qemu-img-cmds.texi
aliguori818220f2008-09-24 01:13:40 +0000352
thsdf5cf722007-01-24 22:56:36 +0000353VERSION ?= $(shell cat VERSION)
354FILE = qemu-$(VERSION)
bellard586314f2003-03-03 15:02:29 +0000355
bellard1e43adf2003-09-30 20:54:24 +0000356# tar release (use 'make -k tar' on a checkouted tree)
bellard586314f2003-03-03 15:02:29 +0000357tar:
358 rm -rf /tmp/$(FILE)
bellard1e43adf2003-09-30 20:54:24 +0000359 cp -r . /tmp/$(FILE)
aurel3299c6c082008-04-22 20:45:30 +0000360 cd /tmp && tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS --exclude .git --exclude .svn
bellard586314f2003-03-03 15:02:29 +0000361 rm -rf /tmp/$(FILE)
362
Stuart Brady4c0a6db2010-05-12 20:42:04 +0100363SYSTEM_TARGETS=$(filter %-softmmu,$(TARGET_DIRS))
364SYSTEM_PROGS=$(patsubst qemu-system-i386,qemu, \
365 $(patsubst %-softmmu,qemu-system-%, \
366 $(SYSTEM_TARGETS)))
367
368USER_TARGETS=$(filter %-user,$(TARGET_DIRS))
369USER_PROGS=$(patsubst %-bsd-user,qemu-%, \
370 $(patsubst %-darwin-user,qemu-%, \
371 $(patsubst %-linux-user,qemu-%, \
372 $(USER_TARGETS))))
373
bellard76b62fd2003-10-28 00:47:44 +0000374# generate a binary distribution
bellardd691f662003-03-24 21:58:34 +0000375tarbin:
blueswir118be8d72008-03-05 18:16:09 +0000376 cd / && tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \
Stuart Brady4c0a6db2010-05-12 20:42:04 +0100377 $(patsubst %,$(bindir)/%, $(SYSTEM_PROGS)) \
378 $(patsubst %,$(bindir)/%, $(USER_PROGS)) \
aurel3240e8a532009-01-03 12:35:57 +0000379 $(bindir)/qemu-img \
380 $(bindir)/qemu-nbd \
bellard7efa4382004-05-12 18:54:06 +0000381 $(datadir)/bios.bin \
382 $(datadir)/vgabios.bin \
bellardde9258a2004-06-06 15:50:03 +0000383 $(datadir)/vgabios-cirrus.bin \
bellard637f6cd2004-06-21 19:54:47 +0000384 $(datadir)/ppc_rom.bin \
bellard0986ac32006-06-14 12:36:32 +0000385 $(datadir)/openbios-sparc32 \
blueswir1938255d2008-04-23 19:38:07 +0000386 $(datadir)/openbios-sparc64 \
aurel32e5d01b02009-01-09 11:01:31 +0000387 $(datadir)/openbios-ppc \
Alex Williamson5ee8ad72011-04-18 11:46:01 -0600388 $(datadir)/pxe-e1000.rom \
389 $(datadir)/pxe-eepro100.rom \
390 $(datadir)/pxe-ne2k_pci.rom \
391 $(datadir)/pxe-pcnet.rom \
392 $(datadir)/pxe-rtl8139.rom \
393 $(datadir)/pxe-virtio.rom \
bellard1f50f8d2004-05-08 14:44:43 +0000394 $(docdir)/qemu-doc.html \
395 $(docdir)/qemu-tech.html \
aurel3240e8a532009-01-03 12:35:57 +0000396 $(mandir)/man1/qemu.1 \
397 $(mandir)/man1/qemu-img.1 \
bellard7a5ca862008-05-27 21:13:40 +0000398 $(mandir)/man8/qemu-nbd.8
bellardd691f662003-03-24 21:58:34 +0000399
bellard4fb240a2007-11-07 19:24:02 +0000400# Include automatically generated dependency files
Michael Roth48ff7a62011-07-20 15:19:37 -0500401-include $(wildcard *.d audio/*.d slirp/*.d block/*.d net/*.d ui/*.d qapi/*.d qga/*.d)