Makefile 4.4 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 11
BASE_CFLAGS=
BASE_LDFLAGS=

BASE_CFLAGS += $(OS_CFLAGS)
B
bellard 已提交
12
ifeq ($(ARCH),sparc)
13
BASE_CFLAGS += -mcpu=ultrasparc
B
bellard 已提交
14
endif
15
CPPFLAGS += -I. -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
B
bellard 已提交
16
LIBS=
B
bellard 已提交
17
TOOLS=qemu-img$(EXESUF)
B
bellard 已提交
18
ifdef CONFIG_STATIC
19
BASE_LDFLAGS += -static
B
bellard 已提交
20
endif
21
ifdef BUILD_DOCS
B
bellard 已提交
22
DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1
23 24 25
else
DOCS=
endif
B
bellard 已提交
26

B
bellard 已提交
27 28 29 30 31 32 33 34
ifndef CONFIG_DARWIN
ifndef CONFIG_WIN32
ifndef CONFIG_SOLARIS
LIBS+=-lrt
endif
endif
endif

P
pbrook 已提交
35 36
all: $(TOOLS) $(DOCS) recurse-all

P
pbrook 已提交
37 38 39 40
subdir-%: dyngen$(EXESUF)
	$(MAKE) -C $(subst subdir-,,$@) all

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

B
bellard 已提交
42
qemu-img$(EXESUF): qemu-img.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
43
	$(CC) -DQEMU_TOOL $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ -lz $(LIBS)
44

B
bellard 已提交
45
dyngen$(EXESUF): dyngen.c
46
	$(HOST_CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -o $@ $^
47 48

clean:
49 50
# 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 已提交
51
	rm -f *.o *.a $(TOOLS) dyngen$(EXESUF) TAGS *.pod *~ */*~
B
bellard 已提交
52
	$(MAKE) -C tests clean
B
bellard 已提交
53
	for d in $(TARGET_DIRS); do \
B
bellard 已提交
54
	$(MAKE) -C $$d $@ || exit 1 ; \
B
bellard 已提交
55
        done
56

B
bellard 已提交
57
distclean: clean
58
	rm -f config-host.mak config-host.h $(DOCS)
59
	rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr}
B
updated  
bellard 已提交
60
	for d in $(TARGET_DIRS); do \
B
bellard 已提交
61
	rm -rf $$d || exit 1 ; \
B
updated  
bellard 已提交
62
        done
B
bellard 已提交
63

B
bellard 已提交
64 65 66 67
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

68 69 70 71 72 73 74 75 76
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 已提交
77
	mkdir -p "$(DESTDIR)$(bindir)"
78
	$(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)"
P
pbrook 已提交
79
	mkdir -p "$(DESTDIR)$(datadir)"
P
pbrook 已提交
80
	for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
81
			video.x openbios-sparc32 linux_boot.bin; do \
82
		$(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
P
pbrook 已提交
83
	done
B
bellard 已提交
84
ifndef CONFIG_WIN32
P
pbrook 已提交
85
	mkdir -p "$(DESTDIR)$(datadir)/keymaps"
P
pbrook 已提交
86
	for x in $(KEYMAPS); do \
87
		$(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
P
pbrook 已提交
88
	done
B
bellard 已提交
89
endif
B
bellard 已提交
90
	for d in $(TARGET_DIRS); do \
B
bellard 已提交
91
	$(MAKE) -C $$d $@ || exit 1 ; \
B
bellard 已提交
92
        done
B
bellard 已提交
93

B
bellard 已提交
94
# various test targets
B
update  
bellard 已提交
95
test speed test2: all
B
bellard 已提交
96
	$(MAKE) -C tests $@
97

B
bellard 已提交
98
TAGS: 
B
bellard 已提交
99
	etags *.[ch] tests/*.[ch]
100

B
bellard 已提交
101 102 103 104 105
cscope:
	rm -f ./cscope.*
	find . -name "*.[ch]" -print > ./cscope.files
	cscope -b

B
bellard 已提交
106
# documentation
B
bellard 已提交
107
%.html: %.texi
B
bellard 已提交
108 109
	texi2html -monolithic -number $<

B
bellard 已提交
110 111 112 113 114 115
%.info: %.texi
	makeinfo $< -o $@

%.dvi: %.texi
	texi2dvi $<

116
qemu.1: qemu-doc.texi
P
pbrook 已提交
117
	$(SRC_PATH)/texi2pod.pl $< qemu.pod
118 119
	pod2man --section=1 --center=" " --release=" " qemu.pod > $@

B
bellard 已提交
120
qemu-img.1: qemu-img.texi
P
pbrook 已提交
121
	$(SRC_PATH)/texi2pod.pl $< qemu-img.pod
B
bellard 已提交
122 123
	pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@

124 125 126 127 128 129
info: qemu-doc.info qemu-tech.info

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

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

130
FILE=qemu-$(shell cat VERSION)
B
bellard 已提交
131

132
# tar release (use 'make -k tar' on a checkouted tree)
B
bellard 已提交
133 134
tar:
	rm -rf /tmp/$(FILE)
135
	cp -r . /tmp/$(FILE)
B
bellard 已提交
136
	( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS )
B
bellard 已提交
137 138
	rm -rf /tmp/$(FILE)

B
bellard 已提交
139
# generate a binary distribution
140
tarbin:
B
bellard 已提交
141
	( cd / ; tar zcvf ~/qemu-$(VERSION)-i386.tar.gz \
B
bellard 已提交
142
	$(bindir)/qemu \
B
bellard 已提交
143
	$(bindir)/qemu-system-ppc \
B
bellard 已提交
144
	$(bindir)/qemu-system-sparc \
B
bellard 已提交
145
	$(bindir)/qemu-system-x86_64 \
B
bellard 已提交
146
	$(bindir)/qemu-system-mips \
147
	$(bindir)/qemu-system-mipsel \
B
update  
bellard 已提交
148
	$(bindir)/qemu-system-arm \
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 \
B
update  
bellard 已提交
154 155
        $(bindir)/qemu-mips \
        $(bindir)/qemu-mipsel \
B
bellard 已提交
156
        $(bindir)/qemu-img \
B
bellard 已提交
157 158
	$(datadir)/bios.bin \
	$(datadir)/vgabios.bin \
B
bellard 已提交
159
	$(datadir)/vgabios-cirrus.bin \
B
bellard 已提交
160
	$(datadir)/ppc_rom.bin \
B
bellard 已提交
161
	$(datadir)/video.x \
162
	$(datadir)/openbios-sparc32 \
B
bellard 已提交
163
	$(datadir)/linux_boot.bin \
B
bellard 已提交
164 165
	$(docdir)/qemu-doc.html \
	$(docdir)/qemu-tech.html \
B
bellard 已提交
166
	$(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 )
167

168 169 170
ifneq ($(wildcard .depend),)
include .depend
endif