pbrook | 0cb3fb1 | 2006-05-14 12:07:53 +0000 | [diff] [blame] | 1 | # Makefile for QEMU. |
| 2 | |
pbrook | ad06484 | 2006-04-16 12:41:07 +0000 | [diff] [blame] | 3 | include config-host.mak |
bellard | 766a487 | 2003-02-18 23:35:48 +0000 | [diff] [blame] | 4 | |
pbrook | 0cb3fb1 | 2006-05-14 12:07:53 +0000 | [diff] [blame] | 5 | .PHONY: all clean distclean dvi info install install-doc tar tarbin \ |
| 6 | speed test test2 html dvi info |
| 7 | |
ths | 6f30fa8 | 2007-01-05 01:00:47 +0000 | [diff] [blame] | 8 | BASE_CFLAGS= |
| 9 | BASE_LDFLAGS= |
| 10 | |
| 11 | BASE_CFLAGS += $(OS_CFLAGS) |
bellard | fdbb469 | 2006-06-14 17:32:25 +0000 | [diff] [blame] | 12 | ifeq ($(ARCH),sparc) |
ths | 6f30fa8 | 2007-01-05 01:00:47 +0000 | [diff] [blame] | 13 | BASE_CFLAGS += -mcpu=ultrasparc |
bellard | fdbb469 | 2006-06-14 17:32:25 +0000 | [diff] [blame] | 14 | endif |
ths | 6f30fa8 | 2007-01-05 01:00:47 +0000 | [diff] [blame] | 15 | CPPFLAGS += -I. -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE |
bellard | 766a487 | 2003-02-18 23:35:48 +0000 | [diff] [blame] | 16 | LIBS= |
bellard | e35c55f | 2004-11-16 01:44:03 +0000 | [diff] [blame] | 17 | TOOLS=qemu-img$(EXESUF) |
bellard | 1f50f8d | 2004-05-08 14:44:43 +0000 | [diff] [blame] | 18 | ifdef CONFIG_STATIC |
ths | 6f30fa8 | 2007-01-05 01:00:47 +0000 | [diff] [blame] | 19 | BASE_LDFLAGS += -static |
bellard | 1f50f8d | 2004-05-08 14:44:43 +0000 | [diff] [blame] | 20 | endif |
pbrook | cc8ae6d | 2006-04-23 17:57:59 +0000 | [diff] [blame] | 21 | ifdef BUILD_DOCS |
bellard | acd935e | 2004-11-15 22:57:26 +0000 | [diff] [blame] | 22 | DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 |
pbrook | cc8ae6d | 2006-04-23 17:57:59 +0000 | [diff] [blame] | 23 | else |
| 24 | DOCS= |
| 25 | endif |
bellard | 7d13299 | 2003-03-06 23:23:54 +0000 | [diff] [blame] | 26 | |
bellard | 83f6409 | 2006-08-01 16:21:11 +0000 | [diff] [blame] | 27 | ifndef CONFIG_DARWIN |
| 28 | ifndef CONFIG_WIN32 |
| 29 | ifndef CONFIG_SOLARIS |
| 30 | LIBS+=-lrt |
| 31 | endif |
| 32 | endif |
| 33 | endif |
| 34 | |
pbrook | b9dea4f | 2006-05-13 16:54:03 +0000 | [diff] [blame] | 35 | all: $(TOOLS) $(DOCS) recurse-all |
| 36 | |
pbrook | 4aa4253 | 2006-05-13 13:55:08 +0000 | [diff] [blame] | 37 | subdir-%: dyngen$(EXESUF) |
| 38 | $(MAKE) -C $(subst subdir-,,$@) all |
| 39 | |
| 40 | recurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS)) |
bellard | 83f6409 | 2006-08-01 16:21:11 +0000 | [diff] [blame] | 41 | |
bellard | 18607dc | 2007-01-07 22:04:40 +0000 | [diff] [blame] | 42 | qemu-img$(EXESUF): qemu-img.c cutils.c block.c block-raw.c block-cow.c block-qcow.c aes.c block-vmdk.c block-cloop.c block-dmg.c block-bochs.c block-vpc.c block-vvfat.c block-qcow2.c |
ths | 6f30fa8 | 2007-01-05 01:00:47 +0000 | [diff] [blame] | 43 | $(CC) -DQEMU_TOOL $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ -lz $(LIBS) |
bellard | 47cea61 | 2004-05-17 20:06:42 +0000 | [diff] [blame] | 44 | |
bellard | 11d9f69 | 2004-04-02 20:55:59 +0000 | [diff] [blame] | 45 | dyngen$(EXESUF): dyngen.c |
ths | 6f30fa8 | 2007-01-05 01:00:47 +0000 | [diff] [blame] | 46 | $(HOST_CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -o $@ $^ |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 47 | |
| 48 | clean: |
bellard | 2d80ae8 | 2003-08-11 23:01:33 +0000 | [diff] [blame] | 49 | # avoid old build problems by removing potentially incorrect old files |
| 50 | rm -f config.mak config.h op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h |
bellard | acd935e | 2004-11-15 22:57:26 +0000 | [diff] [blame] | 51 | rm -f *.o *.a $(TOOLS) dyngen$(EXESUF) TAGS *.pod *~ */*~ |
bellard | 7d3505c | 2004-05-12 19:32:15 +0000 | [diff] [blame] | 52 | $(MAKE) -C tests clean |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 53 | for d in $(TARGET_DIRS); do \ |
bellard | 7d3505c | 2004-05-12 19:32:15 +0000 | [diff] [blame] | 54 | $(MAKE) -C $$d $@ || exit 1 ; \ |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 55 | done |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 56 | |
bellard | 7d13299 | 2003-03-06 23:23:54 +0000 | [diff] [blame] | 57 | distclean: clean |
pbrook | cc8ae6d | 2006-04-23 17:57:59 +0000 | [diff] [blame] | 58 | rm -f config-host.mak config-host.h $(DOCS) |
pbrook | 0cb3fb1 | 2006-05-14 12:07:53 +0000 | [diff] [blame] | 59 | rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr} |
bellard | 76bc683 | 2003-08-10 23:41:46 +0000 | [diff] [blame] | 60 | for d in $(TARGET_DIRS); do \ |
bellard | bc1b050 | 2003-10-28 00:12:52 +0000 | [diff] [blame] | 61 | rm -rf $$d || exit 1 ; \ |
bellard | 76bc683 | 2003-08-10 23:41:46 +0000 | [diff] [blame] | 62 | done |
bellard | 7d13299 | 2003-03-06 23:23:54 +0000 | [diff] [blame] | 63 | |
bellard | fed4a9a | 2004-12-12 22:18:34 +0000 | [diff] [blame] | 64 | KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \ |
| 65 | ar de en-us fi fr-be hr it lv nl pl ru th \ |
| 66 | common de-ch es fo fr-ca hu ja mk nl-be pt sl tr |
| 67 | |
pbrook | 38954dc | 2006-04-30 23:54:18 +0000 | [diff] [blame] | 68 | install-doc: $(DOCS) |
| 69 | mkdir -p "$(DESTDIR)$(docdir)" |
| 70 | $(INSTALL) -m 644 qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)" |
| 71 | ifndef CONFIG_WIN32 |
| 72 | mkdir -p "$(DESTDIR)$(mandir)/man1" |
| 73 | $(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1" |
| 74 | endif |
| 75 | |
| 76 | install: all $(if $(BUILD_DOCS),install-doc) |
pbrook | 1236cab | 2006-04-09 20:47:35 +0000 | [diff] [blame] | 77 | mkdir -p "$(DESTDIR)$(bindir)" |
pbrook | 6a88264 | 2006-04-17 13:57:12 +0000 | [diff] [blame] | 78 | $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)" |
pbrook | 1236cab | 2006-04-09 20:47:35 +0000 | [diff] [blame] | 79 | mkdir -p "$(DESTDIR)$(datadir)" |
pbrook | ad06484 | 2006-04-16 12:41:07 +0000 | [diff] [blame] | 80 | for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \ |
ths | eec85c2 | 2007-01-05 17:41:07 +0000 | [diff] [blame] | 81 | video.x openbios-sparc32 linux_boot.bin pxe-ne2k_pci.bin \ |
| 82 | pxe-rtl8139.bin pxe-pcnet.bin; do \ |
pbrook | 6a88264 | 2006-04-17 13:57:12 +0000 | [diff] [blame] | 83 | $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \ |
pbrook | ad06484 | 2006-04-16 12:41:07 +0000 | [diff] [blame] | 84 | done |
bellard | 11d9f69 | 2004-04-02 20:55:59 +0000 | [diff] [blame] | 85 | ifndef CONFIG_WIN32 |
pbrook | 1236cab | 2006-04-09 20:47:35 +0000 | [diff] [blame] | 86 | mkdir -p "$(DESTDIR)$(datadir)/keymaps" |
pbrook | ad06484 | 2006-04-16 12:41:07 +0000 | [diff] [blame] | 87 | for x in $(KEYMAPS); do \ |
pbrook | 6a88264 | 2006-04-17 13:57:12 +0000 | [diff] [blame] | 88 | $(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \ |
pbrook | ad06484 | 2006-04-16 12:41:07 +0000 | [diff] [blame] | 89 | done |
bellard | 11d9f69 | 2004-04-02 20:55:59 +0000 | [diff] [blame] | 90 | endif |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 91 | for d in $(TARGET_DIRS); do \ |
bellard | 7d3505c | 2004-05-12 19:32:15 +0000 | [diff] [blame] | 92 | $(MAKE) -C $$d $@ || exit 1 ; \ |
bellard | 626df76 | 2003-08-10 21:39:31 +0000 | [diff] [blame] | 93 | done |
bellard | 612384d | 2003-03-22 17:31:19 +0000 | [diff] [blame] | 94 | |
bellard | 367e86e | 2003-03-01 17:13:26 +0000 | [diff] [blame] | 95 | # various test targets |
bellard | 82c7e2a | 2004-01-04 16:10:33 +0000 | [diff] [blame] | 96 | test speed test2: all |
bellard | 7d3505c | 2004-05-12 19:32:15 +0000 | [diff] [blame] | 97 | $(MAKE) -C tests $@ |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 98 | |
bellard | 367e86e | 2003-03-01 17:13:26 +0000 | [diff] [blame] | 99 | TAGS: |
bellard | b9adb4a | 2003-04-29 20:41:16 +0000 | [diff] [blame] | 100 | etags *.[ch] tests/*.[ch] |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 101 | |
bellard | 6688bc6 | 2005-08-21 09:23:39 +0000 | [diff] [blame] | 102 | cscope: |
| 103 | rm -f ./cscope.* |
| 104 | find . -name "*.[ch]" -print > ./cscope.files |
| 105 | cscope -b |
| 106 | |
bellard | 3ef693a | 2003-03-23 20:17:16 +0000 | [diff] [blame] | 107 | # documentation |
bellard | 1f67313 | 2004-04-04 15:21:17 +0000 | [diff] [blame] | 108 | %.html: %.texi |
bellard | 3ef693a | 2003-03-23 20:17:16 +0000 | [diff] [blame] | 109 | texi2html -monolithic -number $< |
| 110 | |
bellard | f354832 | 2006-04-30 22:51:54 +0000 | [diff] [blame] | 111 | %.info: %.texi |
| 112 | makeinfo $< -o $@ |
| 113 | |
| 114 | %.dvi: %.texi |
| 115 | texi2dvi $< |
| 116 | |
bellard | 5a67135 | 2003-10-01 00:13:48 +0000 | [diff] [blame] | 117 | qemu.1: qemu-doc.texi |
pbrook | ad06484 | 2006-04-16 12:41:07 +0000 | [diff] [blame] | 118 | $(SRC_PATH)/texi2pod.pl $< qemu.pod |
bellard | 5a67135 | 2003-10-01 00:13:48 +0000 | [diff] [blame] | 119 | pod2man --section=1 --center=" " --release=" " qemu.pod > $@ |
| 120 | |
bellard | acd935e | 2004-11-15 22:57:26 +0000 | [diff] [blame] | 121 | qemu-img.1: qemu-img.texi |
pbrook | ad06484 | 2006-04-16 12:41:07 +0000 | [diff] [blame] | 122 | $(SRC_PATH)/texi2pod.pl $< qemu-img.pod |
bellard | acd935e | 2004-11-15 22:57:26 +0000 | [diff] [blame] | 123 | pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@ |
| 124 | |
pbrook | 0cb3fb1 | 2006-05-14 12:07:53 +0000 | [diff] [blame] | 125 | info: qemu-doc.info qemu-tech.info |
| 126 | |
| 127 | dvi: qemu-doc.dvi qemu-tech.dvi |
| 128 | |
| 129 | html: qemu-doc.html qemu-tech.html |
| 130 | |
ths | df5cf72 | 2007-01-24 22:56:36 +0000 | [diff] [blame] | 131 | VERSION ?= $(shell cat VERSION) |
| 132 | FILE = qemu-$(VERSION) |
bellard | 586314f | 2003-03-03 15:02:29 +0000 | [diff] [blame] | 133 | |
bellard | 1e43adf | 2003-09-30 20:54:24 +0000 | [diff] [blame] | 134 | # tar release (use 'make -k tar' on a checkouted tree) |
bellard | 586314f | 2003-03-03 15:02:29 +0000 | [diff] [blame] | 135 | tar: |
| 136 | rm -rf /tmp/$(FILE) |
bellard | 1e43adf | 2003-09-30 20:54:24 +0000 | [diff] [blame] | 137 | cp -r . /tmp/$(FILE) |
bellard | 76b62fd | 2003-10-28 00:47:44 +0000 | [diff] [blame] | 138 | ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS ) |
bellard | 586314f | 2003-03-03 15:02:29 +0000 | [diff] [blame] | 139 | rm -rf /tmp/$(FILE) |
| 140 | |
bellard | 76b62fd | 2003-10-28 00:47:44 +0000 | [diff] [blame] | 141 | # generate a binary distribution |
bellard | d691f66 | 2003-03-24 21:58:34 +0000 | [diff] [blame] | 142 | tarbin: |
bellard | 76b62fd | 2003-10-28 00:47:44 +0000 | [diff] [blame] | 143 | ( cd / ; tar zcvf ~/qemu-$(VERSION)-i386.tar.gz \ |
bellard | 43095f3 | 2005-04-27 20:49:23 +0000 | [diff] [blame] | 144 | $(bindir)/qemu \ |
bellard | 7efa438 | 2004-05-12 18:54:06 +0000 | [diff] [blame] | 145 | $(bindir)/qemu-system-ppc \ |
bellard | acd935e | 2004-11-15 22:57:26 +0000 | [diff] [blame] | 146 | $(bindir)/qemu-system-sparc \ |
bellard | 43095f3 | 2005-04-27 20:49:23 +0000 | [diff] [blame] | 147 | $(bindir)/qemu-system-x86_64 \ |
bellard | 93856aa | 2005-07-24 18:44:35 +0000 | [diff] [blame] | 148 | $(bindir)/qemu-system-mips \ |
pbrook | 3826099 | 2006-03-11 14:51:13 +0000 | [diff] [blame] | 149 | $(bindir)/qemu-system-mipsel \ |
bellard | ea31eb5 | 2005-12-06 21:42:03 +0000 | [diff] [blame] | 150 | $(bindir)/qemu-system-arm \ |
bellard | 7efa438 | 2004-05-12 18:54:06 +0000 | [diff] [blame] | 151 | $(bindir)/qemu-i386 \ |
| 152 | $(bindir)/qemu-arm \ |
bellard | ea31eb5 | 2005-12-06 21:42:03 +0000 | [diff] [blame] | 153 | $(bindir)/qemu-armeb \ |
bellard | 7efa438 | 2004-05-12 18:54:06 +0000 | [diff] [blame] | 154 | $(bindir)/qemu-sparc \ |
| 155 | $(bindir)/qemu-ppc \ |
bellard | ea31eb5 | 2005-12-06 21:42:03 +0000 | [diff] [blame] | 156 | $(bindir)/qemu-mips \ |
| 157 | $(bindir)/qemu-mipsel \ |
bellard | b932cab | 2004-08-01 21:46:49 +0000 | [diff] [blame] | 158 | $(bindir)/qemu-img \ |
bellard | 7efa438 | 2004-05-12 18:54:06 +0000 | [diff] [blame] | 159 | $(datadir)/bios.bin \ |
| 160 | $(datadir)/vgabios.bin \ |
bellard | de9258a | 2004-06-06 15:50:03 +0000 | [diff] [blame] | 161 | $(datadir)/vgabios-cirrus.bin \ |
bellard | 637f6cd | 2004-06-21 19:54:47 +0000 | [diff] [blame] | 162 | $(datadir)/ppc_rom.bin \ |
bellard | d529525 | 2005-07-03 14:00:51 +0000 | [diff] [blame] | 163 | $(datadir)/video.x \ |
bellard | 0986ac3 | 2006-06-14 12:36:32 +0000 | [diff] [blame] | 164 | $(datadir)/openbios-sparc32 \ |
bellard | 7efa438 | 2004-05-12 18:54:06 +0000 | [diff] [blame] | 165 | $(datadir)/linux_boot.bin \ |
bellard | 19c80e5 | 2007-02-05 21:22:42 +0000 | [diff] [blame^] | 166 | $(datadir)/pxe-ne2k_pci.bin \ |
| 167 | $(datadir)/pxe-rtl8139.bin \ |
| 168 | $(datadir)/pxe-pcnet.bin \ |
bellard | 1f50f8d | 2004-05-08 14:44:43 +0000 | [diff] [blame] | 169 | $(docdir)/qemu-doc.html \ |
| 170 | $(docdir)/qemu-tech.html \ |
bellard | acd935e | 2004-11-15 22:57:26 +0000 | [diff] [blame] | 171 | $(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 ) |
bellard | d691f66 | 2003-03-24 21:58:34 +0000 | [diff] [blame] | 172 | |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 173 | ifneq ($(wildcard .depend),) |
| 174 | include .depend |
| 175 | endif |