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