• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2LOCAL_PATH:= $(call my-dir)
3########################################
4
5copy_from :=                     \
6    baseline11k.par              \
7    baseline8k.par               \
8    baseline.par                 \
9    dictionary/basic.ok          \
10    dictionary/enroll.ok         \
11    dictionary/cmu6plus.ok.zip   \
12    g2p/en-US-ttp.data           \
13    models/generic.swiarb        \
14    models/generic11.lda         \
15    models/generic11_f.swimdl    \
16    models/generic11_m.swimdl    \
17    models/generic8.lda          \
18    models/generic8_f.swimdl     \
19    models/generic8_m.swimdl     \
20
21copy_to := $(addprefix $(TARGET_OUT)/usr/srec/config/en.us/,$(copy_from))
22
23$(copy_to) : $(TARGET_OUT)/usr/srec/config/en.us/% : $(LOCAL_PATH)/% | $(ACP)
24	$(transform-prebuilt-to-target)
25
26# ALL_PREBUILT is deprecated. Moved to config.mk
27# ALL_PREBUILT += $(copy_to)
28
29
30# define paths to some grammar tools
31GRXML=$(HOST_OUT_EXECUTABLES)/grxmlcompile
32MAKE_G2G=$(HOST_OUT_EXECUTABLES)/make_g2g
33DEFAULT_PAR=$(ASR_ROOT_DIR)/config/en.us/baseline11k.par
34G2G_INSTALL_PATH=$(TARGET_OUT)/usr/srec/config/en.us/grammars
35
36srec_grammars : \
37	$(G2G_INSTALL_PATH)/enroll.g2g \
38	$(G2G_INSTALL_PATH)/bothtags5.g2g \
39	$(G2G_INSTALL_PATH)/dynamic-test.g2g \
40	$(G2G_INSTALL_PATH)/digits.g2g \
41	$(G2G_INSTALL_PATH)/boolean.g2g \
42	$(G2G_INSTALL_PATH)/homonym_test1.g2g \
43	$(G2G_INSTALL_PATH)/homonym_test2.g2g \
44	$(G2G_INSTALL_PATH)/homonym_test3.g2g \
45	$(G2G_INSTALL_PATH)/homonym_test4.g2g \
46	$(G2G_INSTALL_PATH)/ipaq_commands.g2g \
47	$(G2G_INSTALL_PATH)/lookup.g2g \
48
49# ALL_PREBUILT is deprecated. Moved to config.mk
50# ALL_PREBUILT += $(G2G_INSTALL_PATH)/VoiceDialer.g2g \
51#	$(G2G_INSTALL_PATH)/boolean.g2g \
52#	$(G2G_INSTALL_PATH)/phone_type_choice.g2g
53
54#---------------------------------------------------------------------------------
55# Explicit rules.
56# Those without explicit rules are subject to the rule at the end of this makefile
57#---------------------------------------------------------------------------------
58
59# This needs an explicit rule to specify the vocabulary (dictionary)
60$(G2G_INSTALL_PATH)/enroll.g2g: $(LOCAL_PATH)/grammars/enroll.grxml $(GRXML) $(MAKE_G2G) $(DEFAULT_PAR) $(LOCAL_PATH)/dictionary/enroll.ok
61	mkdir -p $(G2G_INSTALL_PATH)
62	$(GRXML) -par $(DEFAULT_PAR) -grxml $< -vocab dictionary/enroll.ok -outdir $(G2G_INSTALL_PATH)
63	$(MAKE_G2G) -base $(G2G_INSTALL_PATH)/enroll,addWords=0 -out $@
64	(cd $(G2G_INSTALL_PATH); rm -f $*.Grev2.det.txt $*.map $*.omap $*.P.txt $*.params $*.PCLG.txt $*.script)
65
66
67#---------------------------------------------------------------------------------
68# Those without explicit rules are subject to the rule below
69#---------------------------------------------------------------------------------
70
71$(G2G_INSTALL_PATH)/%.g2g: $(LOCAL_PATH)/grammars/%.grxml $(GRXML) $(MAKE_G2G) $(DEFAULT_PAR) $(LOCAL_PATH)/dictionary/cmu6plus.ok.zip
72	mkdir -p $(G2G_INSTALL_PATH)
73	$(GRXML) -par $(DEFAULT_PAR) -grxml $< -outdir $(G2G_INSTALL_PATH)
74	$(MAKE_G2G) -base $(G2G_INSTALL_PATH)/$*,addWords=0 -out $@
75	(cd $(G2G_INSTALL_PATH); rm -f $*.Grev2.det.txt $*.map $*.omap $*.P.txt $*.params $*.PCLG.txt $*.script)
76
77#-----------------------------------------------------------------
78# this rule generates cmu6plus.ok.zip, which is built manually and checked in.
79# the grxml compiler expects this (and other) data files to be here.
80# $ g4 edit external/srec/config/en.us/dictionary/cmu6plus.ok.zip
81# $ make cmu6plus.ok.zip
82#
83# To make the resulting zip as small as possible, install advzip from
84# the advancecomp suite of compression utilities.  (On ubuntu,
85# "apt-get install advancecomp".)  It makes the output about 10% smaller.
86# This make rule will fall back to 'zip' if 'advzip' is not
87# available.
88#-----------------------------------------------------------------
89
90CMU2NUANCE=$(HOST_OUT_EXECUTABLES)/cmu2nuance
91DICT_DIR=$(ASR_ROOT_DIR)/config/en.us/dictionary
92
93cmu6plus.ok.zip: $(CMU2NUANCE) $(DICT_DIR)/c0.6 $(DICT_DIR)/numbers.ok $(DICT_DIR)/fixit.ok $(DICT_DIR)/enroll.ok
94	$(CMU2NUANCE) < $(DICT_DIR)/c0.6 > $(DICT_DIR)/c0.6.ok
95	sort -u $(DICT_DIR)/c0.6.ok $(DICT_DIR)/numbers.ok $(DICT_DIR)/fixit.ok $(DICT_DIR)/enroll.ok > $(DICT_DIR)/cmu6plus.ok
96	$(hide) (cd $(DICT_DIR)/ && advzip -a -4 cmu6plus.ok.zip cmu6plus.ok || \
97	 (zip cmu6plus.ok.zip cmu6plus.ok && \
98          echo -e "\n+++ advzip not installed; fell back to zip\n    cmu6plus.ok.zip (`du -h cmu6plus.ok.zip | cut -f 1`) could be ~10% smaller with advzip\n"))
99
100
101#-----------------------------------------------------------------
102# build cmu2nuance dictionary conversion program, to prevent bitrot
103#-----------------------------------------------------------------
104include $(CLEAR_VARS)
105LOCAL_SRC_FILES := dictionary/cmu2nuance.cpp
106LOCAL_MODULE := cmu2nuance
107LOCAL_MODULE_TAGS := optional
108LOCAL_32_BIT_ONLY := true
109
110include $(BUILD_HOST_EXECUTABLE)
111