Allow libpinyin to build in cross compile mode.
[platform/upstream/libpinyin.git] / data / Makefile.am
1 ## Makefile.am -- Process this file with automake to produce Makefile.in
2 ## Copyright (C) 2011 Peng Wu
3 ##
4 ## This program is free software; you can redistribute it and/or modify
5 ## it under the terms of the GNU General Public License as published by
6 ## the Free Software Foundation; either version 2, or (at your option)
7 ## any later version.
8 ##
9 ## This program is distributed in the hope that it will be useful,
10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 ## GNU General Public License for more details.
13 ##
14 ## You should have received a copy of the GNU General Public License
15 ## along with this program; if not, write to the Free Software
16 ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17
18
19 tablefiles              = gb_char.table gbk_char.table \
20                                 merged.table \
21                                 art.table culture.table economy.table \
22                                 geology.table history.table life.table \
23                                 nature.table scitech.table \
24                                 society.table sport.table
25
26 binfiles                = ${tablefiles:.table=.bin}
27
28
29 textual_model_data      = interpolation2.text \
30                                 $(tablefiles)
31
32
33 binary_model_data       = phrase_index.bin pinyin_index.bin \
34                                 bigram.db \
35                                 $(binfiles)
36
37
38 MAINTAINERCLEANFILES    = Makefile.in
39
40 EXTRA_DIST              = $(textual_model_data) \
41                           table.conf
42
43 libpinyin_db_DATA       = $(binary_model_data) \
44                           table.conf
45
46 libpinyin_dbdir         = $(libdir)/libpinyin/data
47
48 CLEANFILES              = $(binary_model_data)
49
50 utils_storage           = ../utils/storage
51 utils_training          = ../utils/training
52
53 interpolation2.text:
54         wget http://downloads.sourceforge.net/libpinyin/models/model7.text.tar.gz
55         tar xvf model7.text.tar.gz -C $(top_srcdir)/data
56
57
58 $(tablefiles): interpolation2.text
59
60 bigram.db: $(textual_model_data)
61         $(RM) $(binary_model_data)
62         $(utils_storage)/gen_binary_files --table-dir $(top_srcdir)/data
63         $(utils_storage)/import_interpolation --table-dir $(top_srcdir)/data < $(top_srcdir)/data/interpolation2.text
64         $(utils_training)/gen_unigram --table-dir $(top_srcdir)/data
65
66 phrase_index.bin pinyin_index.bin $(binfiles): bigram.db
67
68 modify:
69         git reset --hard
70         sed -i -r -e "s'lambda parameter:0\\.[0-9]{3,6}'lambda parameter:$(LAMBDA_PARAMETER)'" table.conf