#! /usr/bin/make -f

tmp	= $(shell pwd)/debian/elvis-tiny
ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
EXTRA_CFLAGS    = -g
endif

%:
	dh $@ --buildsystem=makefile

override_dh_auto_build:
	dh_auto_build -- -f Makefile.mix EXTRA_CFLAGS="$(EXTRA_CFLAGS)"

override_dh_auto_install:
	install -m 755 -d $(tmp)/usr/bin
	install -m 755 elvis $(tmp)/usr/bin/elvis-tiny

override_dh_auto_clean:
	make -f Makefile.mix clobber

override_dh_installchangelogs:
	dh_installchangelogs debian/changelog.upstream

# We used to strip as much as possible to save a few bytes (it made
# the vi wrapper fit in a 4K block on i386 - just) but it's probably
# a bad idea to mess with ELF comments and notes.
#override_dh_strip:
#	dh_strip
#ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
#	strip --remove-section=.comment --remove-section=.note $(tmp)/bin/vi
#	strip --remove-section=.comment --remove-section=.note $(tmp)/bin/elvis-tiny
#endif

override_dh_clean:
	dh_clean
	rm -f elvis

