b9d8e690c769533fde9cb25c85e383ed3fbf00c3
[qemu] / Makefile
1 include config-host.mak
2
3 CFLAGS=-Wall -O2 -g -fno-strict-aliasing
4 ifdef CONFIG_DARWIN
5 CFLAGS+= -mdynamic-no-pic
6 endif
7 ifdef CONFIG_WIN32
8 CFLAGS+=-fpack-struct 
9 endif
10 LDFLAGS=-g
11 LIBS=
12 DEFINES+=-D_GNU_SOURCE
13 TOOLS=qemu-img
14 ifdef CONFIG_STATIC
15 LDFLAGS+=-static
16 endif
17
18 all: dyngen$(EXESUF) $(TOOLS) qemu-doc.html qemu-tech.html qemu.1
19         for d in $(TARGET_DIRS); do \
20         $(MAKE) -C $$d $@ || exit 1 ; \
21         done
22
23 qemu-img: qemu-img.c block.c block-cow.c block-qcow.c aes.c block-vmdk.c
24         $(CC) -DQEMU_TOOL $(CFLAGS) $(LDFLAGS) $(DEFINES) -o $@ $^ -lz $(LIBS)
25
26 dyngen$(EXESUF): dyngen.c
27         $(HOST_CC) $(CFLAGS) $(DEFINES) -o $@ $^
28
29 clean:
30 # avoid old build problems by removing potentially incorrect old files
31         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 
32         rm -f *.o *.a $(TOOLS) dyngen$(EXESUF) TAGS qemu.pod
33         $(MAKE) -C tests clean
34         for d in $(TARGET_DIRS); do \
35         $(MAKE) -C $$d $@ || exit 1 ; \
36         done
37
38 distclean: clean
39         rm -f config-host.mak config-host.h
40         for d in $(TARGET_DIRS); do \
41         rm -rf $$d || exit 1 ; \
42         done
43
44 install: all 
45         mkdir -p "$(bindir)"
46 ifndef CONFIG_WIN32
47         install -m 755 -s $(TOOLS) "$(bindir)"
48 endif
49         mkdir -p "$(datadir)"
50         install -m 644 pc-bios/bios.bin pc-bios/vgabios.bin \
51                        pc-bios/vgabios-cirrus.bin \
52                        pc-bios/ppc_rom.bin \
53                        pc-bios/linux_boot.bin "$(datadir)"
54         mkdir -p "$(docdir)"
55         install -m 644 qemu-doc.html  qemu-tech.html "$(docdir)"
56 ifndef CONFIG_WIN32
57         mkdir -p "$(mandir)/man1"
58         install qemu.1 qemu-mkcow.1 "$(mandir)/man1"
59 endif
60         for d in $(TARGET_DIRS); do \
61         $(MAKE) -C $$d $@ || exit 1 ; \
62         done
63
64 # various test targets
65 test speed test2: all
66         $(MAKE) -C tests $@
67
68 TAGS: 
69         etags *.[ch] tests/*.[ch]
70
71 # documentation
72 %.html: %.texi
73         texi2html -monolithic -number $<
74
75 qemu.1: qemu-doc.texi
76         ./texi2pod.pl $< qemu.pod
77         pod2man --section=1 --center=" " --release=" " qemu.pod > $@
78
79 FILE=qemu-$(shell cat VERSION)
80
81 # tar release (use 'make -k tar' on a checkouted tree)
82 tar:
83         rm -rf /tmp/$(FILE)
84         cp -r . /tmp/$(FILE)
85         ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS )
86         rm -rf /tmp/$(FILE)
87
88 # generate a binary distribution
89 tarbin:
90         ( cd / ; tar zcvf ~/qemu-$(VERSION)-i386.tar.gz \
91         $(bindir)/qemu $(bindir)/qemu-fast \
92         $(bindir)/qemu-system-ppc \
93         $(bindir)/qemu-i386 \
94         $(bindir)/qemu-arm \
95         $(bindir)/qemu-sparc \
96         $(bindir)/qemu-ppc \
97         $(bindir)/qemu-img \
98         $(datadir)/bios.bin \
99         $(datadir)/vgabios.bin \
100         $(datadir)/vgabios-cirrus.bin \
101         $(datadir)/ppc_rom.bin \
102         $(datadir)/linux_boot.bin \
103         $(docdir)/qemu-doc.html \
104         $(docdir)/qemu-tech.html \
105         $(mandir)/man1/qemu.1 $(mandir)/man1/qemu-mkcow.1 )
106
107 ifneq ($(wildcard .depend),)
108 include .depend
109 endif