fdefcd4b2b88d00fe9ef41070f128fa6a640bca2
[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 SOUNDS_URL:=http://ftp.digium.com/pub/telephony/sounds/releases
23 MOH_URL:=http://ftp.digium.com/pub/telephony/sounds
24 MENUSELECT_CORE_SOUNDS:=$(subst -EN-,-en-,$(MENUSELECT_CORE_SOUNDS))
25 MENUSELECT_CORE_SOUNDS:=$(subst -FR-,-fr-,$(MENUSELECT_CORE_SOUNDS))
26 MENUSELECT_CORE_SOUNDS:=$(subst -ES-,-es-,$(MENUSELECT_CORE_SOUNDS))
27 MENUSELECT_CORE_SOUNDS:=$(subst -WAV,-wav,$(MENUSELECT_CORE_SOUNDS))
28 MENUSELECT_CORE_SOUNDS:=$(subst -ULAW,-ulaw,$(MENUSELECT_CORE_SOUNDS))
29 MENUSELECT_CORE_SOUNDS:=$(subst -ALAW,-alaw,$(MENUSELECT_CORE_SOUNDS))
30 MENUSELECT_CORE_SOUNDS:=$(subst -GSM,-gsm,$(MENUSELECT_CORE_SOUNDS))
31 MENUSELECT_CORE_SOUNDS:=$(subst -G729,-g729,$(MENUSELECT_CORE_SOUNDS))
32 CORE_SOUNDS:=$(MENUSELECT_CORE_SOUNDS:CORE-SOUNDS-%=asterisk-core-sounds-%-$(CORE_SOUNDS_VERSION).tar.gz)
33 CORE_SOUND_TAGS:=$(MENUSELECT_CORE_SOUNDS:CORE-SOUNDS-%=$(SOUNDS_DIR)/.asterisk-core-sounds-%-$(CORE_SOUNDS_VERSION))
34 MENUSELECT_EXTRA_SOUNDS:=$(subst -EN-,-en-,$(MENUSELECT_EXTRA_SOUNDS))
35 MENUSELECT_EXTRA_SOUNDS:=$(subst -FR-,-fr-,$(MENUSELECT_EXTRA_SOUNDS))
36 MENUSELECT_EXTRA_SOUNDS:=$(subst -ES-,-es-,$(MENUSELECT_EXTRA_SOUNDS))
37 MENUSELECT_EXTRA_SOUNDS:=$(subst -WAV,-wav,$(MENUSELECT_EXTRA_SOUNDS))
38 MENUSELECT_EXTRA_SOUNDS:=$(subst -ULAW,-ulaw,$(MENUSELECT_EXTRA_SOUNDS))
39 MENUSELECT_EXTRA_SOUNDS:=$(subst -ALAW,-alaw,$(MENUSELECT_EXTRA_SOUNDS))
40 MENUSELECT_EXTRA_SOUNDS:=$(subst -GSM,-gsm,$(MENUSELECT_EXTRA_SOUNDS))
41 MENUSELECT_EXTRA_SOUNDS:=$(subst -G729,-g729,$(MENUSELECT_EXTRA_SOUNDS))
42 EXTRA_SOUNDS:=$(MENUSELECT_EXTRA_SOUNDS:EXTRA-SOUNDS-%=asterisk-extra-sounds-%.tar.gz)
43 MENUSELECT_MOH:=$(subst -FREEPLAY-,-freeplay-,$(MENUSELECT_MOH))
44 MENUSELECT_MOH:=$(subst -WAV,-wav,$(MENUSELECT_MOH))
45 MENUSELECT_MOH:=$(subst -ULAW,-ulaw,$(MENUSELECT_MOH))
46 MENUSELECT_MOH:=$(subst -ALAW,-alaw,$(MENUSELECT_MOH))
47 MENUSELECT_MOH:=$(subst -GSM,-gsm,$(MENUSELECT_MOH))
48 MENUSELECT_MOH:=$(subst -G729,-g729,$(MENUSELECT_MOH))
49 MOH:=$(MENUSELECT_MOH:MOH-%=asterisk-moh-%.tar.gz)
50 MOH_TAGS:=$(MENUSELECT_MOH: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         (cd $(SOUNDS_DIR); cat $(PWD)/$${PACKAGE} | gzip -d | tar xf -) && \
61         touch $@
62
63 $(SOUNDS_DIR)/.asterisk-core-sounds-fr-%: $(SOUNDS_DIR)/fr
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         (cd $(SOUNDS_DIR)/fr; cat $(PWD)/$${PACKAGE} | gzip -d | tar xf -) && \
69         touch $@
70
71 $(SOUNDS_DIR)/.asterisk-core-sounds-es-%: $(SOUNDS_DIR)/es
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         (cd $(SOUNDS_DIR)/es; cat $(PWD)/$${PACKAGE} | gzip -d | tar xf -) && \
77         touch $@
78
79 $(MOH_DIR)/.asterisk-moh-%:
80         @PACKAGE=$(subst $(MOH_DIR)/.asterisk,asterisk,$@).tar.gz; \
81         if test ! -f $${PACKAGE}; then wget $(WGET_ARGS) $(MOH_URL)/$${PACKAGE}; fi; \
82         if test ! -f $${PACKAGE}; then exit 1; fi; \
83         (cd $(MOH_DIR); cat $(PWD)/$${PACKAGE} | gzip -d | tar xf -) && \
84         touch $@
85
86 asterisk-core-%.tar.gz:
87         @wget $(WGET_ARGS) $(SOUNDS_URL)/$@
88
89 asterisk-extra-%.tar.gz:
90         @wget $(WGET_ARGS) $(MOH_URL)/$@
91
92 asterisk-moh-%.tar.gz:
93         @wget $(WGET_ARGS) $(MOH_URL)/$@
94
95 dist-clean:
96         rm -f *.tar.gz
97
98 $(SOUNDS_DIR) $(MOH_DIR) $(SOUNDS_DIR)/es $(SOUNDS_DIR)/fr:
99         mkdir -p $@
100
101 install: $(SOUNDS_DIR) $(MOH_DIR) $(CORE_SOUND_TAGS) $(MOH_TAGS)
102
103 uninstall:
104         rm -rf $(SOUNDS_DIR)
105         rm -rf $(MOH_DIR)