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

pbrook's avatar
pbrook committed
3
include config-host.mak
bellard's avatar
bellard committed
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)
bellard's avatar
bellard committed
12
ifeq ($(ARCH),sparc)
13
BASE_CFLAGS += -mcpu=ultrasparc
bellard's avatar
bellard committed
14
endif
15
CPPFLAGS += -I. -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
bellard's avatar
bellard committed
16
LIBS=
bellard's avatar
bellard committed
17
TOOLS=qemu-img$(EXESUF)
bellard's avatar
bellard committed
18
ifdef CONFIG_STATIC
19
BASE_LDFLAGS += -static
bellard's avatar
bellard committed
20
endif
21
ifdef BUILD_DOCS
22
DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1
23
24
25
else
DOCS=
endif
bellard's avatar
bellard committed
26

bellard's avatar
bellard committed
27
28
29
30
31
32
ifndef CONFIG_DARWIN
ifndef CONFIG_WIN32
LIBS+=-lrt
endif
endif

pbrook's avatar
pbrook committed
33
34
all: $(TOOLS) $(DOCS) recurse-all

pbrook's avatar
pbrook committed
35
36
37
38
subdir-%: dyngen$(EXESUF)
	$(MAKE) -C $(subst subdir-,,$@) all

recurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS))
bellard's avatar
bellard committed
39

bellard's avatar
bellard committed
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

bellard's avatar
bellard committed
43
dyngen$(EXESUF): dyngen.c
44
	$(HOST_CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -o $@ $^
45
46

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

bellard's avatar
bellard committed
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}
bellard's avatar
updated    
bellard committed
58
	for d in $(TARGET_DIRS); do \
bellard's avatar
bellard committed
59
	rm -rf $$d || exit 1 ; \
bellard's avatar
updated    
bellard committed
60
        done
bellard's avatar
bellard committed
61

bellard's avatar
bellard committed
62
63
64
65
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

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

bellard's avatar
bellard committed
93
# various test targets
bellard's avatar
update    
bellard committed
94
test speed test2: all
bellard's avatar
bellard committed
95
	$(MAKE) -C tests $@
96

bellard's avatar
bellard committed
97
TAGS: 
bellard's avatar
bellard committed
98
	etags *.[ch] tests/*.[ch]
99

bellard's avatar
bellard committed
100
101
102
103
104
cscope:
	rm -f ./cscope.*
	find . -name "*.[ch]" -print > ./cscope.files
	cscope -b

bellard's avatar
bellard committed
105
# documentation
bellard's avatar
bellard committed
106
%.html: %.texi
bellard's avatar
bellard committed
107
108
	texi2html -monolithic -number $<

bellard's avatar
bellard committed
109
110
111
112
113
114
%.info: %.texi
	makeinfo $< -o $@

%.dvi: %.texi
	texi2dvi $<

115
qemu.1: qemu-doc.texi
pbrook's avatar
pbrook committed
116
	$(SRC_PATH)/texi2pod.pl $< qemu.pod
117
118
	pod2man --section=1 --center=" " --release=" " qemu.pod > $@

119
qemu-img.1: qemu-img.texi
pbrook's avatar
pbrook committed
120
	$(SRC_PATH)/texi2pod.pl $< qemu-img.pod
121
122
	pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@

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

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

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

129
130
VERSION ?= $(shell cat VERSION)
FILE = qemu-$(VERSION)
bellard's avatar
bellard committed
131

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

bellard's avatar
bellard committed
139
# generate a binary distribution
140
tarbin:
bellard's avatar
bellard committed
141
	( cd / ; tar zcvf ~/qemu-$(VERSION)-i386.tar.gz \
bellard's avatar
bellard committed
142
	$(bindir)/qemu \
bellard's avatar
bellard committed
143
	$(bindir)/qemu-system-ppc \
144
	$(bindir)/qemu-system-sparc \
bellard's avatar
bellard committed
145
	$(bindir)/qemu-system-x86_64 \
bellard's avatar
bellard committed
146
	$(bindir)/qemu-system-mips \
147
	$(bindir)/qemu-system-mipsel \
bellard's avatar
update    
bellard committed
148
	$(bindir)/qemu-system-arm \
bellard's avatar
bellard committed
149
150
	$(bindir)/qemu-i386 \
        $(bindir)/qemu-arm \
bellard's avatar
update    
bellard committed
151
        $(bindir)/qemu-armeb \
bellard's avatar
bellard committed
152
153
        $(bindir)/qemu-sparc \
        $(bindir)/qemu-ppc \
bellard's avatar
update    
bellard committed
154
155
        $(bindir)/qemu-mips \
        $(bindir)/qemu-mipsel \
bellard's avatar
bellard committed
156
        $(bindir)/qemu-img \
bellard's avatar
bellard committed
157
158
	$(datadir)/bios.bin \
	$(datadir)/vgabios.bin \
159
	$(datadir)/vgabios-cirrus.bin \
bellard's avatar
bellard committed
160
	$(datadir)/ppc_rom.bin \
bellard's avatar
bellard committed
161
	$(datadir)/video.x \
162
	$(datadir)/openbios-sparc32 \
bellard's avatar
bellard committed
163
	$(datadir)/linux_boot.bin \
bellard's avatar
update    
bellard committed
164
165
166
        $(datadir)/pxe-ne2k_pci.bin \
	$(datadir)/pxe-rtl8139.bin \
        $(datadir)/pxe-pcnet.bin \
bellard's avatar
bellard committed
167
168
	$(docdir)/qemu-doc.html \
	$(docdir)/qemu-tech.html \
169
	$(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 )
170

171
172
173
ifneq ($(wildcard .depend),)
include .depend
endif