#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

NO_DISTRIB:=LICENSE.txt
NO_DISTRIB_FIND_EXPR:=$(patsubst %,-not -name '%',$(NO_DISTRIB))
PKG_NAME:=asterisk-prompt-fr-armelle
LNG:=fr

%:
	dh $@

override_dh_auto_install:
	cp -R $(LNG) debian/$(PKG_NAME)/usr/share/asterisk/sounds/
	set -e; find . -mindepth 1 -maxdepth 1 -type d -not -name debian -not -name .pc $(NO_DISTRIB_FIND_EXPR) -not -name $(LNG) | while read d; do cp -R $${d}/$(LNG) debian/$(PKG_NAME)/usr/share/asterisk/sounds/$(LNG)/$${d}; done

override_dh_link:
	set -e; \
	( cd debian/$(PKG_NAME)/usr/share/asterisk/sounds/$(LNG)/; \
	  for d in $$(find . -mindepth 1 -type d -printf '%P\n'); do \
	    mkdir -p ../$${d}; \
	    echo usr/share/asterisk/sounds/$(LNG)/$${d} usr/share/asterisk/sounds/$${d}/$(LNG); \
	  done ) > debian/links
	dh_link
	rm debian/links
