Constification
[qemu/qemu_0_9_1_stable.git] / Makefile
blobc547453d5f4491d35560d9934c752f15764ce248
1 # Makefile for QEMU.
3 include config-host.mak
5 .PHONY: all clean distclean dvi info install install-doc tar tarbin \
6 speed test test2 html dvi info
8 BASE_CFLAGS=
9 BASE_LDFLAGS=
11 BASE_CFLAGS += $(OS_CFLAGS) $(ARCH_CFLAGS)
12 BASE_LDFLAGS += $(OS_LDFLAGS) $(ARCH_LDFLAGS)
14 CPPFLAGS += -I. -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
15 LIBS=
16 TOOLS=qemu-img$(EXESUF)
17 ifdef CONFIG_STATIC
18 BASE_LDFLAGS += -static
19 endif
20 ifdef BUILD_DOCS
21 DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1
22 else
23 DOCS=
24 endif
26 LIBS+=$(AIOLIBS)
28 all: $(TOOLS) $(DOCS) recurse-all
30 subdir-%: dyngen$(EXESUF)
31 $(MAKE) -C $(subst subdir-,,$@) all
33 recurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS))
35 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
36 $(CC) -DQEMU_TOOL $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ -lz $(LIBS)
38 dyngen$(EXESUF): dyngen.c
39 $(HOST_CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -o $@ $^
41 clean:
42 # avoid old build problems by removing potentially incorrect old files
43 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
44 rm -f *.o *.a $(TOOLS) dyngen$(EXESUF) TAGS *.pod *~ */*~
45 $(MAKE) -C tests clean
46 for d in $(TARGET_DIRS); do \
47 $(MAKE) -C $$d $@ || exit 1 ; \
48 done
50 distclean: clean
51 rm -f config-host.mak config-host.h $(DOCS)
52 rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr}
53 for d in $(TARGET_DIRS); do \
54 rm -rf $$d || exit 1 ; \
55 done
57 KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \
58 ar de en-us fi fr-be hr it lv nl pl ru th \
59 common de-ch es fo fr-ca hu ja mk nl-be pt sl tr
61 install-doc: $(DOCS)
62 mkdir -p "$(DESTDIR)$(docdir)"
63 $(INSTALL) -m 644 qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)"
64 ifndef CONFIG_WIN32
65 mkdir -p "$(DESTDIR)$(mandir)/man1"
66 $(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
67 endif
69 install: all $(if $(BUILD_DOCS),install-doc)
70 mkdir -p "$(DESTDIR)$(bindir)"
71 $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)"
72 mkdir -p "$(DESTDIR)$(datadir)"
73 for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
74 video.x openbios-sparc32 linux_boot.bin pxe-ne2k_pci.bin \
75 pxe-rtl8139.bin pxe-pcnet.bin; do \
76 $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
77 done
78 ifndef CONFIG_WIN32
79 mkdir -p "$(DESTDIR)$(datadir)/keymaps"
80 for x in $(KEYMAPS); do \
81 $(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
82 done
83 endif
84 for d in $(TARGET_DIRS); do \
85 $(MAKE) -C $$d $@ || exit 1 ; \
86 done
88 # various test targets
89 test speed test2: all
90 $(MAKE) -C tests $@
92 TAGS:
93 etags *.[ch] tests/*.[ch]
95 cscope:
96 rm -f ./cscope.*
97 find . -name "*.[ch]" -print > ./cscope.files
98 cscope -b
100 # documentation
101 %.html: %.texi
102 texi2html -monolithic -number $<
104 %.info: %.texi
105 makeinfo $< -o $@
107 %.dvi: %.texi
108 texi2dvi $<
110 qemu.1: qemu-doc.texi
111 $(SRC_PATH)/texi2pod.pl $< qemu.pod
112 pod2man --section=1 --center=" " --release=" " qemu.pod > $@
114 qemu-img.1: qemu-img.texi
115 $(SRC_PATH)/texi2pod.pl $< qemu-img.pod
116 pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@
118 info: qemu-doc.info qemu-tech.info
120 dvi: qemu-doc.dvi qemu-tech.dvi
122 html: qemu-doc.html qemu-tech.html
124 VERSION ?= $(shell cat VERSION)
125 FILE = qemu-$(VERSION)
127 # tar release (use 'make -k tar' on a checkouted tree)
128 tar:
129 rm -rf /tmp/$(FILE)
130 cp -r . /tmp/$(FILE)
131 ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS )
132 rm -rf /tmp/$(FILE)
134 # generate a binary distribution
135 tarbin:
136 ( cd / ; tar zcvf ~/qemu-$(VERSION)-i386.tar.gz \
137 $(bindir)/qemu \
138 $(bindir)/qemu-system-ppc \
139 $(bindir)/qemu-system-sparc \
140 $(bindir)/qemu-system-x86_64 \
141 $(bindir)/qemu-system-mips \
142 $(bindir)/qemu-system-mipsel \
143 $(bindir)/qemu-system-mips64 \
144 $(bindir)/qemu-system-mips64el \
145 $(bindir)/qemu-system-arm \
146 $(bindir)/qemu-i386 \
147 $(bindir)/qemu-arm \
148 $(bindir)/qemu-armeb \
149 $(bindir)/qemu-sparc \
150 $(bindir)/qemu-ppc \
151 $(bindir)/qemu-mips \
152 $(bindir)/qemu-mipsel \
153 $(bindir)/qemu-alpha \
154 $(bindir)/qemu-img \
155 $(datadir)/bios.bin \
156 $(datadir)/vgabios.bin \
157 $(datadir)/vgabios-cirrus.bin \
158 $(datadir)/ppc_rom.bin \
159 $(datadir)/video.x \
160 $(datadir)/openbios-sparc32 \
161 $(datadir)/linux_boot.bin \
162 $(datadir)/pxe-ne2k_pci.bin \
163 $(datadir)/pxe-rtl8139.bin \
164 $(datadir)/pxe-pcnet.bin \
165 $(docdir)/qemu-doc.html \
166 $(docdir)/qemu-tech.html \
167 $(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 )
169 ifneq ($(wildcard .depend),)
170 include .depend
171 endif