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