094b3959034cdb62dd26ddd81595be01621ae84b
[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 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
13 TOOLS=qemu-img$(EXESUF)
14 ifdef CONFIG_STATIC
15 LDFLAGS+=-static
16 endif
17 DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1
18
19 all: dyngen$(EXESUF) $(TOOLS) $(DOCS)
20         for d in $(TARGET_DIRS); do \
21         $(MAKE) -C $$d $@ || exit 1 ; \
22         done
23
24 qemu-img$(EXESUF): qemu-img.c block.c block-cow.c block-qcow.c aes.c block-vmdk.c block-cloop.c
25         $(CC) -DQEMU_TOOL $(CFLAGS) $(LDFLAGS) $(DEFINES) -o $@ $^ -lz $(LIBS)
26
27 dyngen$(EXESUF): dyngen.c
28         $(HOST_CC) $(CFLAGS) $(DEFINES) -o $@ $^
29
30 clean:
31 # avoid old build problems by removing potentially incorrect old files
32         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 
33         rm -f *.o *.a $(TOOLS) dyngen$(EXESUF) TAGS *.pod *~ */*~
34         $(MAKE) -C tests clean
35         for d in $(TARGET_DIRS); do \
36         $(MAKE) -C $$d $@ || exit 1 ; \
37         done
38
39 distclean: clean
40         rm -f config-host.mak config-host.h
41         for d in $(TARGET_DIRS); do \
42         rm -rf $$d || exit 1 ; \
43         done
44
45 install: all 
46         mkdir -p "$(bindir)"
47         install -m 755 -s $(TOOLS) "$(bindir)"
48         mkdir -p "$(datadir)"
49         install -m 644 pc-bios/bios.bin pc-bios/vgabios.bin \
50                        pc-bios/vgabios-cirrus.bin \
51                        pc-bios/ppc_rom.bin \
52                        pc-bios/proll.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-img.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 qemu-img.1: qemu-img.texi
80         ./texi2pod.pl $< qemu-img.pod
81         pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@
82
83 FILE=qemu-$(shell cat VERSION)
84
85 # tar release (use 'make -k tar' on a checkouted tree)
86 tar:
87         rm -rf /tmp/$(FILE)
88         cp -r . /tmp/$(FILE)
89         ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS )
90         rm -rf /tmp/$(FILE)
91
92 # generate a binary distribution
93 tarbin:
94         ( cd / ; tar zcvf ~/qemu-$(VERSION)-i386.tar.gz \
95         $(bindir)/qemu $(bindir)/qemu-fast \
96         $(bindir)/qemu-system-ppc \
97         $(bindir)/qemu-system-sparc \
98         $(bindir)/qemu-i386 \
99         $(bindir)/qemu-arm \
100         $(bindir)/qemu-sparc \
101         $(bindir)/qemu-ppc \
102         $(bindir)/qemu-img \
103         $(datadir)/bios.bin \
104         $(datadir)/vgabios.bin \
105         $(datadir)/vgabios-cirrus.bin \
106         $(datadir)/ppc_rom.bin \
107         $(datadir)/proll.bin \
108         $(datadir)/linux_boot.bin \
109         $(docdir)/qemu-doc.html \
110         $(docdir)/qemu-tech.html \
111         $(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 )
112
113 ifneq ($(wildcard .depend),)
114 include .depend
115 endif