#!/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 has to be exported to make some magic below work.
export DH_OPTIONS

# 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)


# DBS stuff


TAR_DIR = sleuthkit-1.68
# the dbs rules
include /usr/share/dbs/dbs-build.mk
# convenient way to set architecture specification strings
# the ifeq condition is here to allow them to be overridden
# from the command line
ifeq (,$(DEB_BUILD_GNU_TYPE))
   include /usr/share/dbs/dpkg-arch.mk
endif



CFLAGS = -Wall -g

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
else
	CFLAGS += -O2
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	INSTALL_PROGRAM += -s
endif

configure: configure-stamp
configure-stamp: $(patched)
	dh_testdir
# Add here commands to configure the package.

	touch configure-stamp


build: build-stamp $(patched)

build-stamp: configure-stamp 

	dh_testdir
# Add here commands to compile the arch part of the package.
	cd $(BUILD_TREE) && $(MAKE)

	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -rf $(SOURCE_DIR) $(STAMP_DIR) build-stamp configure-stamp

# Add here commands to clean up after the build process.
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k 
	dh_installdirs 

# Add here commands to install the arch part of the package into 
# debian/tmp.
	dh_install --sourcedir=$(BUILD_TREE)

binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs $(BUILD_TREE)/CHANGES
	dh_installdocs $(BUILD_TREE)/README $(BUILD_TREE)/TODO $(BUILD_TREE)/tct.docs/* $(BUILD_TREE)/docs/*
	dh_installexamples
	dh_install
	dh_installmenu
#	dh_installdebconf	
#	dh_installlogrotate	
#	dh_installemacsen
#	dh_installpam
#	dh_installmime
#	dh_installinit
#	dh_installcron
#	dh_installinfo
	dh_installman $(BUILD_TREE)/man/man1/*
	dh_link
	dh_strip
	dh_compress 
	dh_fixperms
#	dh_perl
#	dh_python
#	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps	
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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