summaryrefslogtreecommitdiff
path: root/engine/python3/Makefile.am
blob: 47a757489e8e4eac8f32c1c5bd8e4db1a2ff75f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# vim:set noet ts=4:
#
# ibus-anthy - The Anthy engine for IBus
#
# Copyright (c) 2007-2008 Peng Huang <shawn.p.huang@gmail.com>
# Copyright (c) 2010-2016 Takao Fujiwara <takao.fujiwara1@gmail.com>
# Copyright (c) 2007-2016 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

BUILT_SOURCES = _config.py

engine_anthy_PYTHON = \
	_config.py \
	engine.py \
	factory.py \
	jastring.py \
	kana.py \
	main.py \
	romaji.py \
	segment.py \
	tables.py \
	thumb.py \
	$(NULL)
engine_anthydir = $(pkgdatadir)/engine
engine_anthy_built_files = $(BUILT_SOURCES)
engine_anthy_built_in_files = $(addsuffix .in, $(engine_anthy_built_files))

PYGTK2_ANTHY_RAW = anthy.i
PYGTK2_ANTHY_GEN = anthy.py anthy_wrap.c

if HAVE_PYGTK2_ANTHY
anthy_DATA = \
	anthy.py \
	$(NULL)
anthy_LTLIBRARIES = _anthy.la
anthydir = @pyexecdir@

_anthy_la_SOURCES = \
	$(NULL)

nodist__anthy_la_SOURCES = \
	anthy_wrap.c \
	$(NULL)

_anthy_la_CFLAGS = \
	@ANTHY_CFLAGS@ \
	@PYTHON_CFLAGS@ \
	$(NULL)

_anthy_la_LDFLAGS = \
	@ANTHY_LIBS@ \
	@PYTHON_LIBS@ \
	-avoid-version \
	-module \
	$(NULL)

anthy.py anthy_wrap.c: anthy.i
	$(SWIG) -python $(ANTHY_CFLAGS) -I/usr/include -o anthy_wrap.c $(srcdir)/anthy.i
endif

libexec_SCRIPTS = ibus-engine-anthy
component_DATA = anthy.xml
componentdir = $(datadir)/ibus/component
engine_DATA = default.xml
enginedir = $(pkgdatadir)/engine

# $(SYMBOL_XML) cannot be extracted in Makefile but $(libexecdir) can be
# extracted to ${exec_prefix}/libexec so use capital @LIBEXECDIR@ here.
%.xml: %.xml.in
	sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|g" \
	    -e "s|\@PKGDATADIR\@|$(pkgdatadir)|g" \
	    -e "s|_description|description|g" \
	$< > $@

ibus-engine-anthy: ibus-engine-anthy.in
	sed -e "s|\@prefix\@|$(prefix)|g" \
	    -e "s|\@exec_prefix\@|$(exec_prefix)|g" \
	    -e "s|\@libexecdir\@|$(libexecdir)|g" \
	    -e "s|\@datarootdir\@|$(datarootdir)|g" \
	    -e "s|\@PACKAGE\@|$(PACKAGE)|g" \
	    -e "s|\@PYTHON\@|$(PYTHON)|g" \
	    -e "s|\@ENV_IBUS_ENGINE\@|$(ENV_IBUS_ENGINE)|g" \
	$< > $@

_config.py: _config.py.in
	sed -e "s|\@pkgdatadir\@|$(pkgdatadir)|g" \
	    -e "s|\@libexecdir\@|$(libexecdir)|g" \
	    -e "s|\@datadir\@|$(datadir)|g" \
	    -e "s|\@LAYOUT\@|$(LAYOUT)|g" \
	    -e "s|\@SYMBOL_CHAR_INT\@|$(SYMBOL_CHAR_INT)|g" \
	    -e "s|\@ICON_PREFERENCE\@|$(ICON_PREFERENCE)|g" \
	$< > $@

test:
	$(ENV_IBUS_TEST) \
		DBUS_DEBUG=true \
		IBUS_ANTHY_PKGDATADIR=$(abs_top_srcdir) \
		PYTHONPATH=$(builddir)/.libs:@pyexecdir@ \
		$(PYTHON) \
		$(srcdir)/main.py

EXTRA_DIST = \
	$(engine_anthy_built_in_files) \
	$(PYGTK2_ANTHY_RAW) \
	anthy.xml.in.in \
	default.xml.in.in \
	ibus-engine-anthy.in \
	$(NULL)

CLEANFILES = \
	$(BUILT_SOURCES) \
	$(PYGTK2_ANTHY_GEN) \
	anthy.xml \
	default.xml \
	ibus-engine-anthy \
	*.pyc \
	$(NULL)

DISTCLEANFILES = \
	$(NULL)

# Need a time lag between .py and .py.in files to build .py files
# because *_PYTHON valuables are installed in the tarball.
dist-hook:
	@sleep 1; \
	for in_file in $(engine_anthy_built_in_files) ; do \
	    if [ -f $(distdir)/$(srcdir)/$$in_file ] ; then \
	        touch $(distdir)/$(srcdir)/$$in_file; \
	    fi; \
	done;