#!/usr/bin/make -f

PACKAGE		= dos2unix
PKGDIR		= $(CURDIR)/debian/$(PACKAGE)
DOCROOTDIR	= $(PKGDIR)/usr/share/doc
PKGDOCDIR	= $(DOCROOTDIR)/$(PACKAGE)

export DEB_BUILD_MAINT_OPTIONS	= hardening=+all
export DEB_CFLAGS_MAINT_APPEND	= -Wall -pedantic
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

override_dh_auto_build:
	# save/restore original file as it is.
	cp -va po/dos2unix.pot po/dos2unix.pot.original
	$(MAKE) HTMLEXT=html \
		CFLAGS="$(CPPFLAGS) $(CFLAGS)" \
		LDFLAGS_USER="$(LDFLAGS)"
	mv -v po/dos2unix.pot.original po/dos2unix.pot

override_dh_auto_install:
	dh_auto_install

	# dos2unix-N.N/ => dos2unix/
	mv -v $(DOCROOTDIR)/$$(cd $(DOCROOTDIR) && ls) $(PKGDOCDIR)

	# Remove files that are not needed

	rm -vf $(PKGDOCDIR)/COPYING.txt \
	       $(PKGDOCDIR)/INSTALL.txt \
	       $(PKGDOCDIR)/ChangeLog.txt \

%:
	dh $@

# End of file
