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