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