]>
Commit | Line | Data |
---|---|---|
0cb3fb1e PB |
1 | # Makefile for QEMU. |
2 | ||
ad064840 | 3 | include config-host.mak |
766a487a | 4 | |
0cb3fb1e PB |
5 | .PHONY: all clean distclean dvi info install install-doc tar tarbin \ |
6 | speed test test2 html dvi info | |
7 | ||
ad064840 | 8 | CFLAGS=-Wall -O2 -g -fno-strict-aliasing -I. |
83fb7adf FB |
9 | ifdef CONFIG_DARWIN |
10 | CFLAGS+= -mdynamic-no-pic | |
11 | endif | |
fdbb4691 FB |
12 | ifeq ($(ARCH),sparc) |
13 | CFLAGS+=-mcpu=ultrasparc | |
14 | endif | |
31e31b8a | 15 | LDFLAGS=-g |
766a487a | 16 | LIBS= |
d5249393 | 17 | DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE |
e35c55fe | 18 | TOOLS=qemu-img$(EXESUF) |
1f50f8d1 FB |
19 | ifdef CONFIG_STATIC |
20 | LDFLAGS+=-static | |
21 | endif | |
cc8ae6de | 22 | ifdef BUILD_DOCS |
acd935ef | 23 | DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 |
cc8ae6de PB |
24 | else |
25 | DOCS= | |
26 | endif | |
aa05ae6f | 27 | |
83f64091 FB |
28 | ifndef CONFIG_DARWIN |
29 | ifndef CONFIG_WIN32 | |
30 | ifndef CONFIG_SOLARIS | |
31 | LIBS+=-lrt | |
32 | endif | |
33 | endif | |
34 | endif | |
35 | ||
b9dea4fb PB |
36 | all: $(TOOLS) $(DOCS) recurse-all |
37 | ||
4aa42531 PB |
38 | subdir-%: dyngen$(EXESUF) |
39 | $(MAKE) -C $(subst subdir-,,$@) all | |
40 | ||
41 | recurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS)) | |
83f64091 | 42 | |
42ca6388 | 43 | qemu-img$(EXESUF): qemu-img.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 |
b932caba | 44 | $(CC) -DQEMU_TOOL $(CFLAGS) $(LDFLAGS) $(DEFINES) -o $@ $^ -lz $(LIBS) |
47cea614 | 45 | |
11d9f695 FB |
46 | dyngen$(EXESUF): dyngen.c |
47 | $(HOST_CC) $(CFLAGS) $(DEFINES) -o $@ $^ | |
31e31b8a FB |
48 | |
49 | clean: | |
2d80ae89 FB |
50 | # avoid old build problems by removing potentially incorrect old files |
51 | 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 | |
acd935ef | 52 | rm -f *.o *.a $(TOOLS) dyngen$(EXESUF) TAGS *.pod *~ */*~ |
7d3505c5 | 53 | $(MAKE) -C tests clean |
626df76a | 54 | for d in $(TARGET_DIRS); do \ |
7d3505c5 | 55 | $(MAKE) -C $$d $@ || exit 1 ; \ |
626df76a | 56 | done |
31e31b8a | 57 | |
7d13299d | 58 | distclean: clean |
cc8ae6de | 59 | rm -f config-host.mak config-host.h $(DOCS) |
0cb3fb1e | 60 | rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr} |
76bc6838 | 61 | for d in $(TARGET_DIRS); do \ |
bc1b050d | 62 | rm -rf $$d || exit 1 ; \ |
76bc6838 | 63 | done |
7d13299d | 64 | |
fed4a9ad FB |
65 | KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \ |
66 | ar de en-us fi fr-be hr it lv nl pl ru th \ | |
67 | common de-ch es fo fr-ca hu ja mk nl-be pt sl tr | |
68 | ||
38954dca PB |
69 | install-doc: $(DOCS) |
70 | mkdir -p "$(DESTDIR)$(docdir)" | |
71 | $(INSTALL) -m 644 qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)" | |
72 | ifndef CONFIG_WIN32 | |
73 | mkdir -p "$(DESTDIR)$(mandir)/man1" | |
74 | $(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1" | |
75 | endif | |
76 | ||
77 | install: all $(if $(BUILD_DOCS),install-doc) | |
1236cab7 | 78 | mkdir -p "$(DESTDIR)$(bindir)" |
6a882643 | 79 | $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)" |
1236cab7 | 80 | mkdir -p "$(DESTDIR)$(datadir)" |
ad064840 | 81 | for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \ |
0986ac3b | 82 | video.x openbios-sparc32 linux_boot.bin; do \ |
6a882643 | 83 | $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \ |
ad064840 | 84 | done |
11d9f695 | 85 | ifndef CONFIG_WIN32 |
1236cab7 | 86 | mkdir -p "$(DESTDIR)$(datadir)/keymaps" |
ad064840 | 87 | for x in $(KEYMAPS); do \ |
6a882643 | 88 | $(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \ |
ad064840 | 89 | done |
11d9f695 | 90 | endif |
626df76a | 91 | for d in $(TARGET_DIRS); do \ |
7d3505c5 | 92 | $(MAKE) -C $$d $@ || exit 1 ; \ |
626df76a | 93 | done |
612384d7 | 94 | |
367e86e8 | 95 | # various test targets |
82c7e2a4 | 96 | test speed test2: all |
7d3505c5 | 97 | $(MAKE) -C tests $@ |
31e31b8a | 98 | |
367e86e8 | 99 | TAGS: |
b9adb4a6 | 100 | etags *.[ch] tests/*.[ch] |
31e31b8a | 101 | |
6688bc6d FB |
102 | cscope: |
103 | rm -f ./cscope.* | |
104 | find . -name "*.[ch]" -print > ./cscope.files | |
105 | cscope -b | |
106 | ||
3ef693a0 | 107 | # documentation |
1f673135 | 108 | %.html: %.texi |
3ef693a0 FB |
109 | texi2html -monolithic -number $< |
110 | ||
f3548328 FB |
111 | %.info: %.texi |
112 | makeinfo $< -o $@ | |
113 | ||
114 | %.dvi: %.texi | |
115 | texi2dvi $< | |
116 | ||
5a67135a | 117 | qemu.1: qemu-doc.texi |
ad064840 | 118 | $(SRC_PATH)/texi2pod.pl $< qemu.pod |
5a67135a FB |
119 | pod2man --section=1 --center=" " --release=" " qemu.pod > $@ |
120 | ||
acd935ef | 121 | qemu-img.1: qemu-img.texi |
ad064840 | 122 | $(SRC_PATH)/texi2pod.pl $< qemu-img.pod |
acd935ef FB |
123 | pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@ |
124 | ||
0cb3fb1e PB |
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 | ||
1e43adfc | 131 | FILE=qemu-$(shell cat VERSION) |
586314f2 | 132 | |
1e43adfc | 133 | # tar release (use 'make -k tar' on a checkouted tree) |
586314f2 FB |
134 | tar: |
135 | rm -rf /tmp/$(FILE) | |
1e43adfc | 136 | cp -r . /tmp/$(FILE) |
76b62fd0 | 137 | ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS ) |
586314f2 FB |
138 | rm -rf /tmp/$(FILE) |
139 | ||
76b62fd0 | 140 | # generate a binary distribution |
d691f669 | 141 | tarbin: |
76b62fd0 | 142 | ( cd / ; tar zcvf ~/qemu-$(VERSION)-i386.tar.gz \ |
43095f31 | 143 | $(bindir)/qemu \ |
7efa4387 | 144 | $(bindir)/qemu-system-ppc \ |
acd935ef | 145 | $(bindir)/qemu-system-sparc \ |
43095f31 | 146 | $(bindir)/qemu-system-x86_64 \ |
93856aac | 147 | $(bindir)/qemu-system-mips \ |
38260998 | 148 | $(bindir)/qemu-system-mipsel \ |
ea31eb5b | 149 | $(bindir)/qemu-system-arm \ |
7efa4387 FB |
150 | $(bindir)/qemu-i386 \ |
151 | $(bindir)/qemu-arm \ | |
ea31eb5b | 152 | $(bindir)/qemu-armeb \ |
7efa4387 FB |
153 | $(bindir)/qemu-sparc \ |
154 | $(bindir)/qemu-ppc \ | |
ea31eb5b FB |
155 | $(bindir)/qemu-mips \ |
156 | $(bindir)/qemu-mipsel \ | |
b932caba | 157 | $(bindir)/qemu-img \ |
7efa4387 FB |
158 | $(datadir)/bios.bin \ |
159 | $(datadir)/vgabios.bin \ | |
de9258a8 | 160 | $(datadir)/vgabios-cirrus.bin \ |
637f6cd7 | 161 | $(datadir)/ppc_rom.bin \ |
d5295253 | 162 | $(datadir)/video.x \ |
0986ac3b | 163 | $(datadir)/openbios-sparc32 \ |
7efa4387 | 164 | $(datadir)/linux_boot.bin \ |
1f50f8d1 FB |
165 | $(docdir)/qemu-doc.html \ |
166 | $(docdir)/qemu-tech.html \ | |
acd935ef | 167 | $(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 ) |
d691f669 | 168 | |
31e31b8a FB |
169 | ifneq ($(wildcard .depend),) |
170 | include .depend | |
171 | endif |