* implement the "maemo-laucher" feature, which makes modest startup faster.
[modest] / debian / rules
1 #!/usr/bin/make -f
2 # -*- makefile -*-
3
4 # Uncomment this to turn on verbose mode.
5 #export DH_VERBOSE=1
6
7 # These are used for cross-compiling and for saving the configure script
8 # from having to guess our platform (since we know it already)
9 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
10 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
11
12 CFLAGS = -Wall -g
13 PACKAGENAME = modest
14
15 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
16         CFLAGS += -O0
17 else
18         CFLAGS += -O2
19 endif
20 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
21         INSTALL_PROGRAM += -s
22 endif
23
24 LAUNCHER = yes
25 ifneq (,$(findstring maemo-launcher,$(DEB_BUILD_OPTIONS)))
26         LAUNCHER = yes
27 endif
28
29 ifeq "$(strip $(LAUNCHER))" "yes"
30         LAUNCHER_DEPENDS = -Vlauncher:Depends="maemo-launcher"
31         LAUNCHER_CFLAGS = -shared
32         LAUNCHER_LDFLAGS = -pie -shared -export-dynamic
33 endif
34
35
36 config.status: configure
37         dh_testdir
38         # commands to configure the package.
39         if [ ! -x configure ]; then ./autogen.sh; fi
40         CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --sysconfdir=/etc --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info
41
42 configure: configure-stamp
43 configure-stamp:
44         dh_testdir
45         ./autogen.sh
46         touch configure-stamp
47
48 build: build-stamp
49
50 build-stamp:  config.status
51         dh_testdir
52
53         # commands to compile the package.
54         $(MAKE) \
55          MAEMO_LAUNCHER_CFLAGS="$(LAUNCHER_CFLAGS)" \
56          MAEMO_LAUNCHER_LDFLAGS="$(LAUNCHER_LDFLAGS)"
57         touch build-stamp
58
59 clean:
60         dh_testdir
61         dh_testroot
62         rm -f build-stamp 
63
64         # commands to clean up after the build process.
65         -$(MAKE) distclean
66 ifneq "$(wildcard /usr/share/misc/config.sub)" ""
67         cp -f /usr/share/misc/config.sub config.sub
68 endif
69 ifneq "$(wildcard /usr/share/misc/config.guess)" ""
70         cp -f /usr/share/misc/config.guess config.guess
71 endif
72         dh_clean 
73
74 install: build
75         dh_testdir
76         dh_testroot
77         dh_clean -k 
78         dh_installdirs
79
80         # install the package into debian/tmp/
81         $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
82
83 ifeq "$(strip $(LAUNCHER))" "yes"
84         mv $(CURDIR)/debian/tmp/usr/bin/modest \
85         $(CURDIR)/debian/modest/usr/bin/modest.launch
86         ln -s /usr/bin/maemo-invoker \
87         $(CURDIR)/debian/modest/usr/bin/modest
88 endif
89
90 # Build architecture-independent files here.
91 binary-indep: build install
92 # We have nothing to do by default.
93
94 # Build architecture-dependent files here.
95 binary-arch: build install
96         dh_testdir
97         dh_testroot
98         dh_installchangelogs 
99         dh_installdocs
100         dh_installexamples
101         dh_install --sourcedir=debian/tmp -v
102         dh_installmenu
103 #       dh_installdebconf       
104 #       dh_installlogrotate
105 #       dh_installemacsen
106 #       dh_installpam
107 #       dh_installmime
108 #       dh_installinit
109 #       dh_installcron
110 #       dh_installinfo
111         dh_installman
112         dh_link
113         dh_strip --keep-debug --dbg-package=modest --dbg-package=libmodest-dbus-client
114         dh_compress
115         dh_fixperms
116 #       dh_perl
117 #       dh_python
118         dh_makeshlibs
119         dh_installdeb
120         dh_shlibdeps
121         dh_gencontrol -- $(LAUNCHER_DEPENDS)
122         dh_md5sums
123         dh_builddeb
124
125 binary: binary-indep binary-arch
126 .PHONY: build clean binary-indep binary-arch binary install