#!/usr/bin/make -f

CC = gcc

export DEB_BUILD_OPTIONS	= noopt

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

# cat the makefile to verify what flags are being used
override_dh_auto_build:
	echo "#RUN imake"
	xmkmf
	echo '##BEGIN Makefile'
	cat Makefile
	echo '##END Makefile'
	$(MAKE) CC="$(CC)" \
		CCLINK="$(CC)" \
		CDEBUGFLAGS="$(CFLAGS) $(CPPFLAGS) $(LDFLAGS)" \
		XONIXDIR=/var/cache/xonix

override_dh_install:
	dh_install
	# Remove unused directories
	rm -rf debian/xonix/usr/lib debian/xonix/usr/bin

%:
	dh $@

# End of file
