#!/usr/bin/make -f DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) # Work around http://bugs.debian.org/572077 (debhelper < 7.4.16) binary: binary-arch binary-indep ; %: dh $@ --with autoreconf all_flavors = libnss-nonlocal libnss-nonlocal_configure_args += --prefix=/ libnss-nonlocal_dh_install = 'lib/*' ifneq ($(DEB_HOST_MULTIARCH),) export DH_COMPAT = 9 libnss-nonlocal_configure_args += --libdir='$${prefix}/lib/$(DEB_HOST_MULTIARCH)' libnss-nonlocal_dh_install = 'lib/$(DEB_HOST_MULTIARCH)/*' libnss-nonlocal_dh_gencontrol = -- -DMulti-Arch=same else ifeq ($(shell hash dpkg-buildflags 2>/dev/null && echo y),y) all_configure_args += $(foreach var,CFLAGS CPPFLAGS LDFLAGS,"$(var)=$$(dpkg-buildflags --get $(var))") endif IS_UBUNTU := $(if $(filter Ubuntu,$(shell lsb_release -is)),y) LIBC6_VERSION := $(shell dpkg-query --showformat='$${Version}' --show libc6) libc6_ge = $(shell dpkg --compare-versions '$(LIBC6_VERSION)' ge '$(1)' && echo y) all_flavors += lib32nss-nonlocal # i386_configure_target in eglibc/debian/sysdeps/amd64.mk ifeq ($(or $(IS_UBUNTU),$(call libc6_ge,2.8+20080809)),y) lib32nss-nonlocal_configure_args += --build=i686-linux else lib32nss-nonlocal_configure_args += --build=i486-linux endif # i386_CC in eglibc/debian/sysdeps/amd64.mk lib32nss-nonlocal_configure_args += CC='$(CC) -m32' # i386_slibdir in eglibc/debian/sysdeps/amd64.mk ifeq ($(or $(IS_UBUNTU),$(call libc6_ge,2.9-14~)),y) lib32nss-nonlocal_configure_args += --prefix=/ --libdir='$${prefix}/lib32' lib32nss-nonlocal_dh_install = 'lib32/*' else lib32nss-nonlocal_configure_args += --prefix=/emul/ia32-linux lib32nss-nonlocal_dh_install = 'emul/ia32-linux/*' endif all_flavors += lib64nss-nonlocal # amd64_configure_target in eglibc/debian/sysdeps/i386.mk lib64nss-nonlocal_configure_args += --build=x86_64-linux # amd64_CC in eglibc/debian/sysdeps/i386.mk lib64nss-nonlocal_configure_args += CC='$(CC) -m64 -D__x86_64__' # amd64_slibdir in eglibc/debian/sysdeps/i386.mk lib64nss-nonlocal_configure_args += --prefix=/ --libdir="\$${prefix}/lib64" flavors := $(filter $(all_flavors),$(shell dh_listpackages)) define do_overrides override_$(1): $(addsuffix _$(1),$(2)) $(addsuffix _$(1),$(filter-out REMAINING,$(2))): %_$(1): $(1) -p$$* $(3) REMAINING_$(1): $(addsuffix _$(1),$(filter-out REMAINING,$(2))) $(1) --remaining-packages $(4) endef $(eval $(foreach auto,configure build install test clean,$(call do_overrides,dh_auto_$(auto),$(flavors),-Bdebian/build_$$* -- $$(all_$(auto)_args) $$($$*_$(auto)_args)))) $(eval $(call do_overrides,dh_install,$(flavors) REMAINING,$$($$*_dh_install))) $(eval $(call do_overrides,dh_gencontrol,libnss-nonlocal REMAINING,$$($$*_dh_gencontrol)))