win32 port (initial patch by kazu)
[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
14 all: dyngen$(EXESUF) $(TOOLS) qemu-doc.html qemu.1
15         for d in $(TARGET_DIRS); do \
16         make -C $$d $@ || exit 1 ; \
17         done
18
19 qemu-mkcow: qemu-mkcow.o
20         $(HOST_CC) -o $@ $^  $(LIBS)
21
22 dyngen$(EXESUF): dyngen.o
23         $(HOST_CC) -o $@ $^  $(LIBS)
24
25 %.o: %.c
26         $(HOST_CC) $(CFLAGS) $(DEFINES) -c -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 $(prefix)/bin
45         install -m 755 -s $(TOOLS) $(prefix)/bin
46         mkdir -p $(sharedir)
47         install -m 644 pc-bios/bios.bin pc-bios/vgabios.bin \
48                        pc-bios/linux_boot.bin $(sharedir)
49         mkdir -p $(mandir)/man1
50         install qemu.1 qemu-mkcow.1 $(mandir)/man1
51         for d in $(TARGET_DIRS); do \
52         make -C $$d $@ || exit 1 ; \
53         done
54
55 # various test targets
56 test speed test2: all
57         make -C tests $@
58
59 TAGS: 
60         etags *.[ch] tests/*.[ch]
61
62 # documentation
63 qemu-doc.html: qemu-doc.texi
64         texi2html -monolithic -number $<
65
66 qemu.1: qemu-doc.texi
67         ./texi2pod.pl $< qemu.pod
68         pod2man --section=1 --center=" " --release=" " qemu.pod > $@
69
70 FILE=qemu-$(shell cat VERSION)
71
72 # tar release (use 'make -k tar' on a checkouted tree)
73 tar:
74         rm -rf /tmp/$(FILE)
75         cp -r . /tmp/$(FILE)
76         ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS )
77         rm -rf /tmp/$(FILE)
78
79 # generate a binary distribution
80 tarbin:
81         ( cd / ; tar zcvf ~/qemu-$(VERSION)-i386.tar.gz \
82         $(prefix)/bin/qemu $(prefix)/bin/qemu-fast \
83         $(prefix)/bin/qemu-i386 \
84         $(prefix)/bin/qemu-arm \
85         $(prefix)/bin/qemu-sparc \
86         $(prefix)/bin/qemu-ppc \
87         $(sharedir)/bios.bin \
88         $(sharedir)/vgabios.bin \
89         $(mandir)/man1/qemu.1 )
90
91 ifneq ($(wildcard .depend),)
92 include .depend
93 endif