#!/usr/bin/make -f
# Sample debian/rules that uses debhelper. 
# GNU copyright 1997 by Joey Hess.
#
# This version is for a hypothetical package that builds an
# architecture-dependant package, as well as an architecturendependent
# package.

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

SHELL=/bin/bash

#DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
#ifneq (,$(filter $(DEB_HOST_ARCH),amd64 ia64))
#  export CC=gcc-3.4
#  export CXX=g++-3.4
#endif

build: build-stamp
build-stamp:
	dh_testdir
	$(MAKE) utils
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp
	-$(MAKE) clean
	-dh_clean
	rm -rf debian/cloop-?.?.?* debian/cloop debian/cloop-module debian/cloop-module-?.?.* debian/*.files knoppix

binary-indep: build install

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs -p cloop-utils usr/bin
	install -m 755 create_compressed_fs  $(CURDIR)/debian/cloop-utils/usr/bin/
#	install -m 755 advancecomp-1.9_create_compressed_fs/advfs  $(CURDIR)/debian/cloop-utils/usr/bin/
#	install -m 755 compressloop          $(CURDIR)/debian/cloop-utils/usr/bin/
	install -m 755 extract_compressed_fs $(CURDIR)/debian/cloop-utils/usr/bin/
	dh_installman -p cloop-utils $(CURDIR)/debian/create_compressed_fs.1
	cd $(CURDIR)/debian/cloop-utils/usr/share/man/man1 && ln -sf create_compressed_fs.1 extract_compressed_fs.1 && ln -sf create_compressed_fs.1 advfs.1
	cd debian/cloop-utils/usr/share/man/man1 && ln -s create_compressed_fs.1.gz extract_compressed_fs.1.gz

binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs 
	dh_installdocs
	dh_installexamples
	dh_install
	dh_installmenu
#	dh_installdebconf
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch

.PHONY: build clean binary-indep binary-arch binary kdist kdist_image kdist_configure kdist_clean kdist
.NOTPARALLEL:
