Statistics
| Branch: | Revision:

root / Makefile @ 0986ac3b

History | View | Annotate | Download (4.2 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
CFLAGS=-Wall -O2 -g -fno-strict-aliasing -I.
9
ifdef CONFIG_DARWIN
10
CFLAGS+= -mdynamic-no-pic
11
endif
12
LDFLAGS=-g
13
LIBS=
14
DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
15
TOOLS=qemu-img$(EXESUF)
16
ifdef CONFIG_STATIC
17
LDFLAGS+=-static
18
endif
19
ifdef BUILD_DOCS
20
DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1
21
else
22
DOCS=
23
endif
24

    
25
all: $(TOOLS) $(DOCS) recurse-all
26

    
27
subdir-%: dyngen$(EXESUF)
28
	$(MAKE) -C $(subst subdir-,,$@) all
29

    
30
recurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS))
31
        
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
33
	$(CC) -DQEMU_TOOL $(CFLAGS) $(LDFLAGS) $(DEFINES) -o $@ $^ -lz $(LIBS)
34

    
35
dyngen$(EXESUF): dyngen.c
36
	$(HOST_CC) $(CFLAGS) $(DEFINES) -o $@ $^
37

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

    
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}
50
	for d in $(TARGET_DIRS); do \
51
	rm -rf $$d || exit 1 ; \
52
        done
53

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

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

    
66
install: all $(if $(BUILD_DOCS),install-doc)
67
	mkdir -p "$(DESTDIR)$(bindir)"
68
	$(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)"
69
	mkdir -p "$(DESTDIR)$(datadir)"
70
	for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
71
			video.x openbios-sparc32 linux_boot.bin; do \
72
		$(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
73
	done
74
ifndef CONFIG_WIN32
75
	mkdir -p "$(DESTDIR)$(datadir)/keymaps"
76
	for x in $(KEYMAPS); do \
77
		$(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
78
	done
79
endif
80
	for d in $(TARGET_DIRS); do \
81
	$(MAKE) -C $$d $@ || exit 1 ; \
82
        done
83

    
84
# various test targets
85
test speed test2: all
86
	$(MAKE) -C tests $@
87

    
88
TAGS: 
89
	etags *.[ch] tests/*.[ch]
90

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

    
96
# documentation
97
%.html: %.texi
98
	texi2html -monolithic -number $<
99

    
100
%.info: %.texi
101
	makeinfo $< -o $@
102

    
103
%.dvi: %.texi
104
	texi2dvi $<
105

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

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

    
114
info: qemu-doc.info qemu-tech.info
115

    
116
dvi: qemu-doc.dvi qemu-tech.dvi
117

    
118
html: qemu-doc.html qemu-tech.html
119

    
120
FILE=qemu-$(shell cat VERSION)
121

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

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

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