Makefile 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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. .PHONY: dist-clean all uninstall have_download install
  14. -include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/makeopts
  15. PWD:=$(shell pwd)
  16. SOUNDS_DIR:=$(DESTDIR)$(ASTDATADIR)/sounds
  17. MOH_DIR:=$(DESTDIR)$(ASTDATADIR)/moh
  18. CORE_SOUNDS_VERSION:=1.4.20
  19. EXTRA_SOUNDS_VERSION:=1.4.11
  20. MOH_VERSION:=2.03
  21. SOUNDS_URL:=http://downloads.asterisk.org/pub/telephony/sounds/releases
  22. MCS:=$(subst -EN-,-en-,$(MENUSELECT_CORE_SOUNDS))
  23. MCS:=$(subst -EN_AU-,-en_AU-,$(MCS))
  24. MCS:=$(subst -FR-,-fr-,$(MCS))
  25. MCS:=$(subst -ES-,-es-,$(MCS))
  26. MCS:=$(subst -WAV,-wav,$(MCS))
  27. MCS:=$(subst -ULAW,-ulaw,$(MCS))
  28. MCS:=$(subst -ALAW,-alaw,$(MCS))
  29. MCS:=$(subst -GSM,-gsm,$(MCS))
  30. MCS:=$(subst -G729,-g729,$(MCS))
  31. MCS:=$(subst -G722,-g722,$(MCS))
  32. CORE_SOUNDS:=$(MCS:CORE-SOUNDS-%=asterisk-core-sounds-%-$(CORE_SOUNDS_VERSION).tar.gz)
  33. CORE_SOUND_TAGS:=$(MCS:CORE-SOUNDS-%=$(SOUNDS_DIR)/.asterisk-core-sounds-%-$(CORE_SOUNDS_VERSION))
  34. MES:=$(subst -EN-,-en-,$(MENUSELECT_EXTRA_SOUNDS))
  35. MES:=$(subst -FR-,-fr-,$(MES))
  36. MES:=$(subst -ES-,-es-,$(MES))
  37. MES:=$(subst -WAV,-wav,$(MES))
  38. MES:=$(subst -ULAW,-ulaw,$(MES))
  39. MES:=$(subst -ALAW,-alaw,$(MES))
  40. MES:=$(subst -GSM,-gsm,$(MES))
  41. MES:=$(subst -G729,-g729,$(MES))
  42. MES:=$(subst -G722,-g722,$(MES))
  43. EXTRA_SOUNDS:=$(MES:EXTRA-SOUNDS-%=asterisk-extra-sounds-%-$(EXTRA_SOUNDS_VERSION).tar.gz)
  44. EXTRA_SOUND_TAGS:=$(MES:EXTRA-SOUNDS-%=$(SOUNDS_DIR)/.asterisk-extra-sounds-%-$(EXTRA_SOUNDS_VERSION))
  45. MM:=$(subst -OPSOUND-,-opsound-,$(MENUSELECT_MOH))
  46. MM:=$(subst -WAV,-wav,$(MM))
  47. MM:=$(subst -ULAW,-ulaw,$(MM))
  48. MM:=$(subst -ALAW,-alaw,$(MM))
  49. MM:=$(subst -GSM,-gsm,$(MM))
  50. MM:=$(subst -G729,-g729,$(MM))
  51. MM:=$(subst -G722,-g722,$(MM))
  52. MOH:=$(MM:MOH-%=asterisk-moh-%-$(MOH_VERSION).tar.gz)
  53. MOH_TAGS:=$(MM:MOH-%=$(MOH_DIR)/.asterisk-moh-%-$(MOH_VERSION))
  54. # If "fetch" is used, --continue is not a valid option.
  55. ifneq ($(findstring wget,$(WGET)),)
  56. WGET_ARGS:=--continue $(WGET_EXTRA_ARGS)
  57. endif
  58. all: $(CORE_SOUNDS) $(EXTRA_SOUNDS) $(MOH)
  59. have_download:
  60. @if test "$(DOWNLOAD)" = ":" ; then \
  61. echo "**************************************************"; \
  62. echo "*** ***"; \
  63. echo "*** You must have either wget or fetch to be ***"; \
  64. echo "*** able to automatically download and install ***"; \
  65. echo "*** the requested sound packages. ***"; \
  66. echo "*** ***"; \
  67. echo "*** Please install one of these, or remove any ***"; \
  68. echo "*** extra sound package selections in ***"; \
  69. echo "*** menuselect before installing Asterisk. ***"; \
  70. echo "*** ***"; \
  71. echo "**************************************************"; \
  72. exit 1; \
  73. fi
  74. $(SOUNDS_DIR)/.asterisk-core-sounds-en-%: have_download
  75. @PACKAGE=$(subst $(SOUNDS_DIR)/.asterisk,asterisk,$@).tar.gz; \
  76. if test ! -f $${PACKAGE}; then $(DOWNLOAD) $(WGET_ARGS) $(SOUNDS_URL)/$${PACKAGE}; fi; \
  77. if test ! -f $${PACKAGE}; then exit 1; fi; \
  78. rm -f $(subst -$(CORE_SOUNDS_VERSION),,$@)-* && \
  79. (cd $(SOUNDS_DIR); cat $(PWD)/$${PACKAGE} | gzip -d | tar xof -) && \
  80. touch $@
  81. $(SOUNDS_DIR)/.asterisk-core-sounds-en_AU-%: have_download
  82. @PACKAGE=$(subst $(SOUNDS_DIR)/.asterisk,asterisk,$@).tar.gz; \
  83. if test ! -f $${PACKAGE}; then $(DOWNLOAD) $(WGET_ARGS) $(SOUNDS_URL)/$${PACKAGE}; fi; \
  84. if test ! -f $${PACKAGE}; then exit 1; fi; \
  85. rm -f $(subst -$(CORE_SOUNDS_VERSION),,$@)-* && \
  86. (cd $(SOUNDS_DIR)/en_AU; cat $(PWD)/$${PACKAGE} | gzip -d | tar xof -) && \
  87. touch $@
  88. $(SOUNDS_DIR)/.asterisk-core-sounds-es-%: have_download
  89. @PACKAGE=$(subst $(SOUNDS_DIR)/.asterisk,asterisk,$@).tar.gz; \
  90. if test ! -f $${PACKAGE}; then $(DOWNLOAD) $(WGET_ARGS) $(SOUNDS_URL)/$${PACKAGE}; fi; \
  91. if test ! -f $${PACKAGE}; then exit 1; fi; \
  92. rm -f $(subst -$(CORE_SOUNDS_VERSION),,$@)-* && \
  93. (cd $(SOUNDS_DIR)/es; cat $(PWD)/$${PACKAGE} | gzip -d | tar xof -) && \
  94. touch $@
  95. $(SOUNDS_DIR)/.asterisk-core-sounds-fr-%: have_download
  96. @PACKAGE=$(subst $(SOUNDS_DIR)/.asterisk,asterisk,$@).tar.gz; \
  97. if test ! -f $${PACKAGE}; then $(DOWNLOAD) $(WGET_ARGS) $(SOUNDS_URL)/$${PACKAGE}; fi; \
  98. if test ! -f $${PACKAGE}; then exit 1; fi; \
  99. rm -f $(subst -$(CORE_SOUNDS_VERSION),,$@)-* && \
  100. (cd $(SOUNDS_DIR)/fr; cat $(PWD)/$${PACKAGE} | gzip -d | tar xof -) && \
  101. touch $@
  102. $(SOUNDS_DIR)/.asterisk-extra-sounds-en-%: have_download
  103. @PACKAGE=$(subst $(SOUNDS_DIR)/.asterisk,asterisk,$@).tar.gz; \
  104. if test ! -f $${PACKAGE}; then $(DOWNLOAD) $(WGET_ARGS) $(SOUNDS_URL)/$${PACKAGE}; fi; \
  105. if test ! -f $${PACKAGE}; then exit 1; fi; \
  106. rm -f $(subst -$(EXTRA_SOUNDS_VERSION),,$@)-* && \
  107. (cd $(SOUNDS_DIR); cat $(PWD)/$${PACKAGE} | gzip -d | tar xof -) && \
  108. touch $@
  109. $(SOUNDS_DIR)/.asterisk-extra-sounds-es-%: have_download
  110. @PACKAGE=$(subst $(SOUNDS_DIR)/.asterisk,asterisk,$@).tar.gz; \
  111. if test ! -f $${PACKAGE}; then $(DOWNLOAD) $(WGET_ARGS) $(SOUNDS_URL)/$${PACKAGE}; fi; \
  112. if test ! -f $${PACKAGE}; then exit 1; fi; \
  113. rm -f $(subst -$(EXTRA_SOUNDS_VERSION),,$@)-* && \
  114. (cd $(SOUNDS_DIR)/es; cat $(PWD)/$${PACKAGE} | gzip -d | tar xof -) && \
  115. touch $@
  116. $(SOUNDS_DIR)/.asterisk-extra-sounds-fr-%: have_download
  117. @PACKAGE=$(subst $(SOUNDS_DIR)/.asterisk,asterisk,$@).tar.gz; \
  118. if test ! -f $${PACKAGE}; then $(DOWNLOAD) $(WGET_ARGS) $(SOUNDS_URL)/$${PACKAGE}; fi; \
  119. if test ! -f $${PACKAGE}; then exit 1; fi; \
  120. rm -f $(subst -$(EXTRA_SOUNDS_VERSION),,$@)-* && \
  121. (cd $(SOUNDS_DIR)/fr; cat $(PWD)/$${PACKAGE} | gzip -d | tar xof -) && \
  122. touch $@
  123. $(MOH_DIR)/.asterisk-moh-%: have_download
  124. @PACKAGE=$(subst $(MOH_DIR)/.asterisk,asterisk,$@).tar.gz; \
  125. if test ! -f $${PACKAGE}; then $(DOWNLOAD) $(WGET_ARGS) $(SOUNDS_URL)/$${PACKAGE}; fi; \
  126. if test ! -f $${PACKAGE}; then exit 1; fi; \
  127. rm -f $(subst -$(MOH_VERSION),,$@)-* && \
  128. (cd $(MOH_DIR); cat $(PWD)/$${PACKAGE} | gzip -d | tar xof -) && \
  129. touch $@
  130. asterisk-core-%.tar.gz: have_download
  131. @if test ! -f $@ ;then $(DOWNLOAD) $(WGET_ARGS) $(SOUNDS_URL)/$@;fi
  132. asterisk-extra-%.tar.gz: have_download
  133. @if test ! -f $@ ;then $(DOWNLOAD) $(WGET_ARGS) $(SOUNDS_URL)/$@;fi
  134. asterisk-moh-%.tar.gz: have_download
  135. @if test ! -f $@ ;then $(DOWNLOAD) $(WGET_ARGS) $(SOUNDS_URL)/$@;fi
  136. dist-clean:
  137. rm -f *.tar.gz
  138. $(SOUNDS_DIR) $(MOH_DIR) $(SOUNDS_DIR)/en_AU $(SOUNDS_DIR)/es $(SOUNDS_DIR)/fr:
  139. mkdir -p $@
  140. install: $(SOUNDS_DIR) $(SOUNDS_DIR)/en_AU $(SOUNDS_DIR)/es $(SOUNDS_DIR)/fr $(MOH_DIR) $(CORE_SOUND_TAGS) $(EXTRA_SOUND_TAGS) $(MOH_TAGS)
  141. uninstall:
  142. rm -rf $(SOUNDS_DIR)
  143. rm -rf $(MOH_DIR)
  144. core_sounds_version:
  145. @echo $(CORE_SOUNDS_VERSION)
  146. extra_sounds_version:
  147. @echo $(EXTRA_SOUNDS_VERSION)
  148. moh_version:
  149. @echo $(MOH_VERSION)