NetBSD-5.0.2/external/gpl2/libdevmapper/dist/debian/rules

#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# This is the debhelper compatibility version to use.
export DH_COMPAT=3

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE	?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE	?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)


ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -g
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	INSTALL_PROGRAM += -s
endif

# shared library versions, option 1
version=2.0.5
major=2
# option 2, assuming the library is created as src/.libs/libfoo.so.2.0.5 or so
#version=`ls src/.libs/lib*.so.* | \
# awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+$$/)) print substr($$0,RSTART)}'`
#major=`ls src/.libs/lib*.so.* | \
# awk '{if (match($$0,/\.so\.[0-9]+$$/)) print substr($$0,RSTART+4)}'`

# Note: header-update isn't part of the build system; it's run manually.
KERNEL=/usr/src/kernel-source-2.4.19.tar.bz2
PATCH=./patches/linux-2.4.19-devmapper-ioctl.patch
header-update:
	@test -f $(KERNEL) || { \
		echo "Error: $(KERNEL) doesn't exist!" 1>&2 && \
		exit 1; \
	}
	@test -f $(PATCH) || { \
		echo "Error: $(PATCH) doesn't exist!" 1>&2 && \
		exit 1; \
	}

	chmod +x ./debian/scripts/*
	if test `echo $(PATCH) | grep 'gz$$'`; then \
		zcat $(PATCH) > debian/patch.diff; \
	elif test `echo $(PATCH) | grep 'bz2$$'`; then \
		bzcat $(PATCH) > debian/patch.diff; \
	else \
		cp $(PATCH) debian/patch.diff; \
	fi
	tar jxvf $(KERNEL) -C debian
	rm -rf debian/include/*

	cd debian && ./scripts/strippatch.pl ./patch.diff | \
			./scripts/includes.pl ./kernel-source-* | patch -p1
	rm -rf debian/kernel-source-* debian/patch.diff

configure: configure-stamp
configure-stamp:
	dh_testdir

	# Add here commands to configure the package.
	./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
			--prefix=/usr --mandir=\$${prefix}/share/man \
			--infodir=\$${prefix}/share/info \
			--libdir=$(CURDIR)/debian/tmp/lib \
			--with-kernel-dir=$(CURDIR)/debian \
			--with-kernel-version=$(KERNEL)
	touch configure-stamp

build: build-stamp
build-stamp: configure-stamp 
	dh_testdir

	# Build
	$(MAKE)

	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp

	# Add here commands to clean up after the build process.
	-$(MAKE) distclean
	-test -r /usr/share/misc/config.sub && \
	  cp -f /usr/share/misc/config.sub config.sub
	-test -r /usr/share/misc/config.guess && \
	  cp -f /usr/share/misc/config.guess config.guess


	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	# Add here commands to install the package into debian/tmp
	$(MAKE) install prefix=$(CURDIR)/debian/tmp/usr

	# libdevmapper-dev should have its .so in /usr/lib.
	rm -f $(CURDIR)/debian/tmp/lib/libdevmapper.so
	install -d $(CURDIR)/debian/tmp/usr/lib
	ln -s /lib/libdevmapper.so.0.96 \
			$(CURDIR)/debian/tmp/usr/lib/libdevmapper.so
	ln -s libdevmapper.so.0.96 $(CURDIR)/debian/tmp/lib/libdevmapper.so.0

# 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
	dh_testdir
	dh_testroot
	dh_movefiles

#	dh_installdebconf	
	dh_installdocs
	dh_installexamples
	dh_installmenu
#	dh_installlogrotate
#	dh_installemacsen
#	dh_installpam
#	dh_installmime
#	dh_installinit
	dh_installcron
	dh_installman
	dh_installinfo
#	dh_undocumented
	dh_installchangelogs 
	dh_installkpatches
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_makeshlibs -V
	dh_installdeb
#	dh_perl
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure