#!/usr/bin/make -f

export DH_VERBOSE=1

CXX=g++
CFLAGS = -Wall -g -O2


%:
	dh $@

override_dh_auto_clean:
	rm -rf build-stamp debian/c++-annotations
	./build clean
	dh_auto_clean

override_dh_auto_build:
	./build programs
	./build docs

override_dh_auto_install:
	dh_installchangelogs -A changelog
	dh_installdocs   -A README README.papersize README.PORTUGUESE README.legalese
	dh_installman
	cp -a  tmp/docs/latex/cplusplus.dvi     debian/c++-annotations-dvi/usr/share/doc/c++-annotations/
	cp -a  tmp/docs/latex/cplusplus.latex   debian/c++-annotations-latex/usr/share/doc/c++-annotations/
	cp -a  tmp/docs/latex/cplusplus.pdf     debian/c++-annotations-pdf/usr/share/doc/c++-annotations/
	cp -a  tmp/docs/latex/cplusplus.ps      debian/c++-annotations-ps/usr/share/doc/c++-annotations/
	cp -a  tmp/docs/latex/cplusplus.sty     debian/c++-annotations-latex/usr/share/doc/c++-annotations/
	cp -a  tmp/docs/latex/cplusplusus.dvi   debian/c++-annotations-dvi/usr/share/doc/c++-annotations/
	cp -a  tmp/docs/latex/cplusplusus.latex debian/c++-annotations-latex/usr/share/doc/c++-annotations/
	cp -a  tmp/docs/latex/cplusplusus.pdf   debian/c++-annotations-pdf/usr/share/doc/c++-annotations/
	cp -a  tmp/docs/latex/cplusplusus.ps    debian/c++-annotations-ps/usr/share/doc/c++-annotations/
	cp -a  tmp/docs/latex/cplusplusus.sty   debian/c++-annotations-latex/usr/share/doc/c++-annotations/
	cp -a  tmp/docs/txt/cplusplus.txt       debian/c++-annotations-txt/usr/share/doc/c++-annotations/
	cp -ra contrib                          debian/c++-annotations-contrib/usr/share/doc/c++-annotations/
	cp -ra contrib                          debian/c++-annotations-html/usr/share/doc/c++-annotations/html/
	cp -ra contributions                    debian/c++-annotations-contrib/usr/share/doc/c++-annotations/
	cp -ra tmp/docs/html                    debian/c++-annotations-html/usr/share/doc/c++-annotations/
	mkdir  debian/c++-annotations/usr/share/doc/c++-annotations/examples
	for e  in `find -type d -name examples | grep -v ^./debian`; \
	do cp  -r --parents   "$$e" debian/c++-annotations/usr/share/doc/c++-annotations/examples; done

override_dh_compress:
	dh_compress -A -X.html -X.gif -X.pdf
