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