#!/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.

DEB_HOST_GNU_TYPE=$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE=$(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
CC=$(DEB_HOST_GNU_TYPE)-gcc
else
CC ?=gcc
endif

# debhelper
export DH_OPTIONS

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:
	dh_testdir
	dh_clean stamp-*
	-rm -rf stampdir

build:
build-arch-only:
build-all:
install:

binary-indep: DH_OPTIONS=-i
binary-indep: build install
	dh_testdir
	dh_testroot
	dh_install
	dh_installdebconf
	dh_installdirs
	dh_installdocs
	dh_installchangelogs
	dh_link
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_gencontrol -- -VF:XServer-Xorg-Detect-Depends=$(XSERVER_XORG_DETECT_DEPENDS)
	dh_md5sums
	dh_builddeb
	touch stamp-$@

binary: binary-indep

.PHONY: default
.PHONY: clean install
.PHONY: build build-all build-arch-only
.PHONY: binary binary-indep
.PHONY: environment

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