]> git.proxmox.com Git - mirror_qemu.git/blob - Makefile
Allow parallel make.
[mirror_qemu.git] / Makefile
1 include config-host.mak
2
3 CFLAGS=-Wall -O2 -g -fno-strict-aliasing -I.
4 ifdef CONFIG_DARWIN
5 CFLAGS+= -mdynamic-no-pic
6 endif
7 LDFLAGS=-g
8 LIBS=
9 DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
10 TOOLS=qemu-img$(EXESUF)
11 ifdef CONFIG_STATIC
12 LDFLAGS+=-static
13 endif
14 ifdef BUILD_DOCS
15 DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1
16 else
17 DOCS=
18 endif
19
20 subdir-%: dyngen$(EXESUF)
21 $(MAKE) -C $(subst subdir-,,$@) all
22
23 recurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS))
24
25 all: $(TOOLS) $(DOCS) recurse-all
26
27 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
28 $(CC) -DQEMU_TOOL $(CFLAGS) $(LDFLAGS) $(DEFINES) -o $@ $^ -lz $(LIBS)
29
30 dyngen$(EXESUF): dyngen.c
31 $(HOST_CC) $(CFLAGS) $(DEFINES) -o $@ $^
32
33 clean:
34 # avoid old build problems by removing potentially incorrect old files
35 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
36 rm -f *.o *.a $(TOOLS) dyngen$(EXESUF) TAGS *.pod *~ */*~
37 $(MAKE) -C tests clean
38 for d in $(TARGET_DIRS); do \
39 $(MAKE) -C $$d $@ || exit 1 ; \
40 done
41
42 distclean: clean
43 rm -f config-host.mak config-host.h $(DOCS)
44 for d in $(TARGET_DIRS); do \
45 rm -rf $$d || exit 1 ; \
46 done
47
48 KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \
49 ar de en-us fi fr-be hr it lv nl pl ru th \
50 common de-ch es fo fr-ca hu ja mk nl-be pt sl tr
51
52 install-doc: $(DOCS)
53 mkdir -p "$(DESTDIR)$(docdir)"
54 $(INSTALL) -m 644 qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)"
55 ifndef CONFIG_WIN32
56 mkdir -p "$(DESTDIR)$(mandir)/man1"
57 $(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
58 endif
59
60 install: all $(if $(BUILD_DOCS),install-doc)
61 mkdir -p "$(DESTDIR)$(bindir)"
62 $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)"
63 mkdir -p "$(DESTDIR)$(datadir)"
64 for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
65 video.x proll.elf linux_boot.bin; do \
66 $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
67 done
68 ifndef CONFIG_WIN32
69 mkdir -p "$(DESTDIR)$(datadir)/keymaps"
70 for x in $(KEYMAPS); do \
71 $(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
72 done
73 endif
74 for d in $(TARGET_DIRS); do \
75 $(MAKE) -C $$d $@ || exit 1 ; \
76 done
77
78 # various test targets
79 test speed test2: all
80 $(MAKE) -C tests $@
81
82 TAGS:
83 etags *.[ch] tests/*.[ch]
84
85 cscope:
86 rm -f ./cscope.*
87 find . -name "*.[ch]" -print > ./cscope.files
88 cscope -b
89
90 # documentation
91 %.html: %.texi
92 texi2html -monolithic -number $<
93
94 %.info: %.texi
95 makeinfo $< -o $@
96
97 %.dvi: %.texi
98 texi2dvi $<
99
100 qemu.1: qemu-doc.texi
101 $(SRC_PATH)/texi2pod.pl $< qemu.pod
102 pod2man --section=1 --center=" " --release=" " qemu.pod > $@
103
104 qemu-img.1: qemu-img.texi
105 $(SRC_PATH)/texi2pod.pl $< qemu-img.pod
106 pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@
107
108 FILE=qemu-$(shell cat VERSION)
109
110 # tar release (use 'make -k tar' on a checkouted tree)
111 tar:
112 rm -rf /tmp/$(FILE)
113 cp -r . /tmp/$(FILE)
114 ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS )
115 rm -rf /tmp/$(FILE)
116
117 # generate a binary distribution
118 tarbin:
119 ( cd / ; tar zcvf ~/qemu-$(VERSION)-i386.tar.gz \
120 $(bindir)/qemu \
121 $(bindir)/qemu-system-ppc \
122 $(bindir)/qemu-system-sparc \
123 $(bindir)/qemu-system-x86_64 \
124 $(bindir)/qemu-system-mips \
125 $(bindir)/qemu-system-mipsel \
126 $(bindir)/qemu-system-arm \
127 $(bindir)/qemu-i386 \
128 $(bindir)/qemu-arm \
129 $(bindir)/qemu-armeb \
130 $(bindir)/qemu-sparc \
131 $(bindir)/qemu-ppc \
132 $(bindir)/qemu-mips \
133 $(bindir)/qemu-mipsel \
134 $(bindir)/qemu-img \
135 $(datadir)/bios.bin \
136 $(datadir)/vgabios.bin \
137 $(datadir)/vgabios-cirrus.bin \
138 $(datadir)/ppc_rom.bin \
139 $(datadir)/video.x \
140 $(datadir)/proll.elf \
141 $(datadir)/linux_boot.bin \
142 $(docdir)/qemu-doc.html \
143 $(docdir)/qemu-tech.html \
144 $(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 )
145
146 ifneq ($(wildcard .depend),)
147 include .depend
148 endif