packing update
[qemu] / debian / rules
1 #!/usr/bin/make -f
2 #
3 # $Id: rules 366 2008-12-23 16:19:26Z aurel32 $
4 #
5
6 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
7         CFLAGS = -O0
8 endif
9
10 # Support multiple makes at once
11 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
12 NJOBS := -j $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
13 endif
14
15 # Architecture/system specific configuration
16 DEB_HOST_ARCH_OS = $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
17 DEB_HOST_ARCH_CPU = $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
18
19
20 TARGET_SYSTEM_TCG    = arm-softmmu i386-softmmu
21 TARGET_LINUX_TCG     = arm-linux-user i386-linux-user
22 package_list             = obj-sb2/config-host.mak
23 install_list             = sb2-qemu-install
24 sb1_prefix                       = /scratchbox/devkits/cputransp
25
26 target_system_list = $(TARGET_SYSTEM_TCG)
27
28 ifeq ($(DEB_HOST_ARCH_OS),linux)
29        conf_arch += --audio-drv-list=sdl
30        target_linux_list += $(TARGET_LINUX_TCG)
31 endif
32 ifeq ($(DEB_HOST_ARCH_OS),kfreebsd)
33        conf_arch += --audio-drv-list=oss,sdl,esd,pa
34 endif
35
36 BUILD_SB1_QEMU=$(shell test -r /scratchbox/tools/lib/libsb.a ; echo YES || echo NO)
37
38 ifeq ($(DEB_HOST_ARCH_CPU),i386)
39        conf_arch += --cpu=i386
40 ifeq ($(BUILD_SB1_QEMU),YES)
41        package_list += obj-sb1/config-host.mak
42        install_list += sb1-qemu-install
43 endif
44 endif
45 ifeq ($(DEB_HOST_ARCH_CPU),sparc)
46        conf_arch += --cpu=sparc
47 endif
48
49 qemu_docs = \
50         qemu-doc.html \
51         qemu-tech.html \
52         qemu.1 \
53         qemu-img.1
54
55 obj-sb2/config-host.mak: configure
56         dh_testdir
57         mkdir obj-sb2
58         ( cd obj-sb2; CFLAGS="$(CFLAGS)" ../configure \
59                 --prefix=/usr \
60                 --interp-prefix=/ \
61                 --disable-blobs \
62                 --enable-guest-base \
63                 --target-list="$(target_system_list) $(target_linux_list)" \
64                 $(conf_arch) )
65         ( cd obj-sb2; $(MAKE) $(NJOBS) )
66
67 obj-sb1/config-host.mak: configure
68         dh_testdir
69         mkdir obj-sb1
70         ( cd obj-sb1; CFLAGS="$(CFLAGS) $(SB1_CFLAGS)"  ../configure \
71                 --prefix=$(sb1_prefix) \
72                 --interp-prefix=/ \
73                 --static \
74                 --enable-guest-base \
75                 --target-list="arm-linux-user" \
76                 --disable-kqemu --disable-sdl )
77         ( cd obj-sb1; $(MAKE) $(NJOBS) )
78
79 build: $(package_list)
80
81 clean:
82         dh_testdir
83         dh_testroot
84         
85         [ ! -f config-host.mak ] || $(MAKE) distclean
86         
87         rm -rf obj-sb1 obj-sb2
88         rm -f $(qemu_docs)
89         
90         dh_clean
91
92 # cputransp-methods should be generated at postinst
93 sb1-qemu-install:
94         mkdir -p debian/sb1-qemu/$(sb1_prefix)/{bin,etc}
95         cp debian/cputransp-methods debian/sb1-qemu/$(sb1_prefix)/etc
96         cp obj-sb1/*-linux-user/qemu-* debian/sb1-qemu/$(sb1_prefix)/bin
97         ln -sf $(sb1_prefix)/bin/qemu-arm debian/sb1-qemu/$(sb1_prefix)/bin/qemu-arm-cvs-m
98
99 sb2-qemu-install:
100         mkdir -p debian/sb2-qemu-arm/usr/bin
101         cp obj-sb2/arm-linux-user/qemu-arm debian/sb2-qemu-arm/usr/bin/sb2-qemu-arm
102         cp obj-sb2/i386-linux-user/qemu-i386  debian/sb2-qemu-arm/usr/bin/sb2-qemu-i386
103         cp obj-sb2/arm-softmmu/qemu-system-arm  debian/sb2-qemu-arm/usr/bin/sb2-qemu-system-arm
104         cp obj-sb2/i386-softmmu/qemu  debian/sb2-qemu-arm/usr/bin/sb2-qemu-system-i386
105
106 install: build $(install_list)
107         dh_testdir
108         dh_testroot
109 #       dh_clean -k
110         dh_installdirs -a
111
112 binary-indep:
113 # Nothing to do.
114
115 binary-arch: install
116         dh_testdir
117         dh_testroot
118 #       dh_install -a
119 #       dh_installdebconf -a
120         dh_installdocs -s
121         dh_installexamples -s
122 #       dh_installlogrotate -a
123         dh_installman -s
124         dh_installinfo -s
125         dh_installchangelogs -s Changelog
126         dh_link -s
127         dh_strip -s
128         dh_compress -s
129         dh_fixperms -s
130         dh_installdeb -s
131         dh_shlibdeps -s
132         dh_gencontrol -s
133         dh_md5sums -s
134         dh_builddeb -s
135
136 binary: binary-indep binary-arch
137
138 .PHONY: build clean binary-indep binary-arch binary install
139