6c28e34e0b44ad45059381ada29c8a63713990b4
[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 include ../menuselect.makeopts
15
16 PWD:=$(shell pwd)
17 SOUNDS_DIR:=$(DESTDIR)$(ASTDATADIR)/sounds
18 MOH_DIR:=$(DESTDIR)$(ASTDATADIR)/mohmp3
19 CORE_SOUNDS_VERSION:=1.4.0
20 SOUNDS_URL:=http://cork.digium.internal/apache2-default
21 MENUSELECT_CORE_SOUNDS:=$(subst -EN-,-en-,$(MENUSELECT_CORE_SOUNDS))
22 MENUSELECT_CORE_SOUNDS:=$(subst -FR-,-fr-,$(MENUSELECT_CORE_SOUNDS))
23 MENUSELECT_CORE_SOUNDS:=$(subst -ES-,-es-,$(MENUSELECT_CORE_SOUNDS))
24 MENUSELECT_CORE_SOUNDS:=$(subst -WAV,-wav,$(MENUSELECT_CORE_SOUNDS))
25 MENUSELECT_CORE_SOUNDS:=$(subst -ULAW,-ulaw,$(MENUSELECT_CORE_SOUNDS))
26 MENUSELECT_CORE_SOUNDS:=$(subst -ALAW,-alaw,$(MENUSELECT_CORE_SOUNDS))
27 MENUSELECT_CORE_SOUNDS:=$(subst -GSM,-gsm,$(MENUSELECT_CORE_SOUNDS))
28 MENUSELECT_CORE_SOUNDS:=$(subst -G729,-g729,$(MENUSELECT_CORE_SOUNDS))
29 CORE_SOUNDS:=$(MENUSELECT_CORE_SOUNDS:CORE-SOUNDS-%=asterisk-core-sounds-%-$(CORE_SOUNDS_VERSION).tar.gz)
30 CORE_SOUND_TAGS:=$(MENUSELECT_CORE_SOUNDS:CORE-SOUNDS-%=$(SOUNDS_DIR)/.asterisk-core-sounds-%-$(CORE_SOUNDS_VERSION))
31 MENUSELECT_EXTRA_SOUNDS:=$(subst -EN-,-en-,$(MENUSELECT_EXTRA_SOUNDS))
32 MENUSELECT_EXTRA_SOUNDS:=$(subst -FR-,-fr-,$(MENUSELECT_EXTRA_SOUNDS))
33 MENUSELECT_EXTRA_SOUNDS:=$(subst -ES-,-es-,$(MENUSELECT_EXTRA_SOUNDS))
34 MENUSELECT_EXTRA_SOUNDS:=$(subst -WAV,-wav,$(MENUSELECT_EXTRA_SOUNDS))
35 MENUSELECT_EXTRA_SOUNDS:=$(subst -ULAW,-ulaw,$(MENUSELECT_EXTRA_SOUNDS))
36 MENUSELECT_EXTRA_SOUNDS:=$(subst -ALAW,-alaw,$(MENUSELECT_EXTRA_SOUNDS))
37 MENUSELECT_EXTRA_SOUNDS:=$(subst -GSM,-gsm,$(MENUSELECT_EXTRA_SOUNDS))
38 MENUSELECT_EXTRA_SOUNDS:=$(subst -G729,-g729,$(MENUSELECT_EXTRA_SOUNDS))
39 EXTRA_SOUNDS:=$(MENUSELECT_EXTRA_SOUNDS:EXTRA-SOUNDS-%=asterisk-extra-sounds-%.tar.gz)
40 MENUSELECT_MOH:=$(subst -FREEPLAY-,-freeplay-,$(MENUSELECT_MOH))
41 MENUSELECT_MOH:=$(subst -MP3,-mp3,$(MENUSELECT_MOH))
42 MOH:=$(MENUSELECT_MOH:MOH-%=asterisk-moh-%.tar.gz)
43 MOH_TAGS:=$(MENUSELECT_MOH:MOH-%=$(MOH_DIR)/.asterisk-moh-%)
44
45 $(SOUNDS_DIR)/.asterisk-core-sounds-en-%:
46         @PACKAGE=$(subst $(SOUNDS_DIR)/.asterisk,asterisk,$@).tar.gz; \
47         if ! test -f $${PACKAGE}; then wget --no-verbose --continue $(SOUNDS_URL)/$${PACKAGE}; fi; \
48         if ! test -f $${PACKAGE}; then exit 1; fi; \
49         rm -f $(subst -$(CORE_SOUNDS_VERSION),,$@)-* && \
50         (cd $(SOUNDS_DIR); tar xzf $(PWD)/$${PACKAGE}) && \
51         touch $@
52
53 $(SOUNDS_DIR)/.asterisk-core-sounds-fr-%: $(SOUNDS_DIR)/fr
54         @PACKAGE=$(subst $(SOUNDS_DIR)/.asterisk,asterisk,$@).tar.gz; \
55         if ! test -f $${PACKAGE}; then wget --no-verbose --continue $(SOUNDS_URL)/$${PACKAGE}; fi; \
56         if ! test -f $${PACKAGE}; then exit 1; fi; \
57         rm -f $(subst -$(CORE_SOUNDS_VERSION),,$@)-* && \
58         (cd $(SOUNDS_DIR)/fr; tar xzf $(PWD)/$${PACKAGE}) && \
59         touch $@
60
61 $(SOUNDS_DIR)/.asterisk-core-sounds-fr-%: $(SOUNDS_DIR)/es
62         @PACKAGE=$(subst $(SOUNDS_DIR)/.asterisk,asterisk,$@).tar.gz; \
63         if ! test -f $${PACKAGE}; then wget --no-verbose --continue $(SOUNDS_URL)/$${PACKAGE}; fi; \
64         if ! test -f $${PACKAGE}; then exit 1; fi; \
65         rm -f $(subst -$(CORE_SOUNDS_VERSION),,$@)-* && \
66         (cd $(SOUNDS_DIR)/es; tar xzf $(PWD)/$${PACKAGE}) && \
67         touch $@
68
69 $(MOH_DIR)/.asterisk-moh-%:
70         @PACKAGE=$(subst $(MOH_DIR)/.asterisk,asterisk,$@).tar.gz; \
71         if ! test -f $${PACKAGE}; then wget --no-verbose --continue $(SOUNDS_URL)/$${PACKAGE}; fi; \
72         if ! test -f $${PACKAGE}; then exit 1; fi; \
73         (cd $(MOH_DIR); tar xzf $(PWD)/$${PACKAGE}) && \
74         touch $@
75
76 %.tar.gz:
77         @wget --no-verbose --continue $(SOUNDS_URL)/$@
78
79 all:    $(CORE_SOUNDS) $(EXTRA_SOUNDS) $(MOH)
80
81 dist-clean:
82         rm -f *.tar.gz
83
84 $(SOUNDS_DIR) $(MOH_DIR) $(SOUNDS_DIR)/%:
85         mkdir -p $@
86
87 install: $(SOUNDS_DIR) $(MOH_DIR) $(CORE_SOUND_TAGS) $(MOH_TAGS)
88
89 uninstall:
90         rm -rf $(SOUNDS_DIR)
91         rm -rf $(MOH_DIR)