Initial Commit
[celltowerinfo] / 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 CFLAGS = -Wall -g
8
9 # These are used for cross-compiling and for saving the configure script
10 # from having to guess our platform (since we know it already)
11 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
12 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
13
14 # DEB_BUILD_OPTIONS
15 ################################################################################
16
17 # noop
18 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
19  CFLAGS += -O0
20 else
21  CFLAGS += -O2
22 endif
23
24 ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
25  CFLAGS += -ggdb3
26 endif
27
28 # parallel
29 ifneq (,$(findstring parallel,$(DEB_BUILD_OPTIONS)))
30  CELLINFO_MAKEFLAGS += -j$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
31 endif
32
33 # nostrip is handled by dh_strip
34
35 ################################################################################
36
37 config: config-stamp
38 config-stamp:
39         dh_testdir
40
41         if [ -r /usr/share/misc/config.sub ] && [ ! -f config.sub.backup ]; then \
42                 mv -v config.sub config.sub.backup; \
43                 cp -f /usr/share/misc/config.sub $(CURDIR)/config.sub; \
44         fi
45
46         if [ -r /usr/share/misc/config.guess ] && [ ! -f config.guess.backup ]; then \
47                 mv -v config.guess config.guess.backup; \
48                 cp -f /usr/share/misc/config.guess $(CURDIR)/config.guess; \
49         fi
50
51         touch $@
52
53 config-clean:
54         dh_testdir
55         dh_testroot
56
57         if [ -f config.sub.backup ]; then \
58                 mv -fv config.sub.backup config.sub; \
59         fi
60
61         if [ -f config.guess.backup ]; then \
62                 mv -fv config.guess.backup config.guess; \
63         fi
64
65         $(RM) config-stamp configure-stamp
66
67 configure: configure-stamp
68 configure-stamp:
69         dh_testdir
70   
71         ./autogen.sh
72         ./configure \
73                 --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
74                 --prefix=/usr \
75                 --mandir=/usr/share/man \
76                 $(conf_opt) \
77                 CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs,--as-needed"
78
79         touch $@
80
81 build: config build-stamp
82 build-stamp: configure
83         dh_testdir
84
85         $(MAKE) $(CELLINFO_MAKEFLAGS)
86         
87         touch $@
88
89 distclean:
90 #       # touch config.status to prevent execution of autoconf
91         [ ! -f Makefile ] || ( touch config.status && $(MAKE) distclean || true )
92
93 clean: config-clean distclean
94         dh_testdir
95         dh_testroot
96         
97         dh_clean 
98
99 install: build
100         dh_testdir
101         dh_testroot
102         dh_clean -k
103         dh_installdirs
104
105         $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
106
107 # Build architecture-independent files here.
108 binary-indep: build install
109         dh_testdir
110         dh_testroot
111         dh_link -i
112         dh_installchangelogs -p celltowerinfo NEWS
113         dh_installdocs -p celltowerinfo
114         dh_installexamples -p celltowerinfo
115         dh_compress -i
116         dh_fixperms -i
117         dh_installdeb -i
118         dh_gencontrol -i
119         dh_md5sums -i
120         dh_builddeb -i
121
122 # Build architecture-dependent files here.
123 binary-arch: build install
124         dh_testdir
125         dh_testroot
126         dh_link -a
127         dh_installinit -a
128         dh_installman -a
129         dh_installmime -a
130         dh_install -a --sourcedir=debian/tmp
131         chmod +x $(CURDIR)/debian/maemo-optify
132         $(CURDIR)/debian/maemo-optify
133         dh_strip -a
134         dh_compress -a
135         dh_fixperms -a
136         dh_installdeb -a
137         dh_shlibdeps -a
138         dh_gencontrol -a
139         dh_md5sums -a
140         dh_builddeb -a
141
142 binary: binary-indep binary-arch
143 .PHONY: config config-clean configure build clean binary-indep binary-arch binary install