#! /usr/bin/make -f

export V := true

%:
	dh $@

DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)

ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
CROSS :=
else
CROSS := CROSS=$(DEB_HOST_GNU_TYPE)-
endif

override_dh_auto_build:
	$(MAKE) $(CROSS) STRIPCMD=true

override_dh_auto_install:
	dh_auto_install --destdir=debian/pcmciautils -- \
		pcmciaconfdir=/usr/lib/pcmciautils

override_dh_install:
	dh_install --sourcedir=debian/pcmciautils

# You only need to run this immediately after checking out the package from
# revision control.
quilt-setup:
	[ ! -d .pc ]
	set -e; for patch in $$(quilt series | tac); do \
		patch -p1 -R --no-backup-if-mismatch <"debian/patches/$$patch"; \
	done
	quilt push -a

.PHONY: quilt-setup
