#!/usr/bin/make -f
# Made with the aid of dh_make, by Craig Small
# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
# Some lines taken from debmake, by Cristoph Lameter.

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

pkg		:= cl-local-time
db-pkg		:= cl-local-time-db

prefix		:= debian/tmp
db-prefix	:= debian/$(db-pkg)

# where the sources go
clcdir		:= usr/share/common-lisp/repositories
src-dest	:= $(prefix)/$(clcdir)/local-time
db-src-dest	:= $(db-prefix)/$(clcdir)/local-time-db

# cl-local-time sources...
SRCS		:= $(shell find . -type f -name '*.lisp' -o -name '*.system' | grep -v ^./debian)
# ... a few of which are going to get moved to cl-local-time-db pkg
DB-SRCS		:= local-time-db.system database-funcs.lisp

# tools
INSTALL		:= install
INSTALLFLAGS	:= -g root -o root -m 0644
INSTALLDIRFLAGS	:= -d -g root -o root -m 0755


build:
	dh_testdir
	touch build

clean:
	dh_testdir
	rm -f build
	-$(MAKE) clean
	dh_clean

# Build architecture-independent files here.
binary-indep: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs -i
	$(INSTALL) $(INSTALLDIRFLAGS) $(src-dest) $(db-src-dest)

# 	this presumes that sources aren't in subdirs
	$(INSTALL) $(INSTALLFLAGS) $(SRCS) $(src-dest)

	dh_installdirs -p$(db-pkg)

	set -e; for file in $(DB-SRCS); do \
	    mv $(src-dest)/$$file $(db-src-dest)/; \
	done

#	 we have to futz with the source-pathname
	sed -e 's/:local-time;/:local-time-db;/' local-time-db.system > \
		$(db-src-dest)/local-time-db.system

	dh_installdocs -i
	dh_installexamples -i
#	dh_installmenu -i
#	dh_installcron -i
#	dh_installmanpages -i
#	dh_undocumented -i
	dh_installchangelogs -i
	dh_link -i	# odcl required links
	dh_strip -i
	dh_compress -i
	dh_fixperms -i
	dh_installdeb -i
	dh_shlibdeps -i
	dh_gencontrol -i
	dh_makeshlibs -i
	dh_md5sums -i
	dh_builddeb -i


# Build architecture-dependent files here.
binary-arch: build
# We have nothing to do by default.

source diff:                                                                  
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

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