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

# From dpkg-dev
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

override_dh_auto_build:
	$(MAKE) LDFLAGS_USER="$(LDFLAGS)" CFLAGS_USER="$(CPPFLAGS) $(CFLAGS)"

override_dh_clean:
	dh_clean
	rm -f man/es/man1/dos2unix.1

override_dh_auto_install:
	dh_auto_install

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

	# Remove files that are not needed. The PS and PDF are
	# copies of manual pages.

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

%:
	dh $@

# End of file
