sounds/Makefile updated to handle the extra-sounds tarball; some optimizations
[asterisk/asterisk.git] / sounds / Makefile
index 5a7a590..e1e83a2 100644 (file)
 # the GNU General Public License
 #
 
-include ../menuselect.makeopts
+.PHONY: dist-clean all uninstall
 
-CORE_SOUNDS_VERSION:=1.4.0
-SOUNDS_URL:="http://cork.digium.internal/apache2-default"
+-include $(ASTTOPDIR)/menuselect.makeopts
+
+PWD:=$(shell pwd)
+SOUNDS_DIR:=$(DESTDIR)$(ASTDATADIR)/sounds
+MOH_DIR:=$(DESTDIR)$(ASTDATADIR)/moh
+CORE_SOUNDS_VERSION:=1.4.1
+EXTRA_SOUNDS_VERSION:=1.4.1
+SOUNDS_URL:=http://ftp.digium.com/pub/telephony/sounds/releases
+EXTRA_SOUNDS_URL:=http://ftp.digium.com/pub/telephony/sounds/releases
+MOH_URL:=http://ftp.digium.com/pub/telephony/sounds
 MENUSELECT_CORE_SOUNDS:=$(subst -EN-,-en-,$(MENUSELECT_CORE_SOUNDS))
 MENUSELECT_CORE_SOUNDS:=$(subst -FR-,-fr-,$(MENUSELECT_CORE_SOUNDS))
 MENUSELECT_CORE_SOUNDS:=$(subst -ES-,-es-,$(MENUSELECT_CORE_SOUNDS))
@@ -24,6 +32,7 @@ MENUSELECT_CORE_SOUNDS:=$(subst -ALAW,-alaw,$(MENUSELECT_CORE_SOUNDS))
 MENUSELECT_CORE_SOUNDS:=$(subst -GSM,-gsm,$(MENUSELECT_CORE_SOUNDS))
 MENUSELECT_CORE_SOUNDS:=$(subst -G729,-g729,$(MENUSELECT_CORE_SOUNDS))
 CORE_SOUNDS:=$(MENUSELECT_CORE_SOUNDS:CORE-SOUNDS-%=asterisk-core-sounds-%-$(CORE_SOUNDS_VERSION).tar.gz)
+CORE_SOUND_TAGS:=$(MENUSELECT_CORE_SOUNDS:CORE-SOUNDS-%=$(SOUNDS_DIR)/.asterisk-core-sounds-%-$(CORE_SOUNDS_VERSION))
 MENUSELECT_EXTRA_SOUNDS:=$(subst -EN-,-en-,$(MENUSELECT_EXTRA_SOUNDS))
 MENUSELECT_EXTRA_SOUNDS:=$(subst -FR-,-fr-,$(MENUSELECT_EXTRA_SOUNDS))
 MENUSELECT_EXTRA_SOUNDS:=$(subst -ES-,-es-,$(MENUSELECT_EXTRA_SOUNDS))
@@ -32,23 +41,67 @@ MENUSELECT_EXTRA_SOUNDS:=$(subst -ULAW,-ulaw,$(MENUSELECT_EXTRA_SOUNDS))
 MENUSELECT_EXTRA_SOUNDS:=$(subst -ALAW,-alaw,$(MENUSELECT_EXTRA_SOUNDS))
 MENUSELECT_EXTRA_SOUNDS:=$(subst -GSM,-gsm,$(MENUSELECT_EXTRA_SOUNDS))
 MENUSELECT_EXTRA_SOUNDS:=$(subst -G729,-g729,$(MENUSELECT_EXTRA_SOUNDS))
-EXTRA_SOUNDS:=$(MENUSELECT_EXTRA_SOUNDS:EXTRA-SOUNDS-%=asterisk-extra-sounds-%.tar.gz)
+EXTRA_SOUNDS:=$(MENUSELECT_EXTRA_SOUNDS:EXTRA-SOUNDS-%=asterisk-extra-sounds-%-$(EXTRA_SOUNDS_VERSION).tar.gz)
+EXTRA_SOUND_TAGS:=$(MENUSELECT_EXTRA_SOUNDS:EXTRA-SOUNDS-%=$(SOUNDS_DIR)/.asterisk-extra-sounds-%-$(EXTRA_SOUNDS_VERSION))
 MENUSELECT_MOH:=$(subst -FREEPLAY-,-freeplay-,$(MENUSELECT_MOH))
-MENUSELECT_MOH:=$(subst -MP3,-mp3,$(MENUSELECT_MOH))
+MENUSELECT_MOH:=$(subst -WAV,-wav,$(MENUSELECT_MOH))
+MENUSELECT_MOH:=$(subst -ULAW,-ulaw,$(MENUSELECT_MOH))
+MENUSELECT_MOH:=$(subst -ALAW,-alaw,$(MENUSELECT_MOH))
+MENUSELECT_MOH:=$(subst -GSM,-gsm,$(MENUSELECT_MOH))
+MENUSELECT_MOH:=$(subst -G729,-g729,$(MENUSELECT_MOH))
 MOH:=$(MENUSELECT_MOH:MOH-%=asterisk-moh-%.tar.gz)
+MOH_TAGS:=$(MENUSELECT_MOH:MOH-%=$(MOH_DIR)/.asterisk-moh-%)
+WGET_ARGS:=--continue
+
+all: $(CORE_SOUNDS) $(EXTRA_SOUNDS) $(MOH)
+
+$(SOUNDS_DIR)/.asterisk-core-sounds-en-%: asterisk-core-sounds-en-%.tar.gz $(SOUNDS_DIR)
+       cat $< | gzip -d | tar xCf $(SOUNDS_DIR) -
+       touch $@
+
+$(SOUNDS_DIR)/.asterisk-core-sounds-fr-%: asterisk-core-sounds-fr-%.tar.gz $(SOUNDS_DIR)/fr
+       cat $< | gzip -d | tar xCf $(SOUNDS_DIR)/fr -
+       touch $@
+
+$(SOUNDS_DIR)/.asterisk-core-sounds-es-%: asterisk-core-sounds-es-%.tar.gz $(SOUNDS_DIR)/es
+       cat $< | gzip -d | tar xCf $(SOUNDS_DIR)/es -
+       touch $@
+
+$(SOUNDS_DIR)/.asterisk-extra-sounds-en-%: asterisk-extra-sounds-en-%.tar.gz $(SOUNDS_DIR)
+       cat $< | gzip -d | tar xCf $(SOUNDS_DIR) -
+       touch $@
 
-%.tar.gz:
-       @wget --no-verbose --continue $(SOUNDS_URL)/$@
+$(SOUNDS_DIR)/.asterisk-extra-sounds-fr-%: asterisk-extra-sounds-fr-%.tar.gz $(SOUNDS_DIR)
+       cat $< | gzip -d | tar xCf $(SOUNDS_DIR) -
+       touch $@
 
-all:   $(CORE_SOUNDS) $(EXTRA_SOUNDS) $(MOH)
+$(SOUNDS_DIR)/.asterisk-extra-sounds-es-%: asterisk-extra-sounds-es-%.tar.gz $(SOUNDS_DIR)
+       cat $< | gzip -d | tar xCf $(SOUNDS_DIR) -
+       touch $@
+
+$(MOH_DIR)/.asterisk-moh-%: asterisk-moh-%.tar.gz $(MOH_DIR)
+       cat $< | gzip -d | tar xCf $(MOH_DIR) -
+       touch $@
+
+asterisk-core-%.tar.gz:
+       @wget $(WGET_ARGS) $(SOUNDS_URL)/$@
+
+asterisk-extra-%.tar.gz:
+       @wget $(WGET_ARGS) $(EXTRA_SOUNDS_URL)/$@
+
+asterisk-moh-%.tar.gz:
+       @wget $(WGET_ARGS) $(MOH_URL)/$@
 
 dist-clean:
        rm -f *.tar.gz
 
-install: all
-       mkdir -p $(DESTDIR)$(ASTDATADIR)/sounds
-       mkdir -p $(DESTDIR)$(ASTDATADIR)/mohmp3
+.PHONY: $(SOUNDS_DIR) $(SOUNDS_DIR)/fr $(SOUNDS_DIR)/es $(MOH_DIR)
+
+$(SOUNDS_DIR) $(MOH_DIR) $(SOUNDS_DIR)/es $(SOUNDS_DIR)/fr:
+       mkdir -p $@
+
+install: $(CORE_SOUND_TAGS) $(EXTRA_SOUND_TAGS) $(MOH_TAGS)
 
 uninstall:
-       rm -rf $(DESTDIR)$(ASTDATADIR)/sounds
-       rm -rf $(DESTDIR)$(ASTDATADIR)/mohmp3
+       rm -rf $(SOUNDS_DIR)
+       rm -rf $(MOH_DIR)