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
7 # Comment this to turn off debhelper verbose mode.
10 shellescape='$(subst ','\'',$(1))'
11 shellexport=$(1)=$(call shellescape,${$(1)})
13 include /usr/share/dpkg/architecture.mk
15 # Automatic ${CC} selection for cross-compiles
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
27 export DEFS=NO_ASM # Avoid TEXTRELs on i386
31 ifeq (${DEB_HOST_ARCH},amd64)
32 EXTRA_CPPFLAGS+= -DUNALIGNED_OK
35 # Automatic dpkg-buildflags selection, backport-friendly
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
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}
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}
57 # whitespace-safe path to source directory
58 _topdir=$(call shellescape,$(shell pwd))
60 CONFIGURE_ARGS= --prefix=/usr \
62 --infodir=${_topdir}/debian/gzip/usr/share/info \
63 --mandir=${_topdir}/debian/gzip/usr/share/man
65 ifneq (${DEB_BUILD_ARCH},${DEB_HOST_ARCH})
66 CONFIGURE_ARGS+= --host=${DEB_HOST_GNU_TYPE}
70 cp -f /usr/share/misc/config.sub build-aux/config.sub
71 cp -f /usr/share/misc/config.guess build-aux/config.guess
75 configure: configure-stamp
76 configure-stamp: reconf-stamp
80 $(foreach i,CC CFLAGS CPPFLAGS LDFLAGS,$(call shellexport,$i)) \
81 CONFIG_SHELL=/bin/sh GREP=grep ../configure ${CONFIGURE_ARGS}
84 configure-indep: configure-indep-stamp
85 configure-indep-stamp: reconf-stamp
87 mkdir -p builddir-indep
88 cd builddir-indep && ../configure --host=i686-w64-mingw32
91 build: build-stamp build-indep-stamp
93 build-arch: build-stamp
94 build-stamp: configure-stamp
97 ifeq (,$(filter nocheck,${DEB_BUILD_OPTIONS}))
98 ifeq (${DEB_BUILD_ARCH},${DEB_HOST_ARCH})
99 ${MAKE} -C builddir check
104 build-indep: build-indep-stamp
105 build-indep-stamp: configure-indep-stamp
107 ${MAKE} -C builddir-indep
113 -rm -f build-stamp build-indep-stamp configure-stamp configure-indep-stamp reconf-stamp
114 -rm -rf builddir builddir-indep
117 binary: binary-arch binary-indep
119 binary-indep: build-indep-stamp
124 i686-w64-mingw32-strip builddir-indep/gzip.exe
125 install -m 0755 builddir-indep/gzip.exe \
126 debian/gzip-win32/usr/share/win32/
127 dh_installdocs -i README* TODO
128 dh_installchangelogs -i ChangeLog
137 binary-arch: build-stamp
142 ${MAKE} -C builddir install \
143 prefix=${_topdir}/debian/gzip/usr \
144 bindir=${_topdir}/debian/gzip/bin
147 dh_installdocs -a README* TODO
149 dh_installinfo -a doc/gzip.info
150 dh_installchangelogs -a ChangeLog
155 ln -s gunzip.1.gz debian/gzip/usr/share/man/man1/uncompress.1.gz
156 ln -s zgrep.1.gz debian/gzip/usr/share/man/man1/zegrep.1.gz
157 ln -s zgrep.1.gz debian/gzip/usr/share/man/man1/zfgrep.1.gz
158 rm -f ${_topdir}/debian/gzip/usr/share/info/dir.gz
167 .PHONY: binary binary-arch binary-indep build build-arch build-indep clean
168 .PHONY: configure configure-indep