#!/usr/bin/make -f
# Debian package build rules file for pgi
# Copyright 1997-1999 Joey Hess.
# Copyright 2001 Software in the Public Interest, Inc.
# Copyright 2002 Progeny Linux Systems, Inc.
# Licensed under the GNU General Public License, version 2.  See the file
# /usr/share/common-licenses/GPL or <http://www.gnu.org/copyleft/gpl.txt>.

# $Progeny: rules,v 1.12 2002/04/19 16:29:20 branden Exp $

BUILD_ARCH:=$(shell dpkg --print-architecture)
ifdef DEB_HOST_ARCH
 ARCH:=$(DEB_HOST_ARCH)
else
 # dpkg-cross sets the ARCH environment variable, so use it.
 ifdef ARCH
  ARCH:=$(ARCH)
 else
  ARCH:=$(BUILD_ARCH)
 endif
endif

I386_DEPS="syslinux (>= 1.63-1), read-edid"
IA64_DEPS="elilo, efibootmgr"
POWERPC_DEPS="yaboot, powerpc-utils"

# *sigh* Make has nothing approaching switch/case, not even elif
ifeq ($(ARCH),i386)
  ARCH_DEPS=$(I386_DEPS)
endif

ifeq ($(ARCH),ia64)
 ARCH_DEPS=$(IA64_DEPS)
endif

ifeq ($(ARCH),powerpc)
  ARCH_DEPS=$(POWERPC_DEPS)
endif

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

# This is the debhelper compatability version to use.
export DH_COMPAT=2

build: build-stamp
build-stamp:
	dh_testdir
#	nothing to do
	touch build-stamp

clean: Makefile
	dh_testdir
	dh_testroot
	rm -f build-stamp

#	nothing to do

	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	$(MAKE) DESTDIR=$(CURDIR)/debian/pgi install-pgi

binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installdocs
	dh_installman
	dh_installmenu
	dh_installchangelogs
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol -- -VF:Arch-Depends=$(ARCH_DEPS)
	dh_md5sums
	dh_builddeb

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