Merged revisions 43676 via svnmerge from
[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.3
22 EXTRA_SOUNDS_VERSION:=1.4.2
23 SOUNDS_URL:=http://ftp.digium.com/pub/telephony/sounds/releases
24 MCS:=$(subst -EN-,-en-,$(MENUSELECT_CORE_SOUNDS))
25 MCS:=$(subst -FR-,-fr-,$(MCS))
26 MCS:=$(subst -ES-,-es-,$(MCS))
27 MCS:=$(subst -WAV,-wav,$(MCS))
28 MCS:=$(subst -ULAW,-ulaw,$(MCS))
29 MCS:=$(subst -ALAW,-alaw,$(MCS))
30 MCS:=$(subst -GSM,-gsm,$(MCS))
31 MCS:=$(subst -G729,-g729,$(MCS))
32 CORE_SOUNDS:=$(MCS:CORE-SOUNDS-%=asterisk-core-sounds-%-$(CORE_SOUNDS_VERSION).tar.gz)
33 CORE_SOUND_TAGS:=$(MCS:CORE-SOUNDS-%=$(SOUNDS_DIR)/.asterisk-core-sounds-%-$(CORE_SOUNDS_VERSION))
34 MES:=$(subst -EN-,-en-,$(MENUSELECT_EXTRA_SOUNDS))
35 MES:=$(subst -FR-,-fr-,$(MES))
36 MES:=$(subst -ES-,-es-,$(MES))
37 MES:=$(subst -WAV,-wav,$(MES))
38 MES:=$(subst -ULAW,-ulaw,$(MES))
39 MES:=$(subst -ALAW,-alaw,$(MES))
40 MES:=$(subst -GSM,-gsm,$(MES))
41 MES:=$(subst -G729,-g729,$(MES))
42 EXTRA_SOUNDS:=$(MES:EXTRA-SOUNDS-%=asterisk-extra-sounds-%-$(EXTRA_SOUNDS_VERSION).tar.gz)
43 EXTRA_SOUND_TAGS:=$(MES:EXTRA-SOUNDS-%=$(SOUNDS_DIR)/.asterisk-extra-sounds-%-$(EXTRA_SOUNDS_VERSION))
44 MM:=$(subst -FREEPLAY-,-freeplay-,$(MENUSELECT_MOH))
45 MM:=$(subst -WAV,-wav,$(MM))
46 MM:=$(subst -ULAW,-ulaw,$(MM))
47 MM:=$(subst -ALAW,-alaw,$(MM))
48 MM:=$(subst -GSM,-gsm,$(MM))
49 MM:=$(subst -G729,-g729,$(MM))
50 MOH:=$(MM:MOH-%=asterisk-moh-%.tar.gz)
51 MOH_TAGS:=$(MM:MOH-%=$(MOH_DIR)/.asterisk-moh-%)
52 WGET_ARGS:=--continue
53
54 all: $(CORE_SOUNDS) $(EXTRA_SOUNDS) $(MOH)
55
56 $(SOUNDS_DIR)/.asterisk-core-sounds-en-%:
57         @PACKAGE=$(subst $(SOUNDS_DIR)/.asterisk,asterisk,$@).tar.gz; \
58         if test ! -f $${PACKAGE}; then wget $(WGET_ARGS) $(SOUNDS_URL)/$${PACKAGE}; fi; \
59         if test ! -f $${PACKAGE}; then exit 1; fi; \
60         rm -f $(subst -$(CORE_SOUNDS_VERSION),,$@)-* && \
61         (cd $(SOUNDS_DIR); cat $(PWD)/$${PACKAGE} | gzip -d | tar xf -) && \
62         touch $@
63
64 $(SOUNDS_DIR)/.asterisk-core-sounds-es-%:
65         @PACKAGE=$(subst $(SOUNDS_DIR)/.asterisk,asterisk,$@).tar.gz; \
66         if test ! -f $${PACKAGE}; then wget $(WGET_ARGS) $(SOUNDS_URL)/$${PACKAGE}; fi; \
67         if test ! -f $${PACKAGE}; then exit 1; fi; \
68         rm -f $(subst -$(CORE_SOUNDS_VERSION),,$@)-* && \
69         (cd $(SOUNDS_DIR)/es; cat $(PWD)/$${PACKAGE} | gzip -d | tar xf -) && \
70         touch $@
71
72 $(SOUNDS_DIR)/.asterisk-core-sounds-fr-%:
73         @PACKAGE=$(subst $(SOUNDS_DIR)/.asterisk,asterisk,$@).tar.gz; \
74         if test ! -f $${PACKAGE}; then wget $(WGET_ARGS) $(SOUNDS_URL)/$${PACKAGE}; fi; \
75         if test ! -f $${PACKAGE}; then exit 1; fi; \
76         rm -f $(subst -$(CORE_SOUNDS_VERSION),,$@)-* && \
77         (cd $(SOUNDS_DIR)/fr; cat $(PWD)/$${PACKAGE} | gzip -d | tar xf -) && \
78         touch $@
79
80 $(SOUNDS_DIR)/.asterisk-extra-sounds-en-%:
81         @PACKAGE=$(subst $(SOUNDS_DIR)/.asterisk,asterisk,$@).tar.gz; \
82         if test ! -f $${PACKAGE}; then wget $(WGET_ARGS) $(SOUNDS_URL)/$${PACKAGE}; fi; \
83         if test ! -f $${PACKAGE}; then exit 1; fi; \
84         rm -f $(subst -$(EXTRA_SOUNDS_VERSION),,$@)-* && \
85         (cd $(SOUNDS_DIR); cat $(PWD)/$${PACKAGE} | gzip -d | tar xf -) && \
86         touch $@
87
88 $(SOUNDS_DIR)/.asterisk-extra-sounds-es-%:
89         @PACKAGE=$(subst $(SOUNDS_DIR)/.asterisk,asterisk,$@).tar.gz; \
90         if test ! -f $${PACKAGE}; then wget $(WGET_ARGS) $(SOUNDS_URL)/$${PACKAGE}; fi; \
91         if test ! -f $${PACKAGE}; then exit 1; fi; \
92         rm -f $(subst -$(EXTRA_SOUNDS_VERSION),,$@)-* && \
93         (cd $(SOUNDS_DIR)/es; cat $(PWD)/$${PACKAGE} | gzip -d | tar xf -) && \
94         touch $@
95
96 $(SOUNDS_DIR)/.asterisk-extra-sounds-fr-%:
97         @PACKAGE=$(subst $(SOUNDS_DIR)/.asterisk,asterisk,$@).tar.gz; \
98         if test ! -f $${PACKAGE}; then wget $(WGET_ARGS) $(SOUNDS_URL)/$${PACKAGE}; fi; \
99         if test ! -f $${PACKAGE}; then exit 1; fi; \
100         rm -f $(subst -$(EXTRA_SOUNDS_VERSION),,$@)-* && \
101         (cd $(SOUNDS_DIR)/fr; cat $(PWD)/$${PACKAGE} | gzip -d | tar xf -) && \
102         touch $@
103
104 $(MOH_DIR)/.asterisk-moh-%:
105         @PACKAGE=$(subst $(MOH_DIR)/.asterisk,asterisk,$@).tar.gz; \
106         if test ! -f $${PACKAGE}; then wget $(WGET_ARGS) $(SOUNDS_URL)/$${PACKAGE}; fi; \
107         if test ! -f $${PACKAGE}; then exit 1; fi; \
108         (cd $(MOH_DIR); cat $(PWD)/$${PACKAGE} | gzip -d | tar xf -) && \
109         touch $@
110
111 asterisk-core-%.tar.gz:
112         @wget $(WGET_ARGS) $(SOUNDS_URL)/$@
113
114 asterisk-extra-%.tar.gz:
115         @wget $(WGET_ARGS) $(SOUNDS_URL)/$@
116
117 asterisk-moh-%.tar.gz:
118         @wget $(WGET_ARGS) $(SOUNDS_URL)/$@
119
120 dist-clean:
121         rm -f *.tar.gz
122
123 $(SOUNDS_DIR) $(MOH_DIR) $(SOUNDS_DIR)/es $(SOUNDS_DIR)/fr:
124         mkdir -p $@
125
126 install: $(SOUNDS_DIR) $(SOUNDS_DIR)/es $(SOUNDS_DIR)/fr $(MOH_DIR) $(CORE_SOUND_TAGS) $(EXTRA_SOUND_TAGS) $(MOH_TAGS)
127
128 uninstall:
129         rm -rf $(SOUNDS_DIR)
130         rm -rf $(MOH_DIR)