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
30 ifeq (${DEB_HOST_ARCH},amd64)
31 EXTRA_CPPFLAGS+= -DUNALIGNED_OK
34 # Automatic dpkg-buildflags selection, backport-friendly
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
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}
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}
56 # whitespace-safe path to source directory
57 _topdir=$(call shellescape,$(shell pwd))
59 CONFIGURE_ARGS= --prefix=/usr \
61 --infodir=${_topdir}/debian/gzip/usr/share/info \
62 --mandir=${_topdir}/debian/gzip/usr/share/man
64 ifneq (${DEB_BUILD_ARCH},${DEB_HOST_ARCH})
65 CONFIGURE_ARGS+= --host=${DEB_HOST_GNU_TYPE}
69 cp -f /usr/share/misc/config.sub build-aux/config.sub
70 cp -f /usr/share/misc/config.guess build-aux/config.guess
74 configure: configure-stamp
75 configure-stamp: reconf-stamp
79 $(foreach i,CC CFLAGS CPPFLAGS LDFLAGS,$(call shellexport,$i)) \
80 CONFIG_SHELL=/bin/sh ../configure ${CONFIGURE_ARGS}
83 configure-indep: configure-indep-stamp
84 configure-indep-stamp: reconf-stamp
86 mkdir -p builddir-indep
87 cd builddir-indep && ../configure --host=i686-w64-mingw32
90 build: build-stamp build-indep-stamp
92 build-arch: build-stamp
93 build-stamp: configure-stamp
96 ifeq (,$(filter nocheck,${DEB_BUILD_OPTIONS}))
97 ifeq (${DEB_BUILD_ARCH},${DEB_HOST_ARCH})
98 ${MAKE} -C builddir check
103 build-indep: build-indep-stamp
104 build-indep-stamp: configure-indep-stamp
106 ${MAKE} -C builddir-indep
112 -rm -f build-stamp build-indep-stamp configure-stamp configure-indep-stamp reconf-stamp
113 -rm -rf builddir builddir-indep
116 binary: binary-arch binary-indep
118 binary-indep: build-indep-stamp
121 if test -x "$$(which dh_prep)"; then dh_prep; else dh_clean -k; fi
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
136 binary-arch: build-stamp
139 if test -x "$$(which dh_prep)"; then dh_prep; else dh_clean -k; fi
141 ${MAKE} -C builddir install \
142 prefix=${_topdir}/debian/gzip/usr \
143 bindir=${_topdir}/debian/gzip/bin
146 dh_installdocs -s README* TODO
148 dh_installinfo -s doc/gzip.info
149 dh_installchangelogs -s ChangeLog
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
166 .PHONY: binary binary-arch binary-indep build build-arch build-indep clean
167 .PHONY: configure configure-indep