Makefile 4.2 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

P
pbrook 已提交
8
CFLAGS=-Wall -O2 -g -fno-strict-aliasing -I.
9 10 11
ifdef CONFIG_DARWIN
CFLAGS+= -mdynamic-no-pic
endif
12
LDFLAGS=-g
B
bellard 已提交
13
LIBS=
B
bellard 已提交
14
DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
B
bellard 已提交
15
TOOLS=qemu-img$(EXESUF)
B
bellard 已提交
16 17 18
ifdef CONFIG_STATIC
LDFLAGS+=-static
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

P
pbrook 已提交
25 26
all: $(TOOLS) $(DOCS) recurse-all

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

recurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS))
        
32
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
B
bellard 已提交
33
	$(CC) -DQEMU_TOOL $(CFLAGS) $(LDFLAGS) $(DEFINES) -o $@ $^ -lz $(LIBS)
34

B
bellard 已提交
35 36
dyngen$(EXESUF): dyngen.c
	$(HOST_CC) $(CFLAGS) $(DEFINES) -o $@ $^
37 38

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

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

B
bellard 已提交
54 55 56 57
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

58 59 60 61 62 63 64 65 66
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 已提交
67
	mkdir -p "$(DESTDIR)$(bindir)"
68
	$(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)"
P
pbrook 已提交
69
	mkdir -p "$(DESTDIR)$(datadir)"
P
pbrook 已提交
70 71
	for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
			video.x proll.elf linux_boot.bin; do \
72
		$(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
P
pbrook 已提交
73
	done
B
bellard 已提交
74
ifndef CONFIG_WIN32
P
pbrook 已提交
75
	mkdir -p "$(DESTDIR)$(datadir)/keymaps"
P
pbrook 已提交
76
	for x in $(KEYMAPS); do \
77
		$(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
P
pbrook 已提交
78
	done
B
bellard 已提交
79
endif
B
bellard 已提交
80
	for d in $(TARGET_DIRS); do \
B
bellard 已提交
81
	$(MAKE) -C $$d $@ || exit 1 ; \
B
bellard 已提交
82
        done
B
bellard 已提交
83

B
bellard 已提交
84
# various test targets
B
update  
bellard 已提交
85
test speed test2: all
B
bellard 已提交
86
	$(MAKE) -C tests $@
87

B
bellard 已提交
88
TAGS: 
B
bellard 已提交
89
	etags *.[ch] tests/*.[ch]
90

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

B
bellard 已提交
96
# documentation
B
bellard 已提交
97
%.html: %.texi
B
bellard 已提交
98 99
	texi2html -monolithic -number $<

B
bellard 已提交
100 101 102 103 104 105
%.info: %.texi
	makeinfo $< -o $@

%.dvi: %.texi
	texi2dvi $<

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

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

114 115 116 117 118 119
info: qemu-doc.info qemu-tech.info

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

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

120
FILE=qemu-$(shell cat VERSION)
B
bellard 已提交
121

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

B
bellard 已提交
129
# generate a binary distribution
130
tarbin:
B
bellard 已提交
131
	( cd / ; tar zcvf ~/qemu-$(VERSION)-i386.tar.gz \
B
bellard 已提交
132
	$(bindir)/qemu \
B
bellard 已提交
133
	$(bindir)/qemu-system-ppc \
B
bellard 已提交
134
	$(bindir)/qemu-system-sparc \
B
bellard 已提交
135
	$(bindir)/qemu-system-x86_64 \
B
bellard 已提交
136
	$(bindir)/qemu-system-mips \
137
	$(bindir)/qemu-system-mipsel \
B
update  
bellard 已提交
138
	$(bindir)/qemu-system-arm \
B
bellard 已提交
139 140
	$(bindir)/qemu-i386 \
        $(bindir)/qemu-arm \
B
update  
bellard 已提交
141
        $(bindir)/qemu-armeb \
B
bellard 已提交
142 143
        $(bindir)/qemu-sparc \
        $(bindir)/qemu-ppc \
B
update  
bellard 已提交
144 145
        $(bindir)/qemu-mips \
        $(bindir)/qemu-mipsel \
B
bellard 已提交
146
        $(bindir)/qemu-img \
B
bellard 已提交
147 148
	$(datadir)/bios.bin \
	$(datadir)/vgabios.bin \
B
bellard 已提交
149
	$(datadir)/vgabios-cirrus.bin \
B
bellard 已提交
150
	$(datadir)/ppc_rom.bin \
B
bellard 已提交
151
	$(datadir)/video.x \
B
bellard 已提交
152
	$(datadir)/proll.elf \
B
bellard 已提交
153
	$(datadir)/linux_boot.bin \
B
bellard 已提交
154 155
	$(docdir)/qemu-doc.html \
	$(docdir)/qemu-tech.html \
B
bellard 已提交
156
	$(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 )
157

158 159 160
ifneq ($(wildcard .depend),)
include .depend
endif