eSpeak NG is an open source speech synthesizer that supports more than hundred languages and accents.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Makefile 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. #
  2. # Copyright (C) 2014-2016 Eitan Isaacson
  3. # Copyright (C) 2016 Alberto Pettarin
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 3 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, see: <http://www.gnu.org/licenses/>.
  17. #
  18. # NOTE: variables specific to espeak-ng + emscripten starts with "EM_"
  19. # NOTE: set to 1 to debug or to speed emscripten up while developing.
  20. # If the EM_DEBUG environment variable is set,
  21. # the value specified here will be ignored.
  22. EM_DEBUG ?= 0
  23. ifneq ($(EM_DEBUG), 1)
  24. CXXFLAGS+=-O3
  25. endif
  26. ###############################################################################
  27. # WARNING: modify code below this line at your own risk!
  28. ###############################################################################
  29. # NOTE: sanity check
  30. ifndef EMSCRIPTEN
  31. $(error EMSCRIPTEN var not set. You must use emmake to run this Makefile!)
  32. endif
  33. # NOTE: in the emscripten virtual FS,
  34. # this is the location of the eSpeak-ng data files,
  35. # if we configure with "./configure --prefix=/usr"
  36. EM_VIRTUAL_PATH_ESPEAKNG_DATA=/usr/share/espeak-ng-data
  37. # NOTE: emmake will replace EMSCRIPTEN with the actual root directory
  38. # of the emscripten tools inside the emscripten SDK directory
  39. EM_WEBIDL_BINDER=python $(EMSCRIPTEN)/tools/webidl_binder.py
  40. EM_FILE_PACKAGER=python $(EMSCRIPTEN)/tools/file_packager.py
  41. # NOTE: libespeak-ng.so compiled to LLVM IR code
  42. EM_LIBESPEAKNG_SO=../src/.libs/libespeak-ng.so
  43. # NOTE: glue code files
  44. EM_GLUE_PREFIX=glue
  45. EM_GLUE_IDL=espeakng_glue.idl
  46. EM_GLUE_OBJ=espeakng_glue.o
  47. EM_GLUE_CPP=espeakng_glue.cpp
  48. EM_GLUE_AUTOGEN_CPP=glue.cpp
  49. EM_GLUE_AUTOGEN_JS=glue.js
  50. # NOTE: preload espeak-ng-data directory...
  51. EM_DATA_DIR=../espeak-ng-data
  52. # NOTE: ... but exclude these subdirectories/files
  53. EM_EXCLUDE_DATA=../espeak-ng-data/mbrola_ph ../espeak-ng-data/phondata-manifest
  54. # NOTE: pre/post JS files
  55. EM_PRE_JS=pre.js
  56. EM_POST_JS=post.js
  57. # NOTE: output files
  58. EM_ESPEAKNG_DATA_PACKAGE_JS=espeakng_data_package.js
  59. EM_WORKER_DATA=js/espeakng.worker.data
  60. EM_WORKER_JS=js/espeakng.worker.js
  61. EM_PTHREAD_MAIN_JS=js/pthread-main.js
  62. # NOTE: intermediate objects
  63. EM_OBJS=$(EM_GLUE_OBJ) $(EM_LIBESPEAKNG_SO)
  64. EM_ALL_PRE_JS=$(EM_PRE_JS) $(EM_ESPEAKNG_DATA_PACKAGE_JS)
  65. EM_ALL_POST_JS=$(EM_GLUE_AUTOGEN_JS) $(EM_POST_JS)
  66. # NOTE: compile without async, i.e. with synchronous output
  67. #
  68. # ./emconfigure ./configure --prefix=/usr --without-async
  69. # ./emmake make
  70. CXXFLAGS+=-DESPEAK_DATA_PATH=\"$(EM_VIRTUAL_PATH_ESPEAKNG_DATA)\"
  71. CXXFLAGS+=-I ./ -I ../ -I ../src/include/espeak-ng
  72. # NOTE: so far, pthread is not supported in any browser
  73. # except Firefox Nightly.
  74. # If we want to enable pthread in the future,
  75. # we must append "-s USE_PTHREADS=1" to CXXFLAGS
  76. # and pass that to emconfigure and emmake.
  77. # If enabled, js/pthread-main.js will be created as well.
  78. #
  79. #CXXFLAGS+=-s USE_PTHREADS=1
  80. # NOTE: extra flags for emscripten
  81. EM_CXXFLAGS=-s RESERVED_FUNCTION_POINTERS=2 --memory-init-file 0
  82. ###############################################################################
  83. # NOTE: actual targets
  84. ###############################################################################
  85. all: $(EM_WORKER_JS)
  86. $(EM_WORKER_DATA):
  87. $(EM_FILE_PACKAGER) $@ \
  88. --js-output=$(EM_ESPEAKNG_DATA_PACKAGE_JS) \
  89. --preload $(EM_DATA_DIR)@$(EM_VIRTUAL_PATH_ESPEAKNG_DATA) \
  90. $(patsubst %,--exclude %,$(EM_EXCLUDE_DATA))
  91. $(EM_ESPEAKNG_DATA_PACKAGE_JS): $(EM_WORKER_DATA)
  92. $(EM_GLUE_AUTOGEN_CPP): $(EM_GLUE_IDL)
  93. $(EM_WEBIDL_BINDER) $(EM_GLUE_IDL) $(EM_GLUE_PREFIX)
  94. $(EM_GLUE_AUTOGEN_JS): $(EM_GLUE_AUTOGEN_CPP)
  95. $(EM_GLUE_OBJ): $(EM_GLUE_CPP)
  96. $(EM_WORKER_JS): $(EM_GLUE_AUTOGEN_CPP) $(EM_OBJS) $(EM_ALL_PRE_JS) $(EM_ALL_POST_JS)
  97. $(CXX) $(CXXFLAGS) \
  98. $(EM_CXXFLAGS) \
  99. $(EM_OBJS) \
  100. $(patsubst %,--pre-js %,$(EM_ALL_PRE_JS)) \
  101. $(patsubst %,--post-js %,$(EM_ALL_POST_JS)) \
  102. -o $@
  103. clean-intermediate:
  104. rm -f *.o *.out *.pkl $(EM_GLUE_AUTOGEN_CPP) $(EM_GLUE_AUTOGEN_JS) $(EM_ESPEAKNG_DATA_PACKAGE_JS)
  105. clean: clean-intermediate
  106. rm -f $(EM_WORKER_DATA) $(EM_WORKER_JS) $(EM_PTHREAD_MAIN_JS)
  107. help:
  108. echo "Available targets: all clean clean-intermediate help"