fix some lintian whining
[debian/gzip] / debian / rules
1 #!/usr/bin/make -f
2 #       Debian rules file for gzip, requires the debhelper package.
3 #       Crafted by Bdale Garbee, bdale@gag.com, 5 November 2000
4 #       Cleanup by Thorsten Glaser, tg@debian.org, 20 June 2012
5 #       based on the rules file of the jupp package
6
7 # Comment this to turn off debhelper verbose mode.
8 export DH_VERBOSE=1
9
10 shellescape='$(subst ','\'',$(1))'
11 shellexport=$(1)=$(call shellescape,${$(1)})
12
13 include /usr/share/dpkg/architecture.mk
14
15 # Automatic ${CC} selection for cross-compiles
16
17 # is ${CC} defined anywhere (other than implicit rules?)
18 ifneq (,$(findstring $(origin CC),default undefined))
19 # no - then default to gcc (or cross-gcc)
20 ifneq (${DEB_BUILD_ARCH},${DEB_HOST_ARCH})
21 CC=                     ${DEB_HOST_GNU_TYPE}-gcc
22 else
23 CC=                     gcc
24 endif
25 endif
26
27 EXTRA_CFLAGS=           -Wall
28 EXTRA_CPPFLAGS=
29
30 ifeq (${DEB_HOST_ARCH},amd64)
31 EXTRA_CPPFLAGS+=        -DUNALIGNED_OK
32 endif
33
34 # Automatic dpkg-buildflags selection, backport-friendly
35
36 ifneq (,$(wildcard /usr/share/dpkg/buildflags.mk))
37 # dpkg-dev (>= 1.16.1~)
38 DEB_CFLAGS_MAINT_APPEND=${EXTRA_CFLAGS}
39 DEB_CPPFLAGS_MAINT_APPEND=${EXTRA_CPPFLAGS}
40 # maybe turn this on later
41 #DEB_BUILD_MAINT_OPTIONS=hardening=+all
42 include /usr/share/dpkg/buildflags.mk
43 else
44 # old-fashioned way to determine build flags
45 CFLAGS=                 -O$(if $(findstring noopt,${DEB_BUILD_OPTIONS}),0,2) -g
46 CFLAGS+=                ${EXTRA_CFLAGS}
47 LDFLAGS+=               ${EXTRA_LDFLAGS}
48 endif
49
50 # maybe turn this on later
51 #ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
52 #NUMJOBS=               $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
53 #MAKEFLAGS+=            -j${NUMJOBS}
54 #endif
55
56 # whitespace-safe path to source directory
57 _topdir=$(call shellescape,$(shell pwd))
58
59 CONFIGURE_ARGS=         --prefix=/usr \
60                         --bindir=/bin \
61                         --infodir=${_topdir}/debian/gzip/usr/share/info \
62                         --mandir=${_topdir}/debian/gzip/usr/share/man
63
64 ifneq (${DEB_BUILD_ARCH},${DEB_HOST_ARCH})
65 CONFIGURE_ARGS+=        --host=${DEB_HOST_GNU_TYPE}
66 endif
67
68 reconf-stamp:
69         cp -f /usr/share/misc/config.sub build-aux/config.sub
70         cp -f /usr/share/misc/config.guess build-aux/config.guess
71         autoreconf -v
72         :>$@
73
74 configure: configure-stamp
75 configure-stamp: reconf-stamp
76         dh_testdir
77         mkdir -p builddir
78         cd builddir && env \
79             $(foreach i,CC CFLAGS CPPFLAGS LDFLAGS,$(call shellexport,$i)) \
80             CONFIG_SHELL=/bin/sh ../configure ${CONFIGURE_ARGS}
81         :>$@
82
83 configure-indep: configure-indep-stamp
84 configure-indep-stamp: reconf-stamp
85         dh_testdir
86         mkdir -p builddir-indep
87         cd builddir-indep && ../configure --host=i686-w64-mingw32
88         :>$@
89
90 build: build-stamp build-indep-stamp
91
92 build-arch: build-stamp
93 build-stamp: configure-stamp
94         dh_testdir
95         ${MAKE} -C builddir
96 ifeq (,$(filter nocheck,${DEB_BUILD_OPTIONS}))
97 ifeq (${DEB_BUILD_ARCH},${DEB_HOST_ARCH})
98         ${MAKE} -C builddir check
99 endif
100 endif
101         :>$@
102
103 build-indep: build-indep-stamp
104 build-indep-stamp: configure-indep-stamp
105         dh_testdir
106         ${MAKE} -C builddir-indep
107         :>$@
108
109 clean:
110         dh_testdir
111         dh_testroot
112         -rm -f build-stamp build-indep-stamp configure-stamp configure-indep-stamp reconf-stamp
113         -rm -rf builddir builddir-indep
114         dh_clean
115
116 binary: binary-arch binary-indep
117
118 binary-indep: build-indep-stamp
119         dh_testdir
120         dh_testroot
121         if test -x "$$(which dh_prep)"; then dh_prep; else dh_clean -k; fi
122         dh_installdirs
123         i686-w64-mingw32-strip builddir-indep/gzip.exe
124         install -m 0755 builddir-indep/gzip.exe \
125             debian/gzip-win32/usr/share/win32/
126         dh_installdocs -i README* TODO
127         dh_installchangelogs -i ChangeLog
128         dh_lintian -i
129         dh_compress -i
130         dh_fixperms -i
131         dh_installdeb -i
132         dh_gencontrol -i
133         dh_md5sums -i
134         dh_builddeb -i
135
136 binary-arch: build-stamp
137         dh_testdir
138         dh_testroot
139         if test -x "$$(which dh_prep)"; then dh_prep; else dh_clean -k; fi
140         dh_installdirs
141         ${MAKE} -C builddir install \
142             prefix=${_topdir}/debian/gzip/usr \
143             bindir=${_topdir}/debian/gzip/bin
144         dh_testdir -s
145         dh_testroot -s
146         dh_installdocs -s README* TODO
147         dh_installman *.1
148         dh_installinfo -s doc/gzip.info
149         dh_installchangelogs -s ChangeLog
150         dh_link -s
151         dh_lintian -s
152         dh_strip -s
153         dh_compress -s
154         ln -s gunzip.1.gz debian/gzip/usr/share/man/man1/uncompress.1.gz
155         ln -s zgrep.1.gz debian/gzip/usr/share/man/man1/zegrep.1.gz
156         ln -s zgrep.1.gz debian/gzip/usr/share/man/man1/zfgrep.1.gz
157         rm -f ${_topdir}/debian/gzip/usr/share/info/dir.gz
158         dh_fixperms -s
159         dh_makeshlibs -s
160         dh_installdeb -s
161         dh_shlibdeps -s
162         dh_gencontrol -s
163         dh_md5sums -s
164         dh_builddeb -s
165
166 .PHONY: binary binary-arch binary-indep build build-arch build-indep clean
167 .PHONY: configure configure-indep