fixes compile
[platform/upstream/ibus-libpinyin.git] / src / Makefile.am
1 # vim:set noet ts=4:
2 #
3 # ibus-libpinyin - Intelligent Pinyin engine based on libpinyin 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 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         $(NULL)
53 ibus_engine_libpinyin_h_sources = \
54         PYBus.h \
55         PYConfig.h \
56         PYEditor.h \
57         PYEngine.h \
58         PYExtEditor.h \
59         PYFallbackEditor.h \
60         PYHalfFullConverter.h \
61         PYLookupTable.h \
62         PYObject.h \
63         PYPinyinProperties.h \
64         PYPointer.h \
65         PYProperty.h \
66         PYPunctEditor.h \
67         PYRawEditor.h \
68         PYRegex.h \
69         PYSignal.h \
70         PYSimpTradConverter.h \
71         PYString.h \
72         PYText.h \
73         PYTypes.h \
74         PYUtil.h \
75         PYStrokeEditor.h \
76         PYEnglishEditor.h \
77         PYLibPinyin.h \
78         PYPPhoneticEditor.h \
79         PYPPinyinEditor.h \
80         PYPFullPinyinEditor.h \
81         PYPDoublePinyinEditor.h \
82         PYPBopomofoEditor.h \
83         PYPPinyinEngine.h \
84         PYPBopomofoEngine.h \
85         PYPConfig.h \
86         $(NULL)
87
88 if IBUS_BUILD_LIBPINYIN
89 ibus_engine_libpinyin_c_sources += \
90         PYPConfig.cc \
91         PYLibPinyin.cc \
92         PYPPhoneticEditor.cc \
93         PYPPinyinEditor.cc \
94         PYPFullPinyinEditor.cc \
95         PYPDoublePinyinEditor.cc \
96         PYPBopomofoEditor.cc \
97         PYPPinyinEngine.cc \
98         PYPBopomofoEngine.cc \
99         $(NULL)
100 endif
101
102
103 if IBUS_BUILD_LUA_EXTENSION
104 ibus_engine_libpinyin_c_sources += PYExtEditor.cc
105 endif
106
107 if IBUS_BUILD_STROKE_INPUT_MODE
108 ibus_engine_libpinyin_c_sources += PYStrokeEditor.cc
109 endif
110
111 if IBUS_BUILD_ENGLISH_INPUT_MODE
112 ibus_engine_libpinyin_c_sources += PYEnglishEditor.cc
113 endif
114
115 ibus_engine_libpinyin_SOURCES = \
116         $(ibus_engine_libpinyin_c_sources) \
117         $(ibus_engine_libpinyin_h_sources) \
118         $(ibus_engine_libpinyin_built_c_sources) \
119         $(ibus_engine_libpinyin_built_h_sources) \
120         $(NULL)
121
122
123 ibus_engine_libpinyin_CXXFLAGS = \
124         @IBUS_CFLAGS@ \
125         @SQLITE_CFLAGS@ \
126         @LIBPINYIN_CFLAGS@ \
127         @OPENCC_CFLAGS@ \
128         -DGETTEXT_PACKAGE=\"@GETTEXT_PACKAGE@\" \
129         -DPKGDATADIR=\"$(pkgdatadir)\" \
130         -DLIBEXECDIR=\"$(libexecdir)\" \
131         $(NULL)
132
133 if HAVE_BOOST
134 ibus_engine_libpinyin_CXXFLAGS += \
135         @BOOST_CPPFLAGS@ \
136         $(NULL)
137 else
138 ibus_engine_libpinyin_CXXFLAGS += \
139         -std=c++0x \
140         $(NULL)
141 endif
142
143 ibus_engine_libpinyin_LDADD = \
144         @IBUS_LIBS@ \
145         @SQLITE_LIBS@ \
146         @LIBPINYIN_LIBS@ \
147         @OPENCC_LIBS@ \
148         $(NULL)
149
150 if HAVE_LIBUUID
151 ibus_engine_libpinyin_CXXFLAGS += $(LIBUUID_CFLAGS)
152 ibus_engine_libpinyin_LDADD += $(LIBUUID_LIBS)
153 endif
154
155 if IBUS_BUILD_LIBPINYIN
156    ibus_engine_libpinyin_CXXFLAGS += \
157         -DIBUS_BUILD_LIBPINYIN \
158         -DLIBPINYIN_DATADIR=\"@LIBPINYIN_DATADIR@\/data\" \
159         $(NULL)
160 endif
161
162 if IBUS_BUILD_LUA_EXTENSION
163     ibus_engine_libpinyin_CXXFLAGS +=  \
164         @LUA_CFLAGS@ \
165         -DIBUS_BUILD_LUA_EXTENSION \
166         -I$(top_srcdir)/lua/ \
167         $(NULL)
168 endif
169
170 if IBUS_BUILD_LUA_EXTENSION
171     ibus_engine_libpinyin_LDADD += \
172         @LUA_LIBS@ \
173         -L../lua/ \
174         -lpylua \
175         $(NULL)
176 endif
177
178 if IBUS_BUILD_ENGLISH_INPUT_MODE
179    ibus_engine_libpinyin_CXXFLAGS += \
180         -DIBUS_BUILD_ENGLISH_INPUT_MODE \
181         $(NULL)
182 endif
183
184 if IBUS_BUILD_STROKE_INPUT_MODE
185    ibus_engine_libpinyin_CXXFLAGS += \
186         -DIBUS_BUILD_STROKE_INPUT_MODE \
187         $(NULL)
188 endif
189
190 BUILT_SOURCES = \
191         $(ibus_engine_built_c_sources) \
192         $(ibus_engine_built_h_sources) \
193         $(NULL)
194
195 pkgdata_DATA = \
196         phrases.txt \
197         $(NULL)
198
199 component_DATA = \
200         libpinyin.xml \
201         $(NULL)
202 componentdir = @datadir@/ibus/component
203
204 EXTRA_DIST = \
205         libpinyin.xml.in \
206         phrases.txt \
207         $(NULL)
208
209 CLEANFILES = \
210         libpinyin.xml \
211         ZhConversion.* \
212         $(NULL)
213
214 PYPunctTable.h:
215         $(AM_V_GEN) \
216         $(PYTHON) $(top_srcdir)/scripts/genpuncttable.py > $@ || \
217                 ( $(RM) $@; exit 1 )
218
219 PYSimpTradConverterTable.h:
220         $(AM_V_GEN) \
221         $(PYTHON) $(top_srcdir)/scripts/update-simptrad-table.py > $@ || \
222                 ( $(RM) $@; exit 1 )
223
224 update-simptrad-table:
225         $(RM) ZhConversion.php ZhConversion.py PYSimpTradConverterTable.h
226         $(MAKE) ZhConversion.php
227         $(MAKE) ZhConversion.py
228         $(MAKE) PYSimpTradConverterTable.h
229
230 libpinyin.xml: libpinyin.xml.in
231         $(AM_V_GEN) \
232         ( \
233                 libexecdir=${libexecdir}; \
234                 pkgdatadir=${pkgdatadir}; \
235                 s=`cat $<`; \
236                 eval "echo \"$${s}\""; \
237         ) > $@
238
239 test: ibus-engine-libpinyin
240         $(ENV) \
241                 G_DEBUG=fatal_criticals \
242                 $(builddir)/ibus-engine-libpinyin
243
244 # test: ibus-engine-pinyin
245 #       $(ENV) G_DEBUG=fatal_warnings \
246 #       $(builddir)/ibus-engine-pinyin
247 ZhConversion.php:
248         $(AM_V_GEN) \
249         svn cat http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3/includes/ZhConversion.php > $@ || \
250                 ( $(RM) $@; exit 1 )
251
252 ZhConversion.py: ZhConversion.php
253         $(AM_V_GEN) \
254         php $(top_srcdir)/scripts/php_2_py.php > $@ || \
255                 ( $(RM) $@; exit 1 )
256