Merged revisions 43386 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.2
22 EXTRA_SOUNDS_VERSION:=1.4.1
23 SOUNDS_URL:=http://ftp.digium.com/pub/telephony/sounds/releases
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-%-$(EXTRA_SOUNDS_VERSION).tar.gz)
43 EXTRA_SOUND_TAGS:=$(MENUSELECT_EXTRA_SOUNDS:EXTRA-SOUNDS-%=$(SOUNDS_DIR)/.asterisk-extra-sounds-%-$(EXTRA_SOUNDS_VERSION))
44 MENUSELECT_MOH:=$(subst -FREEPLAY-,-freeplay-,$(MENUSELECT_MOH))
45 MENUSELECT_MOH:=$(subst -WAV,-wav,$(MENUSELECT_MOH))
46 MENUSELECT_MOH:=$(subst -ULAW,-ulaw,$(MENUSELECT_MOH))
47 MENUSELECT_MOH:=$(subst -ALAW,-alaw,$(MENUSELECT_MOH))
48 MENUSELECT_MOH:=$(subst -GSM,-gsm,$(MENUSELECT_MOH))
49 MENUSELECT_MOH:=$(subst -G729,-g729,$(MENUSELECT_MOH))
50 MOH:=$(MENUSELECT_MOH:MOH-%=asterisk-moh-%.tar.gz)
51 MOH_TAGS:=$(MENUSELECT_MOH: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-%: $(SOUNDS_DIR)
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         cat $${PACKAGE} | gzip -d | tar xCf $(SOUNDS_DIR) -
62         touch $@
63
64 $(SOUNDS_DIR)/.asterisk-core-sounds-es-%: $(SOUNDS_DIR)/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         cat $${PACKAGE} | gzip -d | tar xCf $(SOUNDS_DIR)/es -
70         touch $@
71
72 $(SOUNDS_DIR)/.asterisk-core-sounds-fr-%: $(SOUNDS_DIR)/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         cat $${PACKAGE} | gzip -d | tar xCf $(SOUNDS_DIR)/fr -
78         touch $@
79
80 $(SOUNDS_DIR)/.asterisk-extra-sounds-en-%: $(SOUNDS_DIR)
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         cat $${PACKAGE} | gzip -d | tar xCf $(SOUNDS_DIR) -
86         touch $@
87
88 $(SOUNDS_DIR)/.asterisk-extra-sounds-es-%: $(SOUNDS_DIR)/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         cat /$${PACKAGE} | gzip -d | tar xCf $(SOUNDS_DIR)/es -
94         touch $@
95
96 $(SOUNDS_DIR)/.asterisk-extra-sounds-fr-%: $(SOUNDS_DIR)/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         cat $${PACKAGE} | gzip -d | tar xCf $(SOUNDS_DIR)/fr -
102         touch $@
103
104 $(MOH_DIR)/.asterisk-moh-%: $(MOH_DIR)
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         cat $${PACKAGE} | gzip -d | tar xCf $(MOH_DIR) -
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 .PHONY: $(SOUNDS_DIR) $(SOUNDS_DIR)/fr $(SOUNDS_DIR)/es $(MOH_DIR)
124
125 $(SOUNDS_DIR) $(MOH_DIR) $(SOUNDS_DIR)/es $(SOUNDS_DIR)/fr:
126         mkdir -p $@
127
128 install: $(CORE_SOUND_TAGS) $(EXTRA_SOUND_TAGS) $(MOH_TAGS)
129
130 uninstall:
131         rm -rf $(SOUNDS_DIR)
132         rm -rf $(MOH_DIR)