Makefile 3.9 KB
Newer Older
P
pbrook 已提交
1
include config-host.mak
B
bellard 已提交
2

P
pbrook 已提交
3
CFLAGS=-Wall -O2 -g -fno-strict-aliasing -I.
4 5 6
ifdef CONFIG_DARWIN
CFLAGS+= -mdynamic-no-pic
endif
7
LDFLAGS=-g
B
bellard 已提交
8
LIBS=
B
bellard 已提交
9
DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
B
bellard 已提交
10
TOOLS=qemu-img$(EXESUF)
B
bellard 已提交
11 12 13
ifdef CONFIG_STATIC
LDFLAGS+=-static
endif
14
ifdef BUILD_DOCS
B
bellard 已提交
15
DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1
16 17 18
else
DOCS=
endif
B
bellard 已提交
19

P
pbrook 已提交
20 21 22 23 24 25
subdir-%: dyngen$(EXESUF)
	$(MAKE) -C $(subst subdir-,,$@) all

recurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS))
        
all: $(TOOLS) $(DOCS) recurse-all
26

27
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 已提交
28
	$(CC) -DQEMU_TOOL $(CFLAGS) $(LDFLAGS) $(DEFINES) -o $@ $^ -lz $(LIBS)
29

B
bellard 已提交
30 31
dyngen$(EXESUF): dyngen.c
	$(HOST_CC) $(CFLAGS) $(DEFINES) -o $@ $^
32 33

clean:
34 35
# 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 已提交
36
	rm -f *.o *.a $(TOOLS) dyngen$(EXESUF) TAGS *.pod *~ */*~
B
bellard 已提交
37
	$(MAKE) -C tests clean
B
bellard 已提交
38
	for d in $(TARGET_DIRS); do \
B
bellard 已提交
39
	$(MAKE) -C $$d $@ || exit 1 ; \
B
bellard 已提交
40
        done
41

B
bellard 已提交
42
distclean: clean
43
	rm -f config-host.mak config-host.h $(DOCS)
B
updated  
bellard 已提交
44
	for d in $(TARGET_DIRS); do \
B
bellard 已提交
45
	rm -rf $$d || exit 1 ; \
B
updated  
bellard 已提交
46
        done
B
bellard 已提交
47

B
bellard 已提交
48 49 50 51
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

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

B
bellard 已提交
78
# various test targets
B
update  
bellard 已提交
79
test speed test2: all
B
bellard 已提交
80
	$(MAKE) -C tests $@
81

B
bellard 已提交
82
TAGS: 
B
bellard 已提交
83
	etags *.[ch] tests/*.[ch]
84

B
bellard 已提交
85 86 87 88 89
cscope:
	rm -f ./cscope.*
	find . -name "*.[ch]" -print > ./cscope.files
	cscope -b

B
bellard 已提交
90
# documentation
B
bellard 已提交
91
%.html: %.texi
B
bellard 已提交
92 93
	texi2html -monolithic -number $<

B
bellard 已提交
94 95 96 97 98 99
%.info: %.texi
	makeinfo $< -o $@

%.dvi: %.texi
	texi2dvi $<

100
qemu.1: qemu-doc.texi
P
pbrook 已提交
101
	$(SRC_PATH)/texi2pod.pl $< qemu.pod
102 103
	pod2man --section=1 --center=" " --release=" " qemu.pod > $@

B
bellard 已提交
104
qemu-img.1: qemu-img.texi
P
pbrook 已提交
105
	$(SRC_PATH)/texi2pod.pl $< qemu-img.pod
B
bellard 已提交
106 107
	pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@

108
FILE=qemu-$(shell cat VERSION)
B
bellard 已提交
109

110
# tar release (use 'make -k tar' on a checkouted tree)
B
bellard 已提交
111 112
tar:
	rm -rf /tmp/$(FILE)
113
	cp -r . /tmp/$(FILE)
B
bellard 已提交
114
	( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS )
B
bellard 已提交
115 116
	rm -rf /tmp/$(FILE)

B
bellard 已提交
117
# generate a binary distribution
118
tarbin:
B
bellard 已提交
119
	( cd / ; tar zcvf ~/qemu-$(VERSION)-i386.tar.gz \
B
bellard 已提交
120
	$(bindir)/qemu \
B
bellard 已提交
121
	$(bindir)/qemu-system-ppc \
B
bellard 已提交
122
	$(bindir)/qemu-system-sparc \
B
bellard 已提交
123
	$(bindir)/qemu-system-x86_64 \
B
bellard 已提交
124
	$(bindir)/qemu-system-mips \
125
	$(bindir)/qemu-system-mipsel \
B
update  
bellard 已提交
126
	$(bindir)/qemu-system-arm \
B
bellard 已提交
127 128
	$(bindir)/qemu-i386 \
        $(bindir)/qemu-arm \
B
update  
bellard 已提交
129
        $(bindir)/qemu-armeb \
B
bellard 已提交
130 131
        $(bindir)/qemu-sparc \
        $(bindir)/qemu-ppc \
B
update  
bellard 已提交
132 133
        $(bindir)/qemu-mips \
        $(bindir)/qemu-mipsel \
B
bellard 已提交
134
        $(bindir)/qemu-img \
B
bellard 已提交
135 136
	$(datadir)/bios.bin \
	$(datadir)/vgabios.bin \
B
bellard 已提交
137
	$(datadir)/vgabios-cirrus.bin \
B
bellard 已提交
138
	$(datadir)/ppc_rom.bin \
B
bellard 已提交
139
	$(datadir)/video.x \
B
bellard 已提交
140
	$(datadir)/proll.elf \
B
bellard 已提交
141
	$(datadir)/linux_boot.bin \
B
bellard 已提交
142 143
	$(docdir)/qemu-doc.html \
	$(docdir)/qemu-tech.html \
B
bellard 已提交
144
	$(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 )
145

146 147 148
ifneq ($(wildcard .depend),)
include .depend
endif