1 # Makefile for leim subdirectory in GNU Emacs.
3 # Copyright (C) 1997-2012 Free Software Foundation, Inc.
4 # Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
5 # 2006, 2007, 2008, 2009, 2010, 2011
6 # National Institute of Advanced Industrial Science and Technology (AIST)
7 # Registration Number H14PRO021
9 # This file is part of GNU Emacs.
11 # GNU Emacs is free software: you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation, either version 3 of the License, or
14 # (at your option) any later version.
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.
21 # You should have received a copy of the GNU General Public License
22 # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
25 # Avoid trouble on systems where the `SHELL' variable might be
26 # inherited from the environment.
29 # Here are the things that we expect ../configure to edit.
32 datarootdir
=@datarootdir@
35 ns_appresdir
=@ns_appresdir@
37 install_prefix
=$(DESTDIR
)${datadir}/emacs
/${version}
39 # Where to install LEIM files.
40 # For most builds, this is ${install_prefix}/leim.
41 # For self-contained ns builds, it is ${ns_appresdir}/leim.
42 LEIM_INSTALLDIR
=@LEIM_INSTALLDIR@
46 GZIP_PROG
= @GZIP_PROG@
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.
52 buildlisppath
=${srcdir}/..
/lisp
55 RUN_EMACS
= EMACSLOADPATH
=$(buildlisppath
) LC_ALL
=C \
56 ${EMACS} -batch
--no-site-file
--no-site-lisp
58 # Subdirectories to be made if ${srcdir} is different from the current
62 # Files generated from TIT dictionaries for Chinese GB character set.
70 # Files generated from TIT dictionaries for Chinese BIG5 character set.
81 CHINESE_TIT
=${TIT_GB} ${TIT_BIG5}
93 ## The generated .el files.
94 TIT_MISC
=${CHINESE_TIT} ${MISC}
100 @
${RUN_EMACS} -l
${buildlisppath}/international
/quail
-f batch-byte-compile
$<
102 all: ${SUBDIRS} leim-list.el compile-main
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
123 ${CHINESE_TIT}: changed.tit
126 ## FIXME remove subdirs if possible - time-stamping.
127 ## Emacs should make the directory if it does not exist.
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. 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.
137 changed.tit
: ${SUBDIRS} ${TIT_SOURCES}
138 ${RUN_EMACS} -l
${buildlisppath}/international
/titdic-cnv \
139 -f batch-titdic-convert
-dir quail
${srcdir}/CXTERM-DIC
; \
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
150 ${MISC}: changed.misc
153 changed.misc
: ${SUBDIRS} ${MISC_SOURCES}
154 ${RUN_EMACS} -l
${buildlisppath}/international
/titdic-cnv \
155 -f batch-miscdic-convert
-dir quail
${srcdir}/MISC-DIC
; \
158 leim-list.el
: ${SUBDIRS} ${TIT_MISC} ${srcdir}/leim-ext.el
160 if
[ x
`(cd ${srcdir} && /bin/pwd)` = x
`(/bin/pwd)` ] ; then \
161 ${RUN_EMACS} -l
${buildlisppath}/international
/quail \
162 --eval
"(update-leim-list-file \".\")" ; \
164 ${RUN_EMACS} -l
${buildlisppath}/international
/quail \
165 --eval
"(update-leim-list-file \".\" \"${srcdir}\")" ; \
167 sed
-n
'/^[^;]/ p' < ${srcdir}/leim-ext.el
>> $@
169 ## Following adapted from lisp/Makefile.in.
170 setwins
=wins
="${srcdir}/ja-dic quail"; \
171 [ `cd ${srcdir} && /bin/pwd` != `/bin/pwd` ] && \
172 wins
="$$wins ${srcdir}/quail"
174 .PHONY
: compile-targets
175 # TARGETS is set dynamically in the recursive call from `compile-main'.
176 compile-targets
: $(TARGETS
)
178 # Compile all the Elisp files that need it. Beware: it approximates
179 # `no-byte-compile', so watch out for false-positives!
180 compile-main
: ${TIT_MISC}
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
; \
187 done | xargs echo
) | \
188 while read chunk
; do \
189 $(MAKE
) $(MFLAGS
) compile-targets EMACS
="$(EMACS)" TARGETS
="$$chunk"; \
193 umask
022; ${MKDIR_P} ${LEIM_INSTALLDIR}
194 if
[ x
`(cd ${LEIM_INSTALLDIR} && /bin/pwd)` != x
`(/bin/pwd)` ] ; then \
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} ..." ; \
198 if
[ x
`(cd ${srcdir} && /bin/pwd)` = x
`(/bin/pwd)` ] ; then \
199 tar -chf
- leim-list.el quail ja-dic \
200 |
(cd
${LEIM_INSTALLDIR}; umask
0; tar -xvf
- && cat
> /dev
/null
) ;\
202 tar -chf
- leim-list.el quail \
203 |
(cd
${LEIM_INSTALLDIR}; umask
0; tar -xvf
- && cat
> /dev
/null
) ;\
205 tar -chf
- quail
/* ja-dic \
206 |
(cd
${LEIM_INSTALLDIR}; umask
0; tar -xvf
- && cat
> /dev
/null
) ;\
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
; \
216 if
[ -n
"${GZIP_PROG}" ]; \
218 echo
"Compressing *.el ..." ; \
219 (cd
${LEIM_INSTALLDIR}; for f in
`find . -name "*.elc" -print`; do \
220 ${GZIP_PROG} -9n
`echo $$f|sed 's/.elc$$/.el/'` ; \
223 -chmod
-R a
+r
${LEIM_INSTALLDIR}
224 for installuser in
$${LOGNAME} $${USERNAME} $${USER} \
225 `id -un 2> /dev/null`; do \
226 [ -n
"$${installuser}" ] && break
; \
228 find
${LEIM_INSTALLDIR} -exec chown
$${installuser} '{}' ';'
231 rm -f
${TIT_MISC} ${TIT_MISC
:.el
=.elc
} \
232 leim-list.el changed.tit changed.misc
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.
237 bootstrap-clean
: clean
238 $(setwins
); for w in
$$wins; do
rm -f
$$w/*.elc
; done
241 if
test -f stamp-subdir
; then
rm -rf
${SUBDIRS} stamp-subdir
; fi
244 maintainer-clean
: distclean bootstrap-clean
246 extraclean
: maintainer-clean
247 -rm -f
*~ \
#* */*~ */\#*
249 .PHONY
: check-declare
252 $(RUN_EMACS
) -l
$(buildlisppath
)/emacs-lisp
/check-declare \
253 --eval
'(check-declare-directory "$(srcdir)")'