#!/usr/bin/make -f
# This is part of the lw-installer program: 
#    http://b9.com/lw-installer.html
#
# Copyright (c) 2002 Kevin M. Rosenberg <kmr@debian.org>
#
# lw-installer is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License (version 2) as
# published by the Free Software Foundation.
#
# lw-installer is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have a copy of the GNU General Public License on your
# Debian system in the file /usr/share/common-licenses/GPL-2

ARCH=$(shell dpkg-architecture -qDEB_BUILD_ARCH)

pro-files := make-images.lisp make-images.sh install-clc.lisp \
		dl-and-install-patches.sh 

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.
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f 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 package into debian/$(pkg)
	dh_installdirs usr/lib/lispworks43
	dh_install $(pro-files) usr/lib/lispworks43
	dh_install lispworks.sh usr/lib/common-lisp/bin

# 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_testversion
	dh_testdir
	dh_testroot
	dh_installdebconf
	dh_installdocs
	dh_installexamples
	dh_installmenu
#	dh_installemacsen
#	dh_installpam
#	dh_installinit
	dh_installcron
	dh_installmanpages debian/lw-gui.1 debian/lw-console.1 debian/lispworks.1
	dh_installinfo
	dh_installchangelogs 
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	# You may want to make some executables suid here.
#	dh_suidregister
#	dh_makeshlibs
	dh_installdeb
#	dh_perl
	dh_shlibdeps
ifeq ($(ARCH),amd64)
	dh_gencontrol -- -VEXTRADEPENDS=,ia32-libs
else
	dh_gencontrol
endif
	dh_md5sums
	dh_builddeb

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