#!/usr/bin/make -f

PACKAGE = dlume

export DEB_BUILD_MAINT_OPTIONS	= hardening=+all
export DEB_CFLAGS_MAINT_APPEND	= -Wall -pedantic \
 -Wno-unused-but-set-variable \
 -Wno-overlength-strings
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

# Modified by the build process
KEEP_FILES = \
 Makefile.in \
 aclocal.m4 \
 config.guess \
 config.h.in \
 config.sub \
 configure \
 depcomp \
 install-sh \
 missing \
 mkinstalldirs \
 src/Makefile.in


override_dh_auto_configure:
	for f in $(KEEP_FILES); do cp -a $$f $$f.orig ; done
	cp -vf /usr/share/misc/config.sub .
	cp -vf /usr/share/misc/config.guess .
	cp -vf $(shell ls /usr/share/automake-*/mkinstalldirs | tail -n 1) .
	autoreconf -vfi
	dh_auto_configure

override_dh_auto_clean:
	# Restore original
	for f in $(KEEP_FILES); do [ ! -f $$f.orig ] || mv $$f.orig $$f; done
	# Delete build files
	rm -rf autom4te.cache
	rm -f Makefile */Makefile
	rm -f stamp* INSTALL
	rm -f po/POTFILES
	rm -f *.cache *.log *.status* config.h po/*.gmo *~
	rm -f src/$(PACKAGE) src/*.o
	rm -f po/Makefile.in

%:
	dh $@

# End of file
