#!/usr/bin/make -f
# -*- makefile-gmake -*-
#export DH_VERBOSE=1
#export DH_OPTIONS=
export GZIP=-9

less_optimization_for_vm_compilation := no

# DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
# ifeq ($(DEB_HOST_ARCH),ia64)
#   less_optimization_for_vm_compilation := yes
# endif

%:
	dh --with quilt  $@

override_dh_auto_clean:
	dh_auto_clean
	rm -f configure config.sub config.guess
	rm -f lib/gauche/config.scm
#	rm -f gc/configure gc/Makefile.in

override_dh_auto_configure:
	ln -sf /usr/share/misc/config.sub .
	ln -sf /usr/share/misc/config.guess .
	autoconf
#	(cd gc; autoconf; automake)
	dh_auto_configure -- --enable-multibyte=utf-8 --enable-ipv6 --enable-threads=pthreads --with-slib=/usr/share/slib

override_dh_auto_build:
ifeq ($(less_optimization_for_vm_compilation),yes)
	(cd src; make CFLAGS="-g -O1 -fPIC" vm.o)
endif
	dh_auto_build

override_dh_auto_install:
	make DESTDIR=$(CURDIR)/debian/tmp slibcat-in-place install-pkg install-doc
	chmod +x $(CURDIR)/debian/tmp/usr/share/gauche/0.9/template.DIST
