#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

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


############# Start arch specific targets

DEB_BUILD_ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)

TARGET := phalanx

ifneq (,$(findstring i386,$(DEB_BUILD_ARCH)))
TARGET := optimized
endif

ifneq (,$(findstring amd64,$(DEB_BUILD_ARCH)))
TARGET := optimized
endif

ifneq (,$(findstring kfreebsd-i386,$(DEB_BUILD_ARCH)))
TARGET := optimized
endif

ifneq (,$(findstring kfreebsd-amd64,$(DEB_BUILD_ARCH)))
TARGET := optimized
endif

ifneq (,$(findstring hurd-i386,$(DEB_BUILD_ARCH)))
TARGET := optimized
endif
############# End arch specific targets


%:
	dh $@


override_dh_auto_build:
	$(MAKE) $(TARGET)


override_dh_auto_install:
	dh_auto_install
#	chgrp games $(DEB_DESTDIR)/usr/games/phalanx
#	chmod g+s $(DEB_DESTDIR)/usr/games/phalanx

override_dh_fixperms:
	dh_fixperms
	chgrp games $(CURDIR)/debian/phalanx/usr/games/phalanx
	chmod 2755 $(CURDIR)/debian/phalanx/usr/games/phalanx	
