* Makefile.in (install-etc): Respect DESTDIR.
[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
134## file.
41455956 135changed.tit: ${SUBDIRS} ${TIT_SOURCES}
68b5f855 136 ${RUN_EMACS} -l ${buildlisppath}/international/titdic-cnv \
026e4e51
EZ
137 -f batch-titdic-convert -dir quail ${srcdir}/CXTERM-DIC; \
138 echo "changed" > $@
242a2def 139
68b5f855 140MISC_SOURCES= \
2cd23d89
KH
141 ${srcdir}/MISC-DIC/CTLau-b5.html \
142 ${srcdir}/MISC-DIC/CTLau.html \
143 ${srcdir}/MISC-DIC/cangjie-table.b5 \
144 ${srcdir}/MISC-DIC/cangjie-table.cns \
145 ${srcdir}/MISC-DIC/pinyin.map \
146 ${srcdir}/MISC-DIC/ziranma.cin
242a2def 147
41455956 148${MISC}: changed.misc
4c603b0c
AS
149 @true
150
41455956 151changed.misc: ${SUBDIRS} ${MISC_SOURCES}
68b5f855 152 ${RUN_EMACS} -l ${buildlisppath}/international/titdic-cnv \
026e4e51
EZ
153 -f batch-miscdic-convert -dir quail ${srcdir}/MISC-DIC; \
154 echo "changed" > $@
242a2def 155
41455956 156leim-list.el: ${SUBDIRS} ${TIT_MISC} ${srcdir}/leim-ext.el
7069bd16 157 rm -f leim-list.el
dadbf673 158 if [ x`(cd ${srcdir} && /bin/pwd)` = x`(/bin/pwd)` ] ; then \
68b5f855 159 ${RUN_EMACS} -l ${buildlisppath}/international/quail \
dadbf673
GM
160 --eval "(update-leim-list-file \".\")" ; \
161 else \
68b5f855 162 ${RUN_EMACS} -l ${buildlisppath}/international/quail \
dadbf673
GM
163 --eval "(update-leim-list-file \".\" \"${srcdir}\")" ; \
164 fi
8f34b40c 165 sed -n '/^[^;]/ p' < ${srcdir}/leim-ext.el >> $@
dadbf673 166
41455956
GM
167## Following adapted from lisp/Makefile.in.
168setwins=wins="${srcdir}/ja-dic quail"; \
169 [ `cd ${srcdir} && /bin/pwd` != `/bin/pwd` ] && \
170 wins="$$wins ${srcdir}/quail"
171
172.PHONY: compile-targets
173# TARGETS is set dynamically in the recursive call from `compile-main'.
174compile-targets: $(TARGETS)
175
176# Compile all the Elisp files that need it. Beware: it approximates
177# `no-byte-compile', so watch out for false-positives!
178compile-main: ${TIT_MISC}
179 @($(setwins); \
180 els=`echo "$$wins " | sed -e 's| |/*.el |g'`; \
181 for el in $$els; do \
182 test -f $$el || continue; \
183 test ! -f $${el}c && GREP_OPTIONS= grep '^;.*no-byte-compile: t' $$el > /dev/null && continue; \
184 echo "$${el}c"; \
185 done | xargs echo) | \
186 while read chunk; do \
935396c0 187 $(MAKE) $(MFLAGS) compile-targets EMACS="$(EMACS)" TARGETS="$$chunk"; \
41455956
GM
188 done
189
dadbf673 190install: all
005ad204 191 umask 022; ${MKDIR_P} ${LEIM_INSTALLDIR}
ff57c2ec
GM
192 if [ x`(cd ${LEIM_INSTALLDIR} && /bin/pwd)` != x`(/bin/pwd)` ] ; then \
193 rm -f ${LEIM_INSTALLDIR}/leim-list.el; \
194 rm -rf ${LEIM_INSTALLDIR}/quail ${LEIM_INSTALLDIR}/ja-dic ; \
195 echo "Copying leim files to ${LEIM_INSTALLDIR} ..." ; \
dadbf673 196 if [ x`(cd ${srcdir} && /bin/pwd)` = x`(/bin/pwd)` ] ; then \
05b54460 197 tar -chf - leim-list.el quail ja-dic \
ff57c2ec 198 | (cd ${LEIM_INSTALLDIR}; umask 0; tar -xvf - && cat > /dev/null) ;\
dadbf673 199 else \
05b54460 200 tar -chf - leim-list.el quail \
ff57c2ec 201 | (cd ${LEIM_INSTALLDIR}; umask 0; tar -xvf - && cat > /dev/null) ;\
dadbf673 202 cd ${srcdir}; \
05b54460 203 tar -chf - quail/* ja-dic \
ff57c2ec 204 | (cd ${LEIM_INSTALLDIR}; umask 0; tar -xvf - && cat > /dev/null) ;\
dadbf673 205 fi; \
ff57c2ec
GM
206 rm -f ${LEIM_INSTALLDIR}/.gitignore ${LEIM_INSTALLDIR}/*/.gitignore; \
207 rm -f ${LEIM_INSTALLDIR}/.arch-inventory ${LEIM_INSTALLDIR}/*/.arch-inventory; \
208 rm -f ${LEIM_INSTALLDIR}/\#* ${LEIM_INSTALLDIR}/*/\#* ; \
209 rm -f ${LEIM_INSTALLDIR}/.\#* ${LEIM_INSTALLDIR}/*/.\#* ; \
210 rm -f ${LEIM_INSTALLDIR}/*~ ${LEIM_INSTALLDIR}/*/*~ ; \
211 rm -f ${LEIM_INSTALLDIR}/*.orig ${LEIM_INSTALLDIR}/*/*.orig ; \
dadbf673 212 else true; fi
7a7f042f 213 -unset CDPATH; \
d95f329f 214 if [ -n "${GZIP_PROG}" ]; \
7a7f042f
RF
215 then \
216 echo "Compressing *.el ..." ; \
ff57c2ec 217 (cd ${LEIM_INSTALLDIR}; for f in `find . -name "*.elc" -print`; do \
d95f329f 218 ${GZIP_PROG} -9n `echo $$f|sed 's/.elc$$/.el/'` ; \
7a7f042f
RF
219 done) \
220 else true; fi
ff57c2ec 221 -chmod -R a+r ${LEIM_INSTALLDIR}
fe1ada9b
GM
222 for installuser in $${LOGNAME} $${USERNAME} $${USER} \
223 `id -un 2> /dev/null`; do \
224 [ -n "$${installuser}" ] && break ; \
225 done ; \
ff57c2ec 226 find ${LEIM_INSTALLDIR} -exec chown $${installuser} '{}' ';'
dadbf673
GM
227
228clean mostlyclean:
41455956 229 rm -f ${TIT_MISC} ${TIT_MISC:.el=.elc} \
242a2def 230 leim-list.el changed.tit changed.misc
dadbf673 231
9200c926
RF
232# The following target is needed because the `clean' target only removes
233# TIT-generated files and doesn't touch compiled Quail packages. But
234# bootstrapping should not leave non-fresh .elc files behind.
235bootstrap-clean: clean
41455956 236 $(setwins); for w in $$wins; do rm -f $$w/*.elc; done
9200c926 237
e6f528ba 238distclean: clean
dadbf673
GM
239 if test -f stamp-subdir; then rm -rf ${SUBDIRS} stamp-subdir; fi
240 rm -f Makefile
a070e0b7 241
cbeed5af 242maintainer-clean: distclean bootstrap-clean
e6f528ba
KH
243
244extraclean: maintainer-clean
cbeed5af 245 -rm -f *~ \#* */*~ */\#*
63150f3c
GM
246
247.PHONY: check-declare
248
249check-declare:
68b5f855 250 $(RUN_EMACS) -l $(buildlisppath)/emacs-lisp/check-declare \
63150f3c 251 --eval '(check-declare-directory "$(srcdir)")'