sounds/Makefile updated to handle the extra-sounds tarball; some optimizations
[asterisk/asterisk.git] / sounds / Makefile
1 #
2 # Asterisk -- A telephony toolkit for Linux.
3
4 # Makefile for sound files
5 #
6 # Copyright (C) 2006, Digium, Inc.
7 #
8 # Kevin P. Fleming <kpfleming@digium.com>
9 #
10 # This program is free software, distributed under the terms of
11 # the GNU General Public License
12 #
13
14 .PHONY: dist-clean all uninstall
15
16 -include $(ASTTOPDIR)/menuselect.makeopts
17
18 PWD:=$(shell pwd)
19 SOUNDS_DIR:=$(DESTDIR)$(ASTDATADIR)/sounds
20 MOH_DIR:=$(DESTDIR)$(ASTDATADIR)/moh
21 CORE_SOUNDS_VERSION:=1.4.1
22 EXTRA_SOUNDS_VERSION:=1.4.1
23 SOUNDS_URL:=http://ftp.digium.com/pub/telephony/sounds/releases
24 EXTRA_SOUNDS_URL:=http://ftp.digium.com/pub/telephony/sounds/releases
25 MOH_URL:=http://ftp.digium.com/pub/telephony/sounds
26 MENUSELECT_CORE_SOUNDS:=$(subst -EN-,-en-,$(MENUSELECT_CORE_SOUNDS))
27 MENUSELECT_CORE_SOUNDS:=$(subst -FR-,-fr-,$(MENUSELECT_CORE_SOUNDS))
28 MENUSELECT_CORE_SOUNDS:=$(subst -ES-,-es-,$(MENUSELECT_CORE_SOUNDS))
29 MENUSELECT_CORE_SOUNDS:=$(subst -WAV,-wav,$(MENUSELECT_CORE_SOUNDS))
30 MENUSELECT_CORE_SOUNDS:=$(subst -ULAW,-ulaw,$(MENUSELECT_CORE_SOUNDS))
31 MENUSELECT_CORE_SOUNDS:=$(subst -ALAW,-alaw,$(MENUSELECT_CORE_SOUNDS))
32 MENUSELECT_CORE_SOUNDS:=$(subst -GSM,-gsm,$(MENUSELECT_CORE_SOUNDS))
33 MENUSELECT_CORE_SOUNDS:=$(subst -G729,-g729,$(MENUSELECT_CORE_SOUNDS))
34 CORE_SOUNDS:=$(MENUSELECT_CORE_SOUNDS:CORE-SOUNDS-%=asterisk-core-sounds-%-$(CORE_SOUNDS_VERSION).tar.gz)
35 CORE_SOUND_TAGS:=$(MENUSELECT_CORE_SOUNDS:CORE-SOUNDS-%=$(SOUNDS_DIR)/.asterisk-core-sounds-%-$(CORE_SOUNDS_VERSION))
36 MENUSELECT_EXTRA_SOUNDS:=$(subst -EN-,-en-,$(MENUSELECT_EXTRA_SOUNDS))
37 MENUSELECT_EXTRA_SOUNDS:=$(subst -FR-,-fr-,$(MENUSELECT_EXTRA_SOUNDS))
38 MENUSELECT_EXTRA_SOUNDS:=$(subst -ES-,-es-,$(MENUSELECT_EXTRA_SOUNDS))
39 MENUSELECT_EXTRA_SOUNDS:=$(subst -WAV,-wav,$(MENUSELECT_EXTRA_SOUNDS))
40 MENUSELECT_EXTRA_SOUNDS:=$(subst -ULAW,-ulaw,$(MENUSELECT_EXTRA_SOUNDS))
41 MENUSELECT_EXTRA_SOUNDS:=$(subst -ALAW,-alaw,$(MENUSELECT_EXTRA_SOUNDS))
42 MENUSELECT_EXTRA_SOUNDS:=$(subst -GSM,-gsm,$(MENUSELECT_EXTRA_SOUNDS))
43 MENUSELECT_EXTRA_SOUNDS:=$(subst -G729,-g729,$(MENUSELECT_EXTRA_SOUNDS))
44 EXTRA_SOUNDS:=$(MENUSELECT_EXTRA_SOUNDS:EXTRA-SOUNDS-%=asterisk-extra-sounds-%-$(EXTRA_SOUNDS_VERSION).tar.gz)
45 EXTRA_SOUND_TAGS:=$(MENUSELECT_EXTRA_SOUNDS:EXTRA-SOUNDS-%=$(SOUNDS_DIR)/.asterisk-extra-sounds-%-$(EXTRA_SOUNDS_VERSION))
46 MENUSELECT_MOH:=$(subst -FREEPLAY-,-freeplay-,$(MENUSELECT_MOH))
47 MENUSELECT_MOH:=$(subst -WAV,-wav,$(MENUSELECT_MOH))
48 MENUSELECT_MOH:=$(subst -ULAW,-ulaw,$(MENUSELECT_MOH))
49 MENUSELECT_MOH:=$(subst -ALAW,-alaw,$(MENUSELECT_MOH))
50 MENUSELECT_MOH:=$(subst -GSM,-gsm,$(MENUSELECT_MOH))
51 MENUSELECT_MOH:=$(subst -G729,-g729,$(MENUSELECT_MOH))
52 MOH:=$(MENUSELECT_MOH:MOH-%=asterisk-moh-%.tar.gz)
53 MOH_TAGS:=$(MENUSELECT_MOH:MOH-%=$(MOH_DIR)/.asterisk-moh-%)
54 WGET_ARGS:=--continue
55
56 all: $(CORE_SOUNDS) $(EXTRA_SOUNDS) $(MOH)
57
58 $(SOUNDS_DIR)/.asterisk-core-sounds-en-%: asterisk-core-sounds-en-%.tar.gz $(SOUNDS_DIR)
59         cat $< | gzip -d | tar xCf $(SOUNDS_DIR) -
60         touch $@
61
62 $(SOUNDS_DIR)/.asterisk-core-sounds-fr-%: asterisk-core-sounds-fr-%.tar.gz $(SOUNDS_DIR)/fr
63         cat $< | gzip -d | tar xCf $(SOUNDS_DIR)/fr -
64         touch $@
65
66 $(SOUNDS_DIR)/.asterisk-core-sounds-es-%: asterisk-core-sounds-es-%.tar.gz $(SOUNDS_DIR)/es
67         cat $< | gzip -d | tar xCf $(SOUNDS_DIR)/es -
68         touch $@
69
70 $(SOUNDS_DIR)/.asterisk-extra-sounds-en-%: asterisk-extra-sounds-en-%.tar.gz $(SOUNDS_DIR)
71         cat $< | gzip -d | tar xCf $(SOUNDS_DIR) -
72         touch $@
73
74 $(SOUNDS_DIR)/.asterisk-extra-sounds-fr-%: asterisk-extra-sounds-fr-%.tar.gz $(SOUNDS_DIR)
75         cat $< | gzip -d | tar xCf $(SOUNDS_DIR) -
76         touch $@
77
78 $(SOUNDS_DIR)/.asterisk-extra-sounds-es-%: asterisk-extra-sounds-es-%.tar.gz $(SOUNDS_DIR)
79         cat $< | gzip -d | tar xCf $(SOUNDS_DIR) -
80         touch $@
81
82 $(MOH_DIR)/.asterisk-moh-%: asterisk-moh-%.tar.gz $(MOH_DIR)
83         cat $< | gzip -d | tar xCf $(MOH_DIR) -
84         touch $@
85
86 asterisk-core-%.tar.gz:
87         @wget $(WGET_ARGS) $(SOUNDS_URL)/$@
88
89 asterisk-extra-%.tar.gz:
90         @wget $(WGET_ARGS) $(EXTRA_SOUNDS_URL)/$@
91
92 asterisk-moh-%.tar.gz:
93         @wget $(WGET_ARGS) $(MOH_URL)/$@
94
95 dist-clean:
96         rm -f *.tar.gz
97
98 .PHONY: $(SOUNDS_DIR) $(SOUNDS_DIR)/fr $(SOUNDS_DIR)/es $(MOH_DIR)
99
100 $(SOUNDS_DIR) $(MOH_DIR) $(SOUNDS_DIR)/es $(SOUNDS_DIR)/fr:
101         mkdir -p $@
102
103 install: $(CORE_SOUND_TAGS) $(EXTRA_SOUND_TAGS) $(MOH_TAGS)
104
105 uninstall:
106         rm -rf $(SOUNDS_DIR)
107         rm -rf $(MOH_DIR)