app_meetme: Use new prompts for administrator menu
[asterisk/asterisk.git] / sounds / Makefile
1 #
2 # Asterisk -- An open source telephony toolkit.
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 have_download install
15
16 -include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/makeopts
17
18 CMD_PREFIX?=@
19 SOUNDS_DIR:=$(DESTDIR)$(ASTDATADIR)/sounds
20 SOUNDS_CACHE_DIR?=
21 MOH_DIR:=$(DESTDIR)$(ASTDATADIR)/moh
22 CORE_SOUNDS_VERSION:=1.4.23
23 EXTRA_SOUNDS_VERSION:=1.4.13
24 MOH_VERSION:=2.03
25 SOUNDS_URL:=http://downloads.asterisk.org/pub/telephony/sounds/releases
26 MCS:=$(subst -EN-,-en-,$(MENUSELECT_CORE_SOUNDS))
27 MCS:=$(subst -EN_AU-,-en_AU-,$(MCS))
28 MCS:=$(subst -FR-,-fr-,$(MCS))
29 MCS:=$(subst -ES-,-es-,$(MCS))
30 MCS:=$(subst -RU-,-ru-,$(MCS))
31 MCS:=$(subst -WAV,-wav,$(MCS))
32 MCS:=$(subst -ULAW,-ulaw,$(MCS))
33 MCS:=$(subst -ALAW,-alaw,$(MCS))
34 MCS:=$(subst -GSM,-gsm,$(MCS))
35 MCS:=$(subst -G729,-g729,$(MCS))
36 MCS:=$(subst -G722,-g722,$(MCS))
37 MCS:=$(subst -SLN16,-sln16,$(MCS))
38 MCS:=$(subst -SIREN7,-siren7,$(MCS))
39 MCS:=$(subst -SIREN14,-siren14,$(MCS))
40 CORE_SOUNDS:=$(MCS:CORE-SOUNDS-%=asterisk-core-sounds-%-$(CORE_SOUNDS_VERSION).tar.gz)
41 CORE_SOUND_TAGS:=$(MCS:CORE-SOUNDS-%=.asterisk-core-sounds-%-$(CORE_SOUNDS_VERSION))
42 MES:=$(subst -EN-,-en-,$(MENUSELECT_EXTRA_SOUNDS))
43 MES:=$(subst -FR-,-fr-,$(MES))
44 MES:=$(subst -ES-,-es-,$(MES))
45 MES:=$(subst -WAV,-wav,$(MES))
46 MES:=$(subst -ULAW,-ulaw,$(MES))
47 MES:=$(subst -ALAW,-alaw,$(MES))
48 MES:=$(subst -GSM,-gsm,$(MES))
49 MES:=$(subst -G729,-g729,$(MES))
50 MES:=$(subst -G722,-g722,$(MES))
51 MES:=$(subst -SLN16,-sln16,$(MES))
52 MES:=$(subst -SIREN7,-siren7,$(MES))
53 MES:=$(subst -SIREN14,-siren14,$(MES))
54 EXTRA_SOUNDS:=$(MES:EXTRA-SOUNDS-%=asterisk-extra-sounds-%-$(EXTRA_SOUNDS_VERSION).tar.gz)
55 EXTRA_SOUND_TAGS:=$(MES:EXTRA-SOUNDS-%=.asterisk-extra-sounds-%-$(EXTRA_SOUNDS_VERSION))
56 MM:=$(subst -OPSOUND-,-opsound-,$(MENUSELECT_MOH))
57 MM:=$(subst -WAV,-wav,$(MM))
58 MM:=$(subst -ULAW,-ulaw,$(MM))
59 MM:=$(subst -ALAW,-alaw,$(MM))
60 MM:=$(subst -GSM,-gsm,$(MM))
61 MM:=$(subst -G729,-g729,$(MM))
62 MM:=$(subst -G722,-g722,$(MM))
63 MM:=$(subst -SLN16,-sln16,$(MM))
64 MM:=$(subst -SIREN7,-siren7,$(MM))
65 MM:=$(subst -SIREN14,-siren14,$(MM))
66 MOH:=$(MM:MOH-%=asterisk-moh-%-$(MOH_VERSION).tar.gz)
67 MOH_TAGS:=$(MM:MOH-%=.asterisk-moh-%-$(MOH_VERSION))
68 # If "fetch" is used, --continue is not a valid option.
69 ifneq ($(findstring wget,$(DOWNLOAD)),)
70 DOWNLOAD+=--continue $(WGET_EXTRA_ARGS)
71 endif
72
73
74 define sound_format_lang_rule
75 .PHONY: .asterisk-$(2)$(if $(3),-$(3),)-%
76
77 .asterisk-$(2)$(if $(3),-$(3),)-%: asterisk-$(2)$(if $(3),-$(3),)-%.tar.gz
78         $(CMD_PREFIX) \
79         if test ! -f "$(1)$(if $(3),/$(3),)/$$@"; then \
80           PACKAGE=$$(subst .asterisk,asterisk,$$@).tar.gz; \
81           ( \
82             mkdir -p "$(1)$(if $(3),/$(3),)"; \
83             cd "$(1)$(if $(3),/$(3),)"; \
84             rm -f $$(subst -$(4),,$$@)-*; \
85             cat $$(CURDIR)/$$$${PACKAGE} | gzip -d | tar xof - \
86           ) && touch "$(1)$(if $(3),/$(3),)/$$@"; \
87         fi
88
89 asterisk-$(2)$(if $(3),-$(3),)-%.tar.gz: have_download
90 ifneq ($(SOUNDS_CACHE_DIR),)
91         $(CMD_PREFIX) \
92         if test ! -f "$(1)$(if $(3),/$(3),)/.$$(subst .tar.gz,,$$@)"; then \
93           if test ! -d "$$(SOUNDS_CACHE_DIR)/"; then \
94             mkdir -p "$$(SOUNDS_CACHE_DIR)/"; \
95           fi; \
96           if test ! -f "$$(SOUNDS_CACHE_DIR)/$$@"; then \
97             (cd "$$(SOUNDS_CACHE_DIR)"; $$(DOWNLOAD) $$(SOUNDS_URL)/$$@); \
98           fi; \
99           if test ! -f "$$(SOUNDS_CACHE_DIR)/$$@.sha1"; then \
100             (cd "$$(SOUNDS_CACHE_DIR)"; $$(DOWNLOAD) $$(SOUNDS_URL)/$$@.sha1); \
101           fi; \
102           $$(LN) -sf "$$(SOUNDS_CACHE_DIR)/$$@" .; \
103           $$(LN) -sf "$$(SOUNDS_CACHE_DIR)/$$@.sha1" .; \
104           $$(SHA1SUM) -c --status $$@.sha1 || \
105             ( \
106               rm -f "$$(SOUNDS_CACHE_DIR)/$$@" "$$(SOUNDS_CACHE_DIR)/$$@.sha1" $$@ $$@.sha1; \
107               echo "Bad checksum: $$@" 1>&2; \
108               exit 1; \
109             ) || exit 1; \
110         fi
111 else
112         $(CMD_PREFIX) \
113         if test ! -f $$@ && test ! -f "$(1)$(if $(3),/$(3),)/.$$(subst .tar.gz,,$$@)"; then \
114           $$(DOWNLOAD) $$(SOUNDS_URL)/$$@; \
115         fi
116 endif
117 endef # sound_format_lang_rule
118
119 all: $(CORE_SOUNDS) $(EXTRA_SOUNDS) $(MOH)
120
121 have_download:
122         @if test "$(DOWNLOAD)" = ":" ; then \
123                 echo "**************************************************"; \
124                 echo "***                                            ***"; \
125                 echo "*** You must have either wget or fetch to be   ***"; \
126                 echo "*** able to automatically download and install ***"; \
127                 echo "*** the requested sound packages.              ***"; \
128                 echo "***                                            ***"; \
129                 echo "*** Please install one of these, or remove any ***"; \
130                 echo "*** extra sound package selections in          ***"; \
131                 echo "*** menuselect before installing Asterisk.     ***"; \
132                 echo "***                                            ***"; \
133                 echo "**************************************************"; \
134                 exit 1; \
135         fi
136
137 $(eval $(call sound_format_lang_rule,$(SOUNDS_DIR),core-sounds,en,$(CORE_SOUNDS_VERSION)))
138
139 $(eval $(call sound_format_lang_rule,$(SOUNDS_DIR),core-sounds,en_AU,$(CORE_SOUNDS_VERSION)))
140
141 $(eval $(call sound_format_lang_rule,$(SOUNDS_DIR),core-sounds,es,$(CORE_SOUNDS_VERSION)))
142
143 $(eval $(call sound_format_lang_rule,$(SOUNDS_DIR),core-sounds,fr,$(CORE_SOUNDS_VERSION)))
144
145 $(eval $(call sound_format_lang_rule,$(SOUNDS_DIR),core-sounds,ru,$(CORE_SOUNDS_VERSION)))
146
147 $(eval $(call sound_format_lang_rule,$(SOUNDS_DIR),extra-sounds,en,$(EXTRA_SOUNDS_VERSION)))
148
149 $(eval $(call sound_format_lang_rule,$(SOUNDS_DIR),extra-sounds,es,$(EXTRA_SOUNDS_VERSION)))
150
151 $(eval $(call sound_format_lang_rule,$(SOUNDS_DIR),extra-sounds,fr,$(EXTRA_SOUNDS_VERSION)))
152
153 $(eval $(call sound_format_lang_rule,$(MOH_DIR),moh,,$(MOH_VERSION)))
154
155 dist-clean:
156         rm -f *.tar.gz
157
158 install: $(CORE_SOUND_TAGS) $(EXTRA_SOUND_TAGS) $(MOH_TAGS)
159
160 uninstall:
161         rm -rf "$(SOUNDS_DIR)"
162         rm -rf "$(MOH_DIR)"
163
164 core_sounds_version:
165         @echo $(CORE_SOUNDS_VERSION)
166
167 extra_sounds_version:
168         @echo $(EXTRA_SOUNDS_VERSION)
169
170 moh_version:
171         @echo $(MOH_VERSION)