]> git.proxmox.com Git - mirror_qemu.git/blob - Makefile
Make the tarball's VERSION part overridable from make invocation.
[mirror_qemu.git] / Makefile
1 # Makefile for QEMU.
2
3 include config-host.mak
4
5 .PHONY: all clean distclean dvi info install install-doc tar tarbin \
6 speed test test2 html dvi info
7
8 BASE_CFLAGS=
9 BASE_LDFLAGS=
10
11 BASE_CFLAGS += $(OS_CFLAGS)
12 ifeq ($(ARCH),sparc)
13 BASE_CFLAGS += -mcpu=ultrasparc
14 endif
15 CPPFLAGS += -I. -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
16 LIBS=
17 TOOLS=qemu-img$(EXESUF)
18 ifdef CONFIG_STATIC
19 BASE_LDFLAGS += -static
20 endif
21 ifdef BUILD_DOCS
22 DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1
23 else
24 DOCS=
25 endif
26
27 ifndef CONFIG_DARWIN
28 ifndef CONFIG_WIN32
29 ifndef CONFIG_SOLARIS
30 LIBS+=-lrt
31 endif
32 endif
33 endif
34
35 all: $(TOOLS) $(DOCS) recurse-all
36
37 subdir-%: dyngen$(EXESUF)
38 $(MAKE) -C $(subst subdir-,,$@) all
39
40 recurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS))
41
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
43 $(CC) -DQEMU_TOOL $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ -lz $(LIBS)
44
45 dyngen$(EXESUF): dyngen.c
46 $(HOST_CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -o $@ $^
47
48 clean:
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
51 rm -f *.o *.a $(TOOLS) dyngen$(EXESUF) TAGS *.pod *~ */*~
52 $(MAKE) -C tests clean
53 for d in $(TARGET_DIRS); do \
54 $(MAKE) -C $$d $@ || exit 1 ; \
55 done
56
57 distclean: clean
58 rm -f config-host.mak config-host.h $(DOCS)
59 rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr}
60 for d in $(TARGET_DIRS); do \
61 rm -rf $$d || exit 1 ; \
62 done
63
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
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)
77 mkdir -p "$(DESTDIR)$(bindir)"
78 $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)"
79 mkdir -p "$(DESTDIR)$(datadir)"
80 for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
81 video.x openbios-sparc32 linux_boot.bin pxe-ne2k_pci.bin \
82 pxe-rtl8139.bin pxe-pcnet.bin; do \
83 $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
84 done
85 ifndef CONFIG_WIN32
86 mkdir -p "$(DESTDIR)$(datadir)/keymaps"
87 for x in $(KEYMAPS); do \
88 $(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
89 done
90 endif
91 for d in $(TARGET_DIRS); do \
92 $(MAKE) -C $$d $@ || exit 1 ; \
93 done
94
95 # various test targets
96 test speed test2: all
97 $(MAKE) -C tests $@
98
99 TAGS:
100 etags *.[ch] tests/*.[ch]
101
102 cscope:
103 rm -f ./cscope.*
104 find . -name "*.[ch]" -print > ./cscope.files
105 cscope -b
106
107 # documentation
108 %.html: %.texi
109 texi2html -monolithic -number $<
110
111 %.info: %.texi
112 makeinfo $< -o $@
113
114 %.dvi: %.texi
115 texi2dvi $<
116
117 qemu.1: qemu-doc.texi
118 $(SRC_PATH)/texi2pod.pl $< qemu.pod
119 pod2man --section=1 --center=" " --release=" " qemu.pod > $@
120
121 qemu-img.1: qemu-img.texi
122 $(SRC_PATH)/texi2pod.pl $< qemu-img.pod
123 pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@
124
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
131 VERSION ?= $(shell cat VERSION)
132 FILE = qemu-$(VERSION)
133
134 # tar release (use 'make -k tar' on a checkouted tree)
135 tar:
136 rm -rf /tmp/$(FILE)
137 cp -r . /tmp/$(FILE)
138 ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS )
139 rm -rf /tmp/$(FILE)
140
141 # generate a binary distribution
142 tarbin:
143 ( cd / ; tar zcvf ~/qemu-$(VERSION)-i386.tar.gz \
144 $(bindir)/qemu \
145 $(bindir)/qemu-system-ppc \
146 $(bindir)/qemu-system-sparc \
147 $(bindir)/qemu-system-x86_64 \
148 $(bindir)/qemu-system-mips \
149 $(bindir)/qemu-system-mipsel \
150 $(bindir)/qemu-system-arm \
151 $(bindir)/qemu-i386 \
152 $(bindir)/qemu-arm \
153 $(bindir)/qemu-armeb \
154 $(bindir)/qemu-sparc \
155 $(bindir)/qemu-ppc \
156 $(bindir)/qemu-mips \
157 $(bindir)/qemu-mipsel \
158 $(bindir)/qemu-img \
159 $(datadir)/bios.bin \
160 $(datadir)/vgabios.bin \
161 $(datadir)/vgabios-cirrus.bin \
162 $(datadir)/ppc_rom.bin \
163 $(datadir)/video.x \
164 $(datadir)/openbios-sparc32 \
165 $(datadir)/linux_boot.bin \
166 $(docdir)/qemu-doc.html \
167 $(docdir)/qemu-tech.html \
168 $(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 )
169
170 ifneq ($(wildcard .depend),)
171 include .depend
172 endif