clean db
[platform/upstream/ibus-libpinyin.git] / src / Makefile.am
1 # vim:set noet ts=4:
2 #
3 # ibus-pinyin - The Chinese PinYin engine for IBus
4 #
5 # Copyright (c) 2008-2010 Peng Huang <shawn.p.huang@gmail.com>
6 #
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2, or (at your option)
10 # any later version.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
21 # @MAINTAINER_MODE_FALSE@skip_gentable=test -f $@ ||
22
23 # AM_CFLAGS = \
24 #       @IBUS_CFLAGS@ \
25 #       @SQLITE_CFLAGS@ \
26 #       -DPKGDATADIR=\"$(pkgdatadir)\" \
27 #       $(NULL)
28 # AM_CXXFLAGS = $(AM_CFLAGS)
29 # AM_LDADD = \
30 #       @IBUS_LIBS@ \
31 #       @SQLITE_LIBS@ \
32 #       $(NULL)
33
34
35 libexec_PROGRAMS = ibus-engine-libpinyin
36 ibus_engine_libpinyin_built_c_sources = \
37         $(NULL)
38 ibus_engine_libpinyin_built_h_sources = \
39         PYPunctTable.h \
40         PYSimpTradConverterTable.h \
41         $(NULL)
42 ibus_engine_libpinyin_c_sources = \
43         PYConfig.cc \
44         PYEditor.cc \
45         PYEngine.cc \
46         PYFallbackEditor.cc \
47         PYHalfFullConverter.cc \
48         PYMain.cc \
49         PYPinyinProperties.cc \
50         PYPunctEditor.cc \
51         PYSimpTradConverter.cc \
52         PYDynamicSpecialPhrase.cc \
53         PYSpecialPhrase.cc \
54         PYSpecialPhraseTable.cc \
55         $(NULL)
56 ibus_engine_libpinyin_h_sources = \
57         PYBus.h \
58         PYConfig.h \
59         PYEditor.h \
60         PYEngine.h \
61         PYExtEditor.h \
62         PYFallbackEditor.h \
63         PYHalfFullConverter.h \
64         PYLookupTable.h \
65         PYObject.h \
66         PYPinyinProperties.h \
67         PYPointer.h \
68         PYProperty.h \
69         PYPunctEditor.h \
70         PYRawEditor.h \
71         PYRegex.h \
72         PYSignal.h \
73         PYSimpTradConverter.h \
74         PYSpecialPhrase.h \
75         PYDynamicSpecialPhrase.h \
76         PYSpecialPhraseTable.h \
77         PYString.h \
78         PYText.h \
79         PYTypes.h \
80         PYUtil.h \
81         PYEnglishEditor.h \
82         PYLibPinyin.h \
83         PYPPhoneticEditor.h \
84         PYPPinyinEditor.h \
85         PYPFullPinyinEditor.h \
86         PYPDoublePinyinEditor.h \
87         PYPBopomofoEditor.h \
88         PYPPinyinEngine.h \
89         PYPBopomofoEngine.h \
90         PYPConfig.h \
91         $(NULL)
92
93 if IBUS_BUILD_LIBPINYIN
94 ibus_engine_libpinyin_c_sources += \
95         PYPConfig.cc \
96         PYLibPinyin.cc \
97         PYPPhoneticEditor.cc \
98         PYPPinyinEditor.cc \
99         PYPFullPinyinEditor.cc \
100         PYPDoublePinyinEditor.cc \
101         PYPBopomofoEditor.cc \
102         PYPPinyinEngine.cc \
103         PYPBopomofoEngine.cc \
104         $(NULL)
105 endif
106
107
108 if IBUS_BUILD_LUA_EXTENSION
109 ibus_engine_libpinyin_c_sources += PYExtEditor.cc
110 endif
111
112 if IBUS_BUILD_ENGLISH_INPUT_MODE
113 ibus_engine_libpinyin_c_sources += PYEnglishEditor.cc
114 endif
115
116 ibus_engine_libpinyin_SOURCES = \
117         $(ibus_engine_libpinyin_c_sources) \
118         $(ibus_engine_libpinyin_h_sources) \
119         $(ibus_engine_libpinyin_built_c_sources) \
120         $(ibus_engine_libpinyin_built_h_sources) \
121         $(NULL)
122
123
124 ibus_engine_libpinyin_CXXFLAGS = \
125         @IBUS_CFLAGS@ \
126         @SQLITE_CFLAGS@ \
127         @LIBPINYIN_CFLAGS@ \
128         @OPENCC_CFLAGS@ \
129         -DGETTEXT_PACKAGE=\"@GETTEXT_PACKAGE@\" \
130         -DPKGDATADIR=\"$(pkgdatadir)\" \
131         -DLIBEXECDIR=\"$(libexecdir)\" \
132         $(NULL)
133
134 if HAVE_BOOST
135 ibus_engine_libpinyin_CXXFLAGS += \
136         @BOOST_CPPFLAGS@ \
137         $(NULL)
138 else
139 ibus_engine_libpinyin_CXXFLAGS += \
140         -std=c++0x \
141         $(NULL)
142 endif
143
144 ibus_engine_libpinyin_LDADD = \
145         @IBUS_LIBS@ \
146         @SQLITE_LIBS@ \
147         @LIBPINYIN_LIBS@ \
148         @OPENCC_LIBS@ \
149         $(NULL)
150
151 if HAVE_LIBUUID
152 ibus_engine_libpinyin_CXXFLAGS += $(LIBUUID_CFLAGS)
153 ibus_engine_libpinyin_LDADD += $(LIBUUID_LIBS)
154 endif
155
156 if IBUS_BUILD_LIBPINYIN
157    ibus_engine_libpinyin_CXXFLAGS += -DIBUS_BUILD_LIBPINYIN
158 endif
159
160 if IBUS_BUILD_LUA_EXTENSION
161     ibus_engine_libpinyin_CXXFLAGS +=  \
162         @LUA_CFLAGS@ \
163         -DIBUS_BUILD_LUA_EXTENSION \
164         -I$(top_srcdir)/lua/ \
165         $(NULL)
166 endif
167
168 if IBUS_BUILD_LUA_EXTENSION
169     ibus_engine_libpinyin_LDADD += \
170         @LUA_LIBS@ \
171         -L../lua/ \
172         -lpylua \
173         $(NULL)
174 endif
175
176 if IBUS_BUILD_ENGLISH_INPUT_MODE
177    ibus_engine_libpinyin_CXXFLAGS += \
178         -DIBUS_BUILD_ENGLISH_INPUT_MODE \
179         $(NULL)
180 endif
181
182 BUILT_SOURCES = \
183         $(ibus_engine_built_c_sources) \
184         $(ibus_engine_built_h_sources) \
185         $(NULL)
186
187 pkgdata_DATA = \
188         phrases.txt \
189         $(NULL)
190
191 component_DATA = \
192         libpinyin.xml \
193         $(NULL)
194 componentdir = @datadir@/ibus/component
195
196 EXTRA_DIST = \
197         libpinyin.xml.in \
198         phrases.txt \
199         $(NULL)
200
201 CLEANFILES = \
202         libpinyin.xml \
203         ZhConversion.* \
204         $(NULL)
205
206 PYPunctTable.h:
207         $(AM_V_GEN) \
208         $(PYTHON) $(top_srcdir)/scripts/genpuncttable.py > $@ || \
209                 ( $(RM) $@; exit 1 )
210
211 PYSimpTradConverterTable.h:
212         $(AM_V_GEN) \
213         $(PYTHON) $(top_srcdir)/scripts/update-simptrad-table.py > $@ || \
214                 ( $(RM) $@; exit 1 )
215
216 update-simptrad-table:
217         $(RM) ZhConversion.php ZhConversion.py PYSimpTradConverterTable.h
218         $(MAKE) ZhConversion.php
219         $(MAKE) ZhConversion.py
220         $(MAKE) PYSimpTradConverterTable.h
221
222 libpinyin.xml: libpinyin.xml.in
223         $(AM_V_GEN) \
224         ( \
225                 libexecdir=${libexecdir}; \
226                 pkgdatadir=${pkgdatadir}; \
227                 s=`cat $<`; \
228                 eval "echo \"$${s}\""; \
229         ) > $@
230
231 test: ibus-engine-libpinyin
232         $(ENV) \
233                 G_DEBUG=fatal_criticals \
234                 $(builddir)/ibus-engine-libpinyin
235
236 # test: ibus-engine-pinyin
237 #       $(ENV) G_DEBUG=fatal_warnings \
238 #       $(builddir)/ibus-engine-pinyin
239 ZhConversion.php:
240         $(AM_V_GEN) \
241         svn cat http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3/includes/ZhConversion.php > $@ || \
242                 ( $(RM) $@; exit 1 )
243
244 ZhConversion.py: ZhConversion.php
245         $(AM_V_GEN) \
246         php $(top_srcdir)/scripts/php_2_py.php > $@ || \
247                 ( $(RM) $@; exit 1 )
248