let make display commands for automatic log checkers
[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 export DEFS=NO_ASM # Avoid TEXTRELs on i386
28 EXTRA_CFLAGS=           -Wall
29 EXTRA_CPPFLAGS=
30
31 ifeq (${DEB_HOST_ARCH},amd64)
32 EXTRA_CPPFLAGS+=        -DUNALIGNED_OK
33 endif
34
35 # Automatic dpkg-buildflags selection, backport-friendly
36
37 ifneq (,$(wildcard /usr/share/dpkg/buildflags.mk))
38 # dpkg-dev (>= 1.16.1~)
39 DEB_CFLAGS_MAINT_APPEND=${EXTRA_CFLAGS}
40 DEB_CPPFLAGS_MAINT_APPEND=${EXTRA_CPPFLAGS}
41 # maybe turn this on later
42 #DEB_BUILD_MAINT_OPTIONS=hardening=+all
43 include /usr/share/dpkg/buildflags.mk
44 else
45 # old-fashioned way to determine build flags
46 CFLAGS=                 -O$(if $(findstring noopt,${DEB_BUILD_OPTIONS}),0,2) -g
47 CFLAGS+=                ${EXTRA_CFLAGS}
48 LDFLAGS+=               ${EXTRA_LDFLAGS}
49 endif
50
51 # maybe turn this on later
52 #ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
53 #NUMJOBS=               $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
54 #MAKEFLAGS+=            -j${NUMJOBS}
55 #endif
56
57 # whitespace-safe path to source directory
58 _topdir=$(call shellescape,$(shell pwd))
59
60 CONFIGURE_ARGS=         --prefix=/usr \
61                         --bindir=/bin \
62                         --infodir=${_topdir}/debian/gzip/usr/share/info \
63                         --mandir=${_topdir}/debian/gzip/usr/share/man \
64                         --disable-silent-rules
65
66 ifneq (${DEB_BUILD_ARCH},${DEB_HOST_ARCH})
67 CONFIGURE_ARGS+=        --host=${DEB_HOST_GNU_TYPE}
68 endif
69
70 reconf-stamp:
71         cp -f /usr/share/misc/config.sub build-aux/config.sub
72         cp -f /usr/share/misc/config.guess build-aux/config.guess
73         autoreconf -v
74         :>$@
75
76 configure: configure-stamp
77 configure-stamp: reconf-stamp
78         dh_testdir
79         mkdir -p builddir
80         cd builddir && env \
81             $(foreach i,CC CFLAGS CPPFLAGS LDFLAGS,$(call shellexport,$i)) \
82             CONFIG_SHELL=/bin/sh GREP=grep ../configure ${CONFIGURE_ARGS}
83         :>$@
84
85 configure-indep: configure-indep-stamp
86 configure-indep-stamp: reconf-stamp
87         dh_testdir
88         mkdir -p builddir-indep
89         cd builddir-indep && ../configure --host=i686-w64-mingw32 \
90                 LIBS="-Wl,--as-needed -lssp" --disable-silent-rules
91         :>$@
92
93 build: build-stamp build-indep-stamp
94
95 build-arch: build-stamp
96 build-stamp: configure-stamp
97         dh_testdir
98         ${MAKE} -C builddir
99 ifeq (,$(filter nocheck,${DEB_BUILD_OPTIONS}))
100 ifeq (${DEB_BUILD_ARCH},${DEB_HOST_ARCH})
101         ${MAKE} -C builddir check
102 endif
103 endif
104         :>$@
105
106 build-indep: build-indep-stamp
107 build-indep-stamp: configure-indep-stamp
108         dh_testdir
109         ${MAKE} -C builddir-indep
110         :>$@
111
112 clean:
113         dh_testdir
114         dh_testroot
115         -rm -f build-stamp build-indep-stamp configure-stamp configure-indep-stamp reconf-stamp
116         -rm -rf builddir builddir-indep
117         dh_clean
118
119 binary: binary-arch binary-indep
120
121 binary-indep: build-indep-stamp
122         dh_testdir
123         dh_testroot
124         dh_prep
125         dh_installdirs
126         i686-w64-mingw32-strip builddir-indep/gzip.exe
127         install -m 0755 builddir-indep/gzip.exe \
128             debian/gzip-win32/usr/share/win32/
129         dh_installdocs -i README* TODO NEWS
130         dh_installchangelogs -i ChangeLog
131         dh_lintian -i
132         dh_compress -i
133         dh_fixperms -i
134         dh_installdeb -i
135         dh_gencontrol -i
136         dh_md5sums -i
137         dh_builddeb -i
138
139 binary-arch: build-stamp
140         dh_testdir
141         dh_testroot
142         dh_prep
143         dh_installdirs
144         ${MAKE} -C builddir install \
145             prefix=${_topdir}/debian/gzip/usr \
146             bindir=${_topdir}/debian/gzip/bin
147         dh_testdir -a
148         dh_testroot -a
149         dh_installdocs -a README* TODO NEWS
150         dh_installman *.1
151         dh_installinfo -a doc/gzip.info
152         dh_installchangelogs -a ChangeLog
153         dh_link -a
154         dh_lintian -a
155         dh_strip -a
156         dh_compress -a
157         ln -s gunzip.1.gz debian/gzip/usr/share/man/man1/uncompress.1.gz
158         ln -s zgrep.1.gz debian/gzip/usr/share/man/man1/zegrep.1.gz
159         ln -s zgrep.1.gz debian/gzip/usr/share/man/man1/zfgrep.1.gz
160         rm -f ${_topdir}/debian/gzip/usr/share/info/dir.gz
161         dh_fixperms -a
162         dh_makeshlibs -a
163         dh_installdeb -a
164         dh_shlibdeps -a
165         dh_gencontrol -a
166         dh_md5sums -a
167         dh_builddeb -a
168
169 .PHONY: binary binary-arch binary-indep build build-arch build-indep clean
170 .PHONY: configure configure-indep