Makefile 4.8 KB
Newer Older
1 2
# Makefile for QEMU.

P
pbrook 已提交
3
include config-host.mak
B
bellard 已提交
4

5 6 7
.PHONY: all clean distclean dvi info install install-doc tar tarbin \
	speed test test2 html dvi info

8 9 10
BASE_CFLAGS=
BASE_LDFLAGS=

11 12 13
BASE_CFLAGS += $(OS_CFLAGS) $(ARCH_CFLAGS)
BASE_LDFLAGS += $(OS_LDFLAGS) $(ARCH_LDFLAGS)

14
CPPFLAGS += -I. -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
B
bellard 已提交
15
LIBS=
B
bellard 已提交
16
ifdef CONFIG_STATIC
17
BASE_LDFLAGS += -static
B
bellard 已提交
18
endif
19
ifdef BUILD_DOCS
B
bellard 已提交
20
DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1
21 22 23
else
DOCS=
endif
B
bellard 已提交
24

25
LIBS+=$(AIOLIBS)
B
bellard 已提交
26

P
pbrook 已提交
27 28
all: $(TOOLS) $(DOCS) recurse-all

P
pbrook 已提交
29 30 31 32
subdir-%: dyngen$(EXESUF)
	$(MAKE) -C $(subst subdir-,,$@) all

recurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS))
B
bellard 已提交
33

34
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 block-parallels.c
35
	$(CC) -DQEMU_TOOL $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ -lz $(LIBS)
36

B
bellard 已提交
37
dyngen$(EXESUF): dyngen.c
38
	$(HOST_CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -o $@ $^
39 40

clean:
41
# avoid old build problems by removing potentially incorrect old files
42
	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
43
	rm -f *.o *.a $(TOOLS) dyngen$(EXESUF) TAGS cscope.* *.pod *~ */*~
B
bellard 已提交
44
	$(MAKE) -C tests clean
B
bellard 已提交
45
	for d in $(TARGET_DIRS); do \
B
bellard 已提交
46
	$(MAKE) -C $$d $@ || exit 1 ; \
B
bellard 已提交
47
        done
48

B
bellard 已提交
49
distclean: clean
50
	rm -f config-host.mak config-host.h $(DOCS)
51
	rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr}
B
updated  
bellard 已提交
52
	for d in $(TARGET_DIRS); do \
B
bellard 已提交
53
	rm -rf $$d || exit 1 ; \
B
updated  
bellard 已提交
54
        done
B
bellard 已提交
55

B
bellard 已提交
56 57 58 59
KEYMAPS=da     en-gb  et  fr     fr-ch  is  lt  modifiers  no  pt-br  sv \
ar      de     en-us  fi  fr-be  hr     it  lv  nl         pl  ru     th \
common  de-ch  es     fo  fr-ca  hu     ja  mk  nl-be      pt  sl     tr

60 61 62 63 64 65 66 67 68
install-doc: $(DOCS)
	mkdir -p "$(DESTDIR)$(docdir)"
	$(INSTALL) -m 644 qemu-doc.html  qemu-tech.html "$(DESTDIR)$(docdir)"
ifndef CONFIG_WIN32
	mkdir -p "$(DESTDIR)$(mandir)/man1"
	$(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
endif

install: all $(if $(BUILD_DOCS),install-doc)
P
pbrook 已提交
69
	mkdir -p "$(DESTDIR)$(bindir)"
70
	$(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)"
P
pbrook 已提交
71
	mkdir -p "$(DESTDIR)$(datadir)"
P
pbrook 已提交
72
	for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
73
		video.x openbios-sparc32 pxe-ne2k_pci.bin \
74
		pxe-rtl8139.bin pxe-pcnet.bin; do \
75
		$(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
P
pbrook 已提交
76
	done
B
bellard 已提交
77
ifndef CONFIG_WIN32
P
pbrook 已提交
78
	mkdir -p "$(DESTDIR)$(datadir)/keymaps"
P
pbrook 已提交
79
	for x in $(KEYMAPS); do \
80
		$(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
P
pbrook 已提交
81
	done
B
bellard 已提交
82
endif
B
bellard 已提交
83
	for d in $(TARGET_DIRS); do \
B
bellard 已提交
84
	$(MAKE) -C $$d $@ || exit 1 ; \
B
bellard 已提交
85
        done
B
bellard 已提交
86

B
bellard 已提交
87
# various test targets
B
update  
bellard 已提交
88
test speed test2: all
B
bellard 已提交
89
	$(MAKE) -C tests $@
90

91
TAGS:
B
bellard 已提交
92
	etags *.[ch] tests/*.[ch]
93

B
bellard 已提交
94 95 96 97 98
cscope:
	rm -f ./cscope.*
	find . -name "*.[ch]" -print > ./cscope.files
	cscope -b

B
bellard 已提交
99
# documentation
B
bellard 已提交
100
%.html: %.texi
B
bellard 已提交
101 102
	texi2html -monolithic -number $<

B
bellard 已提交
103 104 105 106 107 108
%.info: %.texi
	makeinfo $< -o $@

%.dvi: %.texi
	texi2dvi $<

109
qemu.1: qemu-doc.texi
P
pbrook 已提交
110
	$(SRC_PATH)/texi2pod.pl $< qemu.pod
111 112
	pod2man --section=1 --center=" " --release=" " qemu.pod > $@

B
bellard 已提交
113
qemu-img.1: qemu-img.texi
P
pbrook 已提交
114
	$(SRC_PATH)/texi2pod.pl $< qemu-img.pod
B
bellard 已提交
115 116
	pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@

117 118 119 120 121 122
info: qemu-doc.info qemu-tech.info

dvi: qemu-doc.dvi qemu-tech.dvi

html: qemu-doc.html qemu-tech.html

123 124
VERSION ?= $(shell cat VERSION)
FILE = qemu-$(VERSION)
B
bellard 已提交
125

126
# tar release (use 'make -k tar' on a checkouted tree)
B
bellard 已提交
127 128
tar:
	rm -rf /tmp/$(FILE)
129
	cp -r . /tmp/$(FILE)
B
bellard 已提交
130
	( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS )
B
bellard 已提交
131 132
	rm -rf /tmp/$(FILE)

B
bellard 已提交
133
# generate a binary distribution
134
tarbin:
T
ths 已提交
135
	( cd / ; tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \
B
bellard 已提交
136
	$(bindir)/qemu \
B
bellard 已提交
137
	$(bindir)/qemu-system-ppc \
138 139
	$(bindir)/qemu-system-ppc64 \
	$(bindir)/qemu-system-ppcemb \
B
bellard 已提交
140
	$(bindir)/qemu-system-sparc \
B
bellard 已提交
141
	$(bindir)/qemu-system-x86_64 \
B
bellard 已提交
142
	$(bindir)/qemu-system-mips \
143
	$(bindir)/qemu-system-mipsel \
T
ths 已提交
144 145
	$(bindir)/qemu-system-mips64 \
	$(bindir)/qemu-system-mips64el \
B
update  
bellard 已提交
146
	$(bindir)/qemu-system-arm \
T
ths 已提交
147 148
	$(bindir)/qemu-system-m68k \
	$(bindir)/qemu-system-sh4 \
B
bellard 已提交
149 150
	$(bindir)/qemu-i386 \
        $(bindir)/qemu-arm \
B
update  
bellard 已提交
151
        $(bindir)/qemu-armeb \
B
bellard 已提交
152 153
        $(bindir)/qemu-sparc \
        $(bindir)/qemu-ppc \
154
        $(bindir)/qemu-ppc64 \
B
update  
bellard 已提交
155 156
        $(bindir)/qemu-mips \
        $(bindir)/qemu-mipsel \
157
        $(bindir)/qemu-alpha \
T
ths 已提交
158 159
        $(bindir)/qemu-m68k \
        $(bindir)/qemu-sh4 \
B
bellard 已提交
160
        $(bindir)/qemu-img \
B
bellard 已提交
161 162
	$(datadir)/bios.bin \
	$(datadir)/vgabios.bin \
B
bellard 已提交
163
	$(datadir)/vgabios-cirrus.bin \
B
bellard 已提交
164
	$(datadir)/ppc_rom.bin \
B
bellard 已提交
165
	$(datadir)/video.x \
166
	$(datadir)/openbios-sparc32 \
B
update  
bellard 已提交
167 168 169
        $(datadir)/pxe-ne2k_pci.bin \
	$(datadir)/pxe-rtl8139.bin \
        $(datadir)/pxe-pcnet.bin \
B
bellard 已提交
170 171
	$(docdir)/qemu-doc.html \
	$(docdir)/qemu-tech.html \
B
bellard 已提交
172
	$(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 )
173

174 175 176
ifneq ($(wildcard .depend),)
include .depend
endif