1# vim:set noet ts=4:
2#
3# ibus-anthy - The Anthy engine for IBus
4#
5# Copyright (c) 2007-2008 Peng Huang <shawn.p.huang@gmail.com>
6# Copyright (c) 2009 Hideaki ABE <abe.sendai@gmail.com>
7# Copyright (c) 2010-2017 Takao Fujiwara <takao.fujiwara1@gmail.com>
8# Copyright (c) 2007-2017 Red Hat, Inc.
9#
10# This program is free software; you can redistribute it and/or modify
11# it under the terms of the GNU General Public License as published by
12# the Free Software Foundation; either version 2 of the License, or
13# (at your option) any later version.
14#
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18# GNU General Public License for more details.
19#
20# You should have received a copy of the GNU General Public License along
21# with this program; if not, write to the Free Software Foundation, Inc.,
22# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23
24desktop_in_in_files = ibus-setup-anthy.desktop.in.in
25desktop_in_files = $(desktop_in_in_files:.in.in=.in)
26
27$(desktop_in_files): %.desktop.in: %.desktop.in.in Makefile
28	$(AM_V_GEN) sed \
29	       -e "s|\@libexecdir\@|$(libexecdir)|" \
30	       -e "s|\@pkgdatadir\@|$(pkgdatadir)|" \
31	       $< > $@.tmp && mv $@.tmp $@
32
33desktopdir=$(datadir)/applications
34desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
35
36$(desktop_DATA): $(desktop_in_files) Makefile
37	$(AM_V_GEN)$(MSGFMT) --desktop --template $< -d $(top_srcdir)/po -o $@
38
39BUILT_SOURCES = \
40	_config.py \
41	$(NULL)
42
43libexec_SCRIPTS = ibus-setup-anthy
44
45setup_anthy_PYTHON = \
46	_config.py \
47	anthyprefs.py \
48	main.py \
49	prefs.py \
50	setup.ui \
51	$(NULL)
52
53setup_anthy_built_files = \
54	$(BUILT_SOURCES) \
55	$(libexec_SCRIPTS) \
56	$(NULL)
57
58setup_anthy_built_in_files = $(addsuffix .in, $(setup_anthy_built_files))
59
60setup_anthydir = $(datadir)/ibus-anthy/setup
61
62CONFIG_CLEAN_FILES = \
63	$(BUILT_SOURCES) \
64	$(NULL)
65
66CLEANFILES = \
67	$(BUILT_SOURCES) \
68	$(desktop_DATA) \
69	$(desktop_in_files) \
70	$(libexec_SCRIPTS) \
71	*.pyc \
72	$(NULL)
73
74EXTRA_DIST = \
75	$(desktop_in_in_files) \
76	$(setup_anthy_built_in_files) \
77	$(NULL)
78
79ibus-setup-anthy: ibus-setup-anthy.in
80	sed -e "s|\@prefix\@|$(prefix)|g" \
81	    -e "s|\@localedir\@|$(localedir)|g" \
82	    -e "s|\@PYTHON\@|$(PYTHON)|g" \
83	$< > $@
84
85_config.py: _config.py.in
86	sed -e "s|\@pkgdatadir\@|$(pkgdatadir)|g" \
87	    -e "s|\@libexecdir\@|$(libexecdir)|g" \
88	    -e "s|\@datadir\@|$(datadir)|g" \
89	    -e "s|\@LAYOUT\@|$(LAYOUT)|g" \
90	    -e "s|\@SYMBOL_CHAR_INT\@|$(SYMBOL_CHAR_INT)|g" \
91	    -e "s|\@ICON_PREFERENCE\@|$(ICON_PREFERENCE)|g" \
92	    -e "s|\@VERSION\@|$(VERSION)|g" \
93	$< > $@
94
95# Need a time lag between .py and .py.in files to build .py files
96# because *_PYTHON valuables are installed in the tarball.
97dist-hook:
98	@sleep 1; \
99	for in_file in $(setup_anthy_built_in_files) ; do \
100	    if [ -f $(distdir)/$(srcdir)/$$in_file ] ; then \
101	        touch $(distdir)/$(srcdir)/$$in_file; \
102	    fi; \
103	done;
104
105test:
106	$(ENV_IBUS_TEST) DBUS_DEBUG=true \
107		   LANG=en_US \
108		   PYTHONPATH=$(abs_top_srcdir):$(pyexecdir) \
109		   IBUS_LOCALEDIR=@localedir@ \
110		   $(PYTHON) $(srcdir)/main.py
111
112