#!/usr/bin/make -f # -*- makefile -*- # Sample debian/rules that uses debhelper. # This file was originally written by Joey Hess and Craig Small. # As a special exception, when this file is copied by dh-make into a # dh-make output file, you may use that output file without restriction. # This special exception was added by Craig Small in version 0.37 of dh-make. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # These are used for cross-compiling and for saving the configure script # from having to guess our platform (since we know it already) DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_GNU_OS) DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) CFLAGS = `dpkg-buildflags --get CFLAGS` `dpkg-buildflags --get CPPFLAGS` -Wall -D_REENTRANT LDFLAGS = `dpkg-buildflags --get LDFLAGS` # binutils doesn't supply the prefixed version normally like GCC does so # we can't just unconditionally use DEB_HOST_GNU_TYPE-ar ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) AR=ar else AR=$(DEB_HOST_GNU_TYPE)-ar endif ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 else CFLAGS += -O3 endif ifeq (,$(filter stage1,$(DEB_BUILD_PROFILES))) 32-ARCHS=amd64 ppc64 kfreebsd-amd64 s390x 64-ARCHS=s390 sparc i386 powerpc mips mipsel ifneq (,$(findstring $(DEB_HOST_ARCH), $(32-ARCHS))) EXTRA_INSTALL=install32 EXTRA_BUILD=build32-stamp # s390x fails at compatibility. ifneq (,$(findstring $(DEB_HOST_ARCH), s390x)) m32=-m31 else m32=-m32 endif endif ifneq (,$(findstring s390x, $(DEB_HOST_ARCH))) else ifneq (,$(findstring $(DEB_HOST_ARCH), $(64-ARCHS))) EXTRA_INSTALL=install64 EXTRA_BUILD=build64-stamp # MIPS doesn't use -m64 ifneq (,$(findstring $(DEB_HOST_ARCH), mips mipsel)) m64=-mabi=64 else m64=-m64 endif endif endif N32-ARCHS=mips mipsel ifneq (,$(findstring $(DEB_HOST_ARCH), $(N32-ARCHS))) EXTRA_INSTALL+=installn32 EXTRA_BUILD+=buildn32-stamp mn32=-mabi=n32 endif endif # !stage1 UNALIGNED_ARCHS=i386 amd64 kfreebsd-i386 kfreebsd-amd64 hurd-i386 lpia ifneq (,$(findstring $(DEB_HOST_ARCH), $(UNALIGNED_ARCHS))) CFLAGS+=-DUNALIGNED_OK endif COPYLIST=*.h *.c *.in zlib.map configure zlib.3 test configure-stamp: configure dh_testdir if [ ! -f Makefile.stash ]; then cp Makefile Makefile.stash ; fi AR=$(AR) CC="$(DEB_HOST_GNU_TYPE)-gcc" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" uname=GNU ./configure --shared --prefix=/usr --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) touch $@ configure64-stamp: configure dh_testdir mkdir -p debian/64 cp -r $(COPYLIST) debian/64 cd debian/64 && AR=$(AR) CC="$(DEB_HOST_GNU_TYPE)-gcc $(m64)" \ CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \ uname=GNU ./configure --shared --prefix=/usr --libdir=\$${prefix}/usr/lib64 touch $@ configure32-stamp: configure dh_testdir mkdir -p debian/32 cp -r $(COPYLIST) debian/32 cd debian/32 && AR=$(AR) CC="$(DEB_HOST_GNU_TYPE)-gcc $(m32)" \ CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \ uname=GNU ./configure --shared --prefix=/usr --libdir=\$${prefix}/usr/lib32 touch $@ configuren32-stamp: configure dh_testdir mkdir -p debian/n32 cp -r $(COPYLIST) debian/n32 cd debian/n32 && AR=$(AR) CC="$(DEB_HOST_GNU_TYPE)-gcc $(mn32)" \ CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \ uname=GNU ./configure --shared --prefix=/usr --libdir=\$${prefix}/usr/lib32 touch $@ build: build-stamp $(EXTRA_BUILD) build-stamp: configure-stamp dh_testdir $(MAKE) -$(MAKE) test touch $@ build64-stamp: configure64-stamp dh_testdir make -C debian/64 touch $@ build32-stamp: configure32-stamp dh_testdir make -C debian/32 touch $@ buildn32-stamp: configuren32-stamp dh_testdir make -C debian/n32 touch $@ clean: dh_testdir dh_testroot $(MAKE) distclean rm -f build-stamp configure-stamp foo.gz rm -rf debian/64 build64-stamp configure64-stamp rm -rf debian/32 build32-stamp configure32-stamp rm -rf debian/n32 buildn32-stamp configuren32-stamp -mv Makefile.stash Makefile -mv zlibdefs.h.stash zlibdefs.h dh_clean install: build dh_testdir dh_testroot dh_prep dh_installdirs $(MAKE) prefix=$(CURDIR)/debian/tmp/usr install install -d debian/tmp/lib/$(DEB_HOST_MULTIARCH) mv debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libz.so.* debian/tmp/lib/$(DEB_HOST_MULTIARCH) ln -sf /lib/$(DEB_HOST_MULTIARCH)/$$(readlink debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libz.so) debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libz.so install64: install build64-stamp $(MAKE) -C debian/64 prefix=$(CURDIR)/debian/tmp install install32: install build32-stamp $(MAKE) -C debian/32 prefix=$(CURDIR)/debian/tmp install installn32: install buildn32-stamp $(MAKE) -C debian/n32 prefix=$(CURDIR)/debian/tmp install # Build architecture-independent files here. binary-indep: build install # We have nothing to do by default. # Build architecture-dependent files here. binary-arch: build install $(EXTRA_INSTALL) dh_testdir dh_testroot dh_installchangelogs -s ChangeLog dh_installdocs -s dh_installexamples -s dh_install -s --sourcedir=debian/tmp dh_installman -s dh_lintian -s dh_link -s dh_strip -s --dbg-package=zlib1g-dbg dh_compress -s dh_fixperms -s dh_makeshlibs -pzlib1g -V"zlib1g (>= 1:1.2.3.3.dfsg-1)" --add-udeb=zlib1g-udeb ifeq (,$(filter stage1,$(DEB_BUILD_PROFILES))) ifneq (,$(findstring $(DEB_HOST_ARCH), $(32-ARCHS))) dh_makeshlibs -plib32z1 -V"lib32z1 (>= 1:1.2.3.3.dfsg-1)" endif ifneq (,$(findstring $(DEB_HOST_ARCH), $(64-ARCHS))) dh_makeshlibs -plib64z1 -V"lib64z1 (>= 1:1.2.3.3.dfsg-1)" endif ifneq (,$(findstring $(DEB_HOST_ARCH), $(N32-ARCHS))) dh_makeshlibs -plibn32z1 -V"libn32z1 (>= 1:1.2.3.3.dfsg-1)" endif endif dh_installdeb -s dh_shlibdeps -s dh_gencontrol -s dh_md5sums -s dh_builddeb -s binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install install64 install32