#!/usr/bin/make -f
# Debian rules file for xfree86 source package
# Originally by Stephen Early <sde1000@debian.org>
# Modified by Mark W. Eichin <eichin@kitten.gen.ma.us>
# Modified by Adam Heath <doogie@debian.org>
# Modified by Branden Robinson <branden@debian.org>
# Modified by Fabio Massimo Di Nitto <fabbione@fabbione.net>
# Modified by Daniel Stone <daniel.stone@ubuntu.com>
# Modified by David Nusinow <dnusinow@debian.org>
# Copyright 1996--2005 Software in the Public Interest, 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>.
# Acknowledgements to Stephen Early, Mark Eichin, and Manoj Srivastava.

# debhelper
export DH_OPTIONS

# latest ABI is 7.0 final
SERVERABIBUMP = 7.0.0

include debian/xsfbs/xsfbs.mk

# Get package version info.
SOURCE_VERSION:=$(shell dpkg-parsechangelog -ldebian/changelog | grep '^Version:' | awk '{print $$2}')

# The DEB_HOST_ARCH variable may be set per the Debian cross-compilation policy.
ifdef DEB_HOST_ARCH
 ARCH:=$(DEB_HOST_ARCH)
else
 # dpkg-cross sets the ARCH environment variable; if set, use it.
 ifndef ARCH
  ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
 endif
endif

# Read in important variables.
#include debian/scripts/vars
# Read in architecture-specific variables of importance.
include debian/scripts/vars.$(ARCH)

clean: cleanscripts
	dh_testdir
	dh_clean stamp-* debian/local/X debian/po/pothead


SCRIPTS=$(shell ls debian/*.config.in debian/*.postinst.in debian/*.postrm.in debian/*.preinst.in debian/*.prerm.in)

scripts: stamp-scripts
stamp-scripts: genscripts validatescripts
	touch $@

validatescripts: genscripts stamp-validatescripts
stamp-validatescripts: debian/local/dexconf
	sh debian/scripts/validate-posix-sh $<
	touch $@

build: stamp-build
stamp-build: stamp-scripts
	dh_testdir
	touch $@

build-arch-only: build
build-all:

install: stamp-install
stamp-install: stamp-build
	dh_testdir
	dh_testroot
	umask 022
	dh_clean -k
	touch $@

binary-indep: DH_OPTIONS=-i
binary-indep: build install

binary-arch: DH_OPTIONS=-s
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_install
	dh_installdebconf
	dh_installdirs
	dh_installdocs
	dh_installinit -px11-common -u'start 70 S .'
	dh_installchangelogs
	dh_link
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb
	touch stamp-$@
	touch stamp-$@

binary: binary-arch

.PHONY: default
.PHONY: genscripts cleanscripts scripts validatescripts
.PHONY: updatepo
.PHONY: clean configure install
.PHONY: build build-arch-only build-all
.PHONY: binary binary-arch binary-indep
.PHONY: environment

# vim:set noet ai sts=8 sw=8 tw=0:
