clean up PYConfig.h/cc
[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-pinyin
36 ibus_engine_pinyin_built_c_sources = \
37         $(NULL)
38 ibus_engine_pinyin_built_h_sources = \
39         PYBopomofoKeyboard.h \
40         PYPinyinParserTable.h \
41         PYPunctTable.h \
42         PYSimpTradConverterTable.h \
43         $(NULL)
44 ibus_engine_pinyin_c_sources = \
45         PYConfig.cc \
46         PYEditor.cc \
47         PYEngine.cc \
48         PYFallbackEditor.cc \
49         PYHalfFullConverter.cc \
50         PYMain.cc \
51         PYPinyinProperties.cc \
52         PYPunctEditor.cc \
53         PYSimpTradConverter.cc \
54         PYDynamicSpecialPhrase.cc \
55         PYSpecialPhrase.cc \
56         PYSpecialPhraseTable.cc \
57         $(NULL)
58 ibus_engine_pinyin_h_sources = \
59         PYBopomofo.h \
60         PYBus.h \
61         PYConfig.h \
62         PYDoublePinyinTable.h \
63         PYEditor.h \
64         PYEngine.h \
65         PYExtEditor.h \
66         PYFallbackEditor.h \
67         PYHalfFullConverter.h \
68         PYLookupTable.h \
69         PYObject.h \
70         PYPhrase.h \
71         PYPhraseArray.h \
72         PYPinyinArray.h \
73         PYPinyinProperties.h \
74         PYPointer.h \
75         PYProperty.h \
76         PYPunctEditor.h \
77         PYRawEditor.h \
78         PYRegex.h \
79         PYSignal.h \
80         PYSimpTradConverter.h \
81         PYSpecialPhrase.h \
82         PYDynamicSpecialPhrase.h \
83         PYSpecialPhraseTable.h \
84         PYString.h \
85         PYText.h \
86         PYTypes.h \
87         PYUtil.h \
88         PYEnglishEditor.h \
89         PYLibPinyin.h \
90         PYPPhoneticEditor.h \
91         PYPPinyinEditor.h \
92         PYPFullPinyinEditor.h \
93         PYPDoublePinyinEditor.h \
94         PYPBopomofoEditor.h \
95         PYPPinyinEngine.h \
96         PYPBopomofoEngine.h \
97         PYPConfig.h \
98         $(NULL)
99
100 if IBUS_BUILD_LIBPINYIN
101 ibus_engine_pinyin_c_sources += \
102         PYPConfig.cc \
103         PYLibPinyin.cc \
104         PYPPhoneticEditor.cc \
105         PYPPinyinEditor.cc \
106         PYPFullPinyinEditor.cc \
107         PYPDoublePinyinEditor.cc \
108         PYPBopomofoEditor.cc \
109         PYPPinyinEngine.cc \
110         PYPBopomofoEngine.cc \
111         $(NULL)
112 endif
113
114
115 if IBUS_BUILD_LUA_EXTENSION
116 ibus_engine_pinyin_c_sources += PYExtEditor.cc
117 endif
118
119 if IBUS_BUILD_ENGLISH_INPUT_MODE
120 ibus_engine_pinyin_c_sources += PYEnglishEditor.cc
121 endif
122
123 ibus_engine_pinyin_SOURCES = \
124         $(ibus_engine_pinyin_c_sources) \
125         $(ibus_engine_pinyin_h_sources) \
126         $(ibus_engine_pinyin_built_c_sources) \
127         $(ibus_engine_pinyin_built_h_sources) \
128         $(NULL)
129
130
131 ibus_engine_pinyin_CXXFLAGS = \
132         @IBUS_CFLAGS@ \
133         @SQLITE_CFLAGS@ \
134         @LIBPINYIN_CFLAGS@ \
135         @OPENCC_CFLAGS@ \
136         -DGETTEXT_PACKAGE=\"@GETTEXT_PACKAGE@\" \
137         -DPKGDATADIR=\"$(pkgdatadir)\" \
138         -DLIBEXECDIR=\"$(libexecdir)\" \
139         $(NULL)
140
141 if HAVE_BOOST
142 ibus_engine_pinyin_CXXFLAGS += \
143         @BOOST_CPPFLAGS@ \
144         $(NULL)
145 else
146 ibus_engine_pinyin_CXXFLAGS += \
147         -std=c++0x \
148         $(NULL)
149 endif
150
151 ibus_engine_pinyin_LDADD = \
152         @IBUS_LIBS@ \
153         @SQLITE_LIBS@ \
154         @LIBPINYIN_LIBS@ \
155         @OPENCC_LIBS@ \
156         $(NULL)
157
158 if HAVE_LIBUUID
159 ibus_engine_pinyin_CXXFLAGS += $(LIBUUID_CFLAGS)
160 ibus_engine_pinyin_LDADD += $(LIBUUID_LIBS)
161 endif
162
163 if IBUS_BUILD_LIBPINYIN
164    ibus_engine_pinyin_CXXFLAGS += -DIBUS_BUILD_LIBPINYIN
165 endif
166
167 if IBUS_BUILD_LUA_EXTENSION
168     ibus_engine_pinyin_CXXFLAGS +=  \
169         @LUA_CFLAGS@ \
170         -DIBUS_BUILD_LUA_EXTENSION \
171         -I$(top_srcdir)/lua/ \
172         $(NULL)
173 endif
174
175 if IBUS_BUILD_LUA_EXTENSION
176     ibus_engine_pinyin_LDADD += \
177         @LUA_LIBS@ \
178         -L../lua/ \
179         -lpylua \
180         $(NULL)
181 endif
182
183 if IBUS_BUILD_ENGLISH_INPUT_MODE
184    ibus_engine_pinyin_CXXFLAGS += \
185         -DIBUS_BUILD_ENGLISH_INPUT_MODE \
186         $(NULL)
187 endif
188
189 BUILT_SOURCES = \
190         $(ibus_engine_built_c_sources) \
191         $(ibus_engine_built_h_sources) \
192         $(NULL)
193
194 pkgdata_DATA = \
195         phrases.txt \
196         $(NULL)
197
198 component_DATA = \
199         pinyin.xml \
200         $(NULL)
201 componentdir = @datadir@/ibus/component
202
203 EXTRA_DIST = \
204         pinyin.xml.in \
205         phrases.txt \
206         $(NULL)
207
208 CLEANFILES = \
209         pinyin.xml \
210         ZhConversion.* \
211         $(NULL)
212
213 PYBopomofoKeyboard.h:
214         $(AM_V_GEN) \
215         $(PYTHON) $(top_srcdir)/scripts/genbopomofokeyboard.py > $@ || \
216                 ( $(RM) $@; exit 1 )
217
218 PYPinyinParserTable.h:
219         $(AM_V_GEN) \
220         $(PYTHON) $(top_srcdir)/scripts/genpytable.py > $@ || \
221                 ( $(RM) $@; exit 1 )
222
223 PYPunctTable.h:
224         $(AM_V_GEN) \
225         $(PYTHON) $(top_srcdir)/scripts/genpuncttable.py > $@ || \
226                 ( $(RM) $@; exit 1 )
227
228 PYSimpTradConverterTable.h:
229         $(AM_V_GEN) \
230         $(PYTHON) $(top_srcdir)/scripts/update-simptrad-table.py > $@ || \
231                 ( $(RM) $@; exit 1 )
232
233 update-simptrad-table:
234         $(RM) ZhConversion.php ZhConversion.py PYSimpTradConverterTable.h
235         $(MAKE) ZhConversion.php
236         $(MAKE) ZhConversion.py
237         $(MAKE) PYSimpTradConverterTable.h
238
239 pinyin.xml: pinyin.xml.in
240         $(AM_V_GEN) \
241         ( \
242                 libexecdir=${libexecdir}; \
243                 pkgdatadir=${pkgdatadir}; \
244                 s=`cat $<`; \
245                 eval "echo \"$${s}\""; \
246         ) > $@
247
248 test: ibus-engine-pinyin
249         $(ENV) \
250                 G_DEBUG=fatal_criticals \
251                 $(builddir)/ibus-engine-pinyin
252
253 # test: ibus-engine-pinyin
254 #       $(ENV) G_DEBUG=fatal_warnings \
255 #       $(builddir)/ibus-engine-pinyin
256 ZhConversion.php:
257         $(AM_V_GEN) \
258         svn cat http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3/includes/ZhConversion.php > $@ || \
259                 ( $(RM) $@; exit 1 )
260
261 ZhConversion.py: ZhConversion.php
262         $(AM_V_GEN) \
263         php $(top_srcdir)/scripts/php_2_py.php > $@ || \
264                 ( $(RM) $@; exit 1 )
265