#!/usr/bin/make -f

# do we have compilation of ocaml to native code?
OPT = $(shell test -x /usr/bin/ocamlopt && echo true)

%:
	dh $@ --with ocaml

override_dh_auto_configure:
	$(MAKE) depend

# dh_auto_clean calls "make clean", and our Makefile needs dql/.depend
override_dh_auto_clean:
	touch dql/.depend && dh_auto_clean

override_dh_auto_build:
	$(MAKE)
ifeq ($(OPT),true)
	make pkglab.opt
	cd distcheck && make distcheck.opt
else
	make pkglab
	cd distcheck && make distcheck
endif
	cd doc && make pkglab.html

override_dh_auto_install:
ifeq ($(OPT),true)
	cp pkglab.opt debian/pkglab/usr/bin/pkglab
	cp distcheck/distcheck.opt\
		debian/edos-distcheck/usr/lib/edos-distcheck/distcheck
else
	cp pkglab debian/pkglab/usr/bin
	cp distcheck/distcheck\
		debian/edos-distcheck/usr/lib/edos-distcheck/distcheck
endif

override_dh_strip:
ifeq ($(OPT),true)
	dh_strip
else	
	dh_strip -X usr/bin/pkglab
endif	

