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

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

CLC_SBIN	:= usr/sbin/
CLC_SRC 	:= usr/share/common-lisp/source/common-lisp-controller/
CLC_LIB		:= usr/lib/common-lisp-controller/

SBIN_PROGS 	:= register-common-lisp-source unregister-common-lisp-source \
		register-common-lisp-implementation \
		unregister-common-lisp-implementation 

BIN_PROGS	:= clc-register-user-package   \
		clc-unregister-user-package
CLC_SRC_FILES	:= common-lisp-controller.lisp post-sysdef-install.lisp

#CLC_UTILS	:= debug-daemon-problems.sh

MAN_FILES := man/register-common-lisp-implementation.8  \
 man/clc-register-user-package.1

configure: configure-stamp
configure-stamp:
	dh_testdir
# Add here commands to configure the package.	
	touch configure-stamp

build: configure-stamp build-stamp
build-stamp:
	dh_testdir
# Add here commands to compile the package.
	#-$(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) clean
	rm -f *~  || true
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	# fix the var directory
	chmod 1777 debian/common-lisp-controller/var/cache/common-lisp-controller
	# Add here commands to install the package into debian/pkg-name
	dh_install $(SBIN_PROGS) $(CLC_SBIN)
	dh_install $(BIN_PROGS) $(CLC_SBIN)
	dh_install $(CLC_SRC_FILES) $(CLC_SRC)
#	dh_install $(CLC_UTILS) $(CLC_LIB)

# Build architecture-dependent files here.
binary-arch: build install


# Build architecture-independent files here.
 binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs
	dh_installexamples
	dh_install
#	dh_installmenu
	dh_installdebconf	
#	dh_installlogrotate
#	dh_installemacsen
#	dh_installpam
#	dh_installmime
#	dh_installinit
	dh_installcron
#	dh_installinfo
#	dh_undocumented
	dh_installman $(MAN_FILES)
	dh_link
	dh_strip
	dh_compress
	dh_fixperms --exclude debian/common-lisp-controller/var/cache/common-lisp-controller
	dh_makeshlibs
	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
