#!/usr/bin/make -f

CXXFLAGS += -std=gnu++0x

include debian/debian-save-restore.mk

# Included in original sources; dh(1) would delete these.
# autoreconf(1) changes also few files
FILE_LIST_PRESERVE = \
 src/MD5Info/MD5Hash/GCrypt/GCrypt.cc~ \
 src/MD5Info/MD5Hash/GCrypt/GCrypt.hh~ \
 src/ccbuild.cc~

override_dh_auto_clean:
	$(file-state-save)
	dh_auto_clean
	# Due to autoreconf(1)
	rm -f	INSTALL Makefile.in aclocal.m4 config.* configure \
		src/SourceScanner/yylex.cc

override_dh_auto_configure:
	# See patch 20. We have to regenerate ./configure
	cp -vf /usr/share/misc/config.sub .
	cp -vf /usr/share/misc/config.guess .
	autoreconf -vfi
	dh_auto_configure

override_dh_auto_build:
	# For some reason, the only way to pass flags is in CXX
	@echo "# environment: CXX $(CXX) CFLAGS $(CFLAGS) CXXFLAGS $(CXXFLAGS)"
	$(MAKE) CXX="g++ $(CXXFLAGS)" DESTDIR=$(CURDIR)/debian/ccbuild install

override_dh_installchangelogs:
	$(file-state-restore)
	dh_installchangelogs ChangeLog

%:
	dh  $@

# End of file
