#!/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
export DH_OPTIONS

#
# Hardening
#
export DEB_BUILD_HARDENING=1

include /usr/share/dpkg/buildflags.mk
CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)
CFLAGS:=$(shell dpkg-buildflags --get CFLAGS) $(CPPFLAGS)
CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS) $(CPPFLAGS)
LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)



CWD=$(shell pwd)

%:
	dh $@ 


override_dh_clean:
	rm -f $(CWD)/libcult/build/system/configuration-dynamic.make
	rmdir --ignore-fail-on-non-empty $(CWD)/libcult/build/system
	dh_clean

override_dh_auto_install:
	MAKEFLAGS="$$MAKEFLAGS install_prefix=$(CWD)/debian/xsdcxx/usr" $(MAKE) -C $(CWD)/ -f makefile install
	mv $(CWD)/debian/xsdcxx/usr/share/doc/xsd $(CWD)/debian/xsdcxx/usr/share/doc/xsdcxx
	mv $(CWD)/debian/xsdcxx/usr/bin/xsd $(CWD)/debian/xsdcxx/usr/bin/xsdcxx
	mv $(CWD)/debian/xsdcxx/usr/share/man/man1/xsd.1 $(CWD)/debian/xsdcxx/usr/share/man/man1/xsdcxx.1
	rm -rf $(CWD)/debian/xsdcxx/usr/share/doc/libxsd
	find $(CWD)/debian/xsdcxx \( -name "COPYRIGHT*" -o -name "FLOSSE*" -o -name "LICENSE*" -o -name "GPL*" \) -exec rm -v {} \;
