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