#!/usr/bin/make -f

#export DH_VERBOSE=1

DEB_BUILD_ARCH		?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)

ifeq ($(DEB_BUILD_ARCH),alpha)
	CFLAGS += -O0
endif

COMMON_INSTALL_OPTS= \
	BINDIR=\$${prefix}/games \
	LIBDIR=\$${prefix}/lib/games/gnushogi \
	MANDIR=\$${prefix}/share/man/man6 \
	INFODIR=\$${prefix}/share/info

%:
	dh ${@}

override_dh_auto_configure:
	dh_auto_configure -BBUILD-std  -- --with-curses
	dh_auto_configure -BBUILD-mini -- --with-curses --enable-minishogi

override_dh_auto_build:
	dh_auto_build -BBUILD-std $(COMMON_INSTALL_OPTS)
	dh_auto_build -BBUILD-mini $(COMMON_INSTALL_OPTS)
	dh_auto_build -BBUILD-std -- -C doc info html

override_dh_auto_install:
	dh_auto_install -BBUILD-std -- $(COMMON_INSTALL_OPTS) prefix=$(CURDIR)/debian/gnushogi/usr
	install -D -m755 BUILD-mini/gnushogi/gnuminishogi \
		debian/gnuminishogi/usr/games/gnuminishogi

override_dh_auto_clean:
	dh_auto_clean -BBUILD-std
	dh_auto_clean -BBUILD-mini
	rm -f gnushogi/pattern.inc
