Command substitution already runs in a subshell
[bpt/emacs.git] / leim / Makefile.in
CommitLineData
dadbf673 1# Makefile for leim subdirectory in GNU Emacs.
95df8112 2
41455956 3# Copyright (C) 1997-2012 Free Software Foundation, Inc.
6d344054 4# Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
d0981f82 5# 2006, 2007, 2008, 2009, 2010, 2011
eda20bd8
KH
6# National Institute of Advanced Industrial Science and Technology (AIST)
7# Registration Number H14PRO021
24b31c88 8
dadbf673
GM
9# This file is part of GNU Emacs.
10
d3fb0974 11# GNU Emacs is free software: you can redistribute it and/or modify
dadbf673 12# it under the terms of the GNU General Public License as published by
d3fb0974
GM
13# the Free Software Foundation, either version 3 of the License, or
14# (at your option) any later version.
15
dadbf673
GM
16# GNU Emacs is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU General Public License for more details.
d3fb0974 20
dadbf673 21# You should have received a copy of the GNU General Public License
d3fb0974
GM
22# along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
23
dadbf673
GM
24
25# Avoid trouble on systems where the `SHELL' variable might be
26# inherited from the environment.
27SHELL = /bin/sh
28
29# Here are the things that we expect ../configure to edit.
30version=@version@
31prefix=@prefix@
ca1cd89c 32datarootdir=@datarootdir@
dadbf673
GM
33datadir=@datadir@
34srcdir=@srcdir@
2a7973b6 35ns_appresdir=@ns_appresdir@
dadbf673 36
ff57c2ec
GM
37install_prefix=$(DESTDIR)${datadir}/emacs/${version}
38
dadbf673 39# Where to install LEIM files.
ff57c2ec
GM
40# For most builds, this is ${install_prefix}/leim.
41# For self-contained ns builds, it is ${ns_appresdir}/leim.
42LEIM_INSTALLDIR=@LEIM_INSTALLDIR@
dadbf673 43
005ad204
GM
44MKDIR_P = @MKDIR_P@
45
d95f329f 46GZIP_PROG = @GZIP_PROG@
7a7f042f 47
dadbf673
GM
48# Which Emacs to use to convert TIT files to Emacs Lisp files,
49# byte-compile Emacs Lisp files, and generate the file leim-list.el.
935396c0 50EMACS = ../src/emacs
dadbf673 51
c1d05286 52buildlisppath=${srcdir}/../lisp
dadbf673
GM
53
54# How to run Emacs.
68b5f855 55RUN_EMACS = EMACSLOADPATH=$(buildlisppath) LC_ALL=C \
935396c0 56 ${EMACS} -batch --no-site-file --no-site-lisp
dadbf673
GM
57
58# Subdirectories to be made if ${srcdir} is different from the current
59# directory.
60SUBDIRS=quail
61
62# Files generated from TIT dictionaries for Chinese GB character set.
68b5f855 63TIT_GB=\
41455956
GM
64 quail/CCDOSPY.el \
65 quail/Punct.el \
66 quail/QJ.el \
67 quail/SW.el \
68 quail/TONEPY.el
dadbf673
GM
69
70# Files generated from TIT dictionaries for Chinese BIG5 character set.
acb8e1dd 71TIT_BIG5=\
41455956
GM
72 quail/4Corner.el \
73 quail/ARRAY30.el \
74 quail/ECDICT.el \
75 quail/ETZY.el \
76 quail/Punct-b5.el \
77 quail/PY-b5.el \
78 quail/QJ-b5.el \
79 quail/ZOZY.el
dadbf673 80
68b5f855 81CHINESE_TIT=${TIT_GB} ${TIT_BIG5}
dadbf673 82
242a2def 83MISC= \
41455956
GM
84 quail/tsang-b5.el \
85 quail/quick-b5.el \
86 quail/tsang-cns.el \
87 quail/quick-cns.el \
88 quail/PY.el \
89 quail/ZIRANMA.el \
90 quail/CTLau.el \
91 quail/CTLau-b5.el
92
93## The generated .el files.
68b5f855 94TIT_MISC=${CHINESE_TIT} ${MISC}
dadbf673 95
e1e539ed
KH
96.SUFFIXES: .elc .el
97
dadbf673 98.el.elc:
8e0214ec 99 @echo Compiling $<
41455956 100 @${RUN_EMACS} -l ${buildlisppath}/international/quail -f batch-byte-compile $<
dadbf673 101
e98e405e 102all: ${SUBDIRS} leim-list.el compile-main
dadbf673
GM
103
104${SUBDIRS}:
105 mkdir $@
106 touch stamp-subdir
107
68b5f855 108TIT_SOURCES= \
2cd23d89
KH
109 ${srcdir}/CXTERM-DIC/4Corner.tit \
110 ${srcdir}/CXTERM-DIC/ARRAY30.tit \
111 ${srcdir}/CXTERM-DIC/CCDOSPY.tit \
112 ${srcdir}/CXTERM-DIC/ECDICT.tit \
113 ${srcdir}/CXTERM-DIC/ETZY.tit \
114 ${srcdir}/CXTERM-DIC/PY-b5.tit \
115 ${srcdir}/CXTERM-DIC/Punct-b5.tit \
116 ${srcdir}/CXTERM-DIC/Punct.tit \
117 ${srcdir}/CXTERM-DIC/QJ-b5.tit \
118 ${srcdir}/CXTERM-DIC/QJ.tit \
119 ${srcdir}/CXTERM-DIC/SW.tit \
120 ${srcdir}/CXTERM-DIC/TONEPY.tit \
121 ${srcdir}/CXTERM-DIC/ZOZY.tit
242a2def 122
41455956 123${CHINESE_TIT}: changed.tit
4c603b0c
AS
124 @true
125
e7333757 126## FIXME remove subdirs if possible - time-stamping.
41455956 127## Emacs should make the directory if it does not exist.
e7333757
GM
128
129## The changed.* files act to serialize this part of the build.
130## A single Emacs invocation creates all the CHINESE_TIT files.
131## Otherwise in a parallel build multiple Emacs instances could
132## interfere with each other. If we used GNU make we could probably
133## parallelize this without the need for an explicit rule for each
41a2ce39
GM
134## file. Something like the pattern rule:
135## quail/%.el: CXTERM-DIC/%.tit
136## It doesn't seem possible to do this with VPATH and suffix rules.
41455956 137changed.tit: ${SUBDIRS} ${TIT_SOURCES}
68b5f855 138 ${RUN_EMACS} -l ${buildlisppath}/international/titdic-cnv \
026e4e51
EZ
139 -f batch-titdic-convert -dir quail ${srcdir}/CXTERM-DIC; \
140 echo "changed" > $@
242a2def 141
68b5f855 142MISC_SOURCES= \
2cd23d89
KH
143 ${srcdir}/MISC-DIC/CTLau-b5.html \
144 ${srcdir}/MISC-DIC/CTLau.html \
145 ${srcdir}/MISC-DIC/cangjie-table.b5 \
146 ${srcdir}/MISC-DIC/cangjie-table.cns \
147 ${srcdir}/MISC-DIC/pinyin.map \
148 ${srcdir}/MISC-DIC/ziranma.cin
242a2def 149
41455956 150${MISC}: changed.misc
4c603b0c
AS
151 @true
152
41455956 153changed.misc: ${SUBDIRS} ${MISC_SOURCES}
68b5f855 154 ${RUN_EMACS} -l ${buildlisppath}/international/titdic-cnv \
026e4e51
EZ
155 -f batch-miscdic-convert -dir quail ${srcdir}/MISC-DIC; \
156 echo "changed" > $@
242a2def 157
41455956 158leim-list.el: ${SUBDIRS} ${TIT_MISC} ${srcdir}/leim-ext.el
7069bd16 159 rm -f leim-list.el
b847032c 160 if [ x`cd ${srcdir} && /bin/pwd` = x`/bin/pwd` ] ; then \
68b5f855 161 ${RUN_EMACS} -l ${buildlisppath}/international/quail \
dadbf673
GM
162 --eval "(update-leim-list-file \".\")" ; \
163 else \
68b5f855 164 ${RUN_EMACS} -l ${buildlisppath}/international/quail \
dadbf673
GM
165 --eval "(update-leim-list-file \".\" \"${srcdir}\")" ; \
166 fi
8f34b40c 167 sed -n '/^[^;]/ p' < ${srcdir}/leim-ext.el >> $@
dadbf673 168
41455956
GM
169## Following adapted from lisp/Makefile.in.
170setwins=wins="${srcdir}/ja-dic quail"; \
171 [ `cd ${srcdir} && /bin/pwd` != `/bin/pwd` ] && \
172 wins="$$wins ${srcdir}/quail"
173
174.PHONY: compile-targets
175# TARGETS is set dynamically in the recursive call from `compile-main'.
176compile-targets: $(TARGETS)
177
178# Compile all the Elisp files that need it. Beware: it approximates
179# `no-byte-compile', so watch out for false-positives!
180compile-main: ${TIT_MISC}
181 @($(setwins); \
182 els=`echo "$$wins " | sed -e 's| |/*.el |g'`; \
183 for el in $$els; do \
184 test -f $$el || continue; \
185 test ! -f $${el}c && GREP_OPTIONS= grep '^;.*no-byte-compile: t' $$el > /dev/null && continue; \
186 echo "$${el}c"; \
187 done | xargs echo) | \
188 while read chunk; do \
935396c0 189 $(MAKE) $(MFLAGS) compile-targets EMACS="$(EMACS)" TARGETS="$$chunk"; \
41455956
GM
190 done
191
dadbf673 192install: all
005ad204 193 umask 022; ${MKDIR_P} ${LEIM_INSTALLDIR}
b847032c 194 if [ x`cd ${LEIM_INSTALLDIR} && /bin/pwd` != x`/bin/pwd` ] ; then \
ff57c2ec
GM
195 rm -f ${LEIM_INSTALLDIR}/leim-list.el; \
196 rm -rf ${LEIM_INSTALLDIR}/quail ${LEIM_INSTALLDIR}/ja-dic ; \
197 echo "Copying leim files to ${LEIM_INSTALLDIR} ..." ; \
b847032c 198 if [ x`cd ${srcdir} && /bin/pwd` = x`/bin/pwd` ] ; then \
05b54460 199 tar -chf - leim-list.el quail ja-dic \
ff57c2ec 200 | (cd ${LEIM_INSTALLDIR}; umask 0; tar -xvf - && cat > /dev/null) ;\
dadbf673 201 else \
05b54460 202 tar -chf - leim-list.el quail \
ff57c2ec 203 | (cd ${LEIM_INSTALLDIR}; umask 0; tar -xvf - && cat > /dev/null) ;\
dadbf673 204 cd ${srcdir}; \
05b54460 205 tar -chf - quail/* ja-dic \
ff57c2ec 206 | (cd ${LEIM_INSTALLDIR}; umask 0; tar -xvf - && cat > /dev/null) ;\
dadbf673 207 fi; \
ff57c2ec
GM
208 rm -f ${LEIM_INSTALLDIR}/.gitignore ${LEIM_INSTALLDIR}/*/.gitignore; \
209 rm -f ${LEIM_INSTALLDIR}/.arch-inventory ${LEIM_INSTALLDIR}/*/.arch-inventory; \
210 rm -f ${LEIM_INSTALLDIR}/\#* ${LEIM_INSTALLDIR}/*/\#* ; \
211 rm -f ${LEIM_INSTALLDIR}/.\#* ${LEIM_INSTALLDIR}/*/.\#* ; \
212 rm -f ${LEIM_INSTALLDIR}/*~ ${LEIM_INSTALLDIR}/*/*~ ; \
213 rm -f ${LEIM_INSTALLDIR}/*.orig ${LEIM_INSTALLDIR}/*/*.orig ; \
dadbf673 214 else true; fi
7a7f042f 215 -unset CDPATH; \
d95f329f 216 if [ -n "${GZIP_PROG}" ]; \
7a7f042f
RF
217 then \
218 echo "Compressing *.el ..." ; \
ff57c2ec 219 (cd ${LEIM_INSTALLDIR}; for f in `find . -name "*.elc" -print`; do \
d95f329f 220 ${GZIP_PROG} -9n `echo $$f|sed 's/.elc$$/.el/'` ; \
7a7f042f
RF
221 done) \
222 else true; fi
ff57c2ec 223 -chmod -R a+r ${LEIM_INSTALLDIR}
fe1ada9b
GM
224 for installuser in $${LOGNAME} $${USERNAME} $${USER} \
225 `id -un 2> /dev/null`; do \
226 [ -n "$${installuser}" ] && break ; \
227 done ; \
ff57c2ec 228 find ${LEIM_INSTALLDIR} -exec chown $${installuser} '{}' ';'
dadbf673
GM
229
230clean mostlyclean:
41455956 231 rm -f ${TIT_MISC} ${TIT_MISC:.el=.elc} \
242a2def 232 leim-list.el changed.tit changed.misc
dadbf673 233
9200c926
RF
234# The following target is needed because the `clean' target only removes
235# TIT-generated files and doesn't touch compiled Quail packages. But
236# bootstrapping should not leave non-fresh .elc files behind.
237bootstrap-clean: clean
41455956 238 $(setwins); for w in $$wins; do rm -f $$w/*.elc; done
9200c926 239
e6f528ba 240distclean: clean
dadbf673
GM
241 if test -f stamp-subdir; then rm -rf ${SUBDIRS} stamp-subdir; fi
242 rm -f Makefile
a070e0b7 243
cbeed5af 244maintainer-clean: distclean bootstrap-clean
e6f528ba
KH
245
246extraclean: maintainer-clean
cbeed5af 247 -rm -f *~ \#* */*~ */\#*
63150f3c
GM
248
249.PHONY: check-declare
250
251check-declare:
68b5f855 252 $(RUN_EMACS) -l $(buildlisppath)/emacs-lisp/check-declare \
63150f3c 253 --eval '(check-declare-directory "$(srcdir)")'