Allow user to specify "install" utility.
[qemu] / Makefile
1 include config-host.mak
2
3 CFLAGS=-Wall -O2 -g -fno-strict-aliasing -I.
4 ifdef CONFIG_DARWIN
5 CFLAGS+= -mdynamic-no-pic
6 endif
7 LDFLAGS=-g
8 LIBS=
9 DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
10 TOOLS=qemu-img$(EXESUF)
11 ifdef CONFIG_STATIC
12 LDFLAGS+=-static
13 endif
14 DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1
15
16 all: dyngen$(EXESUF) $(TOOLS) $(DOCS)
17         for d in $(TARGET_DIRS); do \
18         $(MAKE) -C $$d $@ || exit 1 ; \
19         done
20
21 qemu-img$(EXESUF): qemu-img.c block.c block-cow.c block-qcow.c aes.c block-vmdk.c block-cloop.c block-dmg.c block-bochs.c block-vpc.c block-vvfat.c
22         $(CC) -DQEMU_TOOL $(CFLAGS) $(LDFLAGS) $(DEFINES) -o $@ $^ -lz $(LIBS)
23
24 dyngen$(EXESUF): dyngen.c
25         $(HOST_CC) $(CFLAGS) $(DEFINES) -o $@ $^
26
27 clean:
28 # avoid old build problems by removing potentially incorrect old files
29         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 
30         rm -f *.o *.a $(TOOLS) dyngen$(EXESUF) TAGS *.pod *~ */*~
31         $(MAKE) -C tests clean
32         for d in $(TARGET_DIRS); do \
33         $(MAKE) -C $$d $@ || exit 1 ; \
34         done
35
36 distclean: clean
37         rm -f config-host.mak config-host.h
38         for d in $(TARGET_DIRS); do \
39         rm -rf $$d || exit 1 ; \
40         done
41
42 KEYMAPS=da     en-gb  et  fr     fr-ch  is  lt  modifiers  no  pt-br  sv \
43 ar      de     en-us  fi  fr-be  hr     it  lv  nl         pl  ru     th \
44 common  de-ch  es     fo  fr-ca  hu     ja  mk  nl-be      pt  sl     tr
45
46 install: all 
47         mkdir -p "$(DESTDIR)$(bindir)"
48         $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)"
49         mkdir -p "$(DESTDIR)$(datadir)"
50         for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
51                         video.x proll.elf linux_boot.bin; do \
52                 $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
53         done
54         mkdir -p "$(DESTDIR)$(docdir)"
55         $(INSTALL) -m 644 qemu-doc.html  qemu-tech.html "$(DESTDIR)$(docdir)"
56 ifndef CONFIG_WIN32
57         mkdir -p "$(DESTDIR)$(mandir)/man1"
58         $(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
59         mkdir -p "$(DESTDIR)$(datadir)/keymaps"
60         for x in $(KEYMAPS); do \
61                 $(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
62         done
63 endif
64         for d in $(TARGET_DIRS); do \
65         $(MAKE) -C $$d $@ || exit 1 ; \
66         done
67
68 # various test targets
69 test speed test2: all
70         $(MAKE) -C tests $@
71
72 TAGS: 
73         etags *.[ch] tests/*.[ch]
74
75 cscope:
76         rm -f ./cscope.*
77         find . -name "*.[ch]" -print > ./cscope.files
78         cscope -b
79
80 # documentation
81 %.html: %.texi
82         texi2html -monolithic -number $<
83
84 qemu.1: qemu-doc.texi
85         $(SRC_PATH)/texi2pod.pl $< qemu.pod
86         pod2man --section=1 --center=" " --release=" " qemu.pod > $@
87
88 qemu-img.1: qemu-img.texi
89         $(SRC_PATH)/texi2pod.pl $< qemu-img.pod
90         pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@
91
92 FILE=qemu-$(shell cat VERSION)
93
94 # tar release (use 'make -k tar' on a checkouted tree)
95 tar:
96         rm -rf /tmp/$(FILE)
97         cp -r . /tmp/$(FILE)
98         ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS )
99         rm -rf /tmp/$(FILE)
100
101 # generate a binary distribution
102 tarbin:
103         ( cd / ; tar zcvf ~/qemu-$(VERSION)-i386.tar.gz \
104         $(bindir)/qemu \
105         $(bindir)/qemu-system-ppc \
106         $(bindir)/qemu-system-sparc \
107         $(bindir)/qemu-system-x86_64 \
108         $(bindir)/qemu-system-mips \
109         $(bindir)/qemu-system-mipsel \
110         $(bindir)/qemu-system-arm \
111         $(bindir)/qemu-i386 \
112         $(bindir)/qemu-arm \
113         $(bindir)/qemu-armeb \
114         $(bindir)/qemu-sparc \
115         $(bindir)/qemu-ppc \
116         $(bindir)/qemu-mips \
117         $(bindir)/qemu-mipsel \
118         $(bindir)/qemu-img \
119         $(datadir)/bios.bin \
120         $(datadir)/vgabios.bin \
121         $(datadir)/vgabios-cirrus.bin \
122         $(datadir)/ppc_rom.bin \
123         $(datadir)/video.x \
124         $(datadir)/proll.elf \
125         $(datadir)/linux_boot.bin \
126         $(docdir)/qemu-doc.html \
127         $(docdir)/qemu-tech.html \
128         $(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 )
129
130 ifneq ($(wildcard .depend),)
131 include .depend
132 endif