Simplify admin/unidata Makefile rules

* admin/unidata/unidata-gen.el (unidata-gen-files): Use pop.
Also take the output directory as an argument.

* admin/unidata/Makefile.in: Simplify now that unidata-gen-files takes
the output directory as an argument (no need to cd, etc).
(abs_srcdir, abs_builddir): Remove.
(abs_top_builddir): Replace by top_builddir.
(${DSTDIR}/charprop.el): No need to cd.  Pass dest as argument.
(${DSTDIR}/charprop.el, charprop.el):
No need to pass unidata.txt as argument.
This commit is contained in:
Glenn Morris 2013-10-30 00:15:23 -07:00
parent 55498a0fe4
commit 9835cedbfa
3 changed files with 34 additions and 19 deletions

View file

@ -1,5 +1,15 @@
2013-10-30 Glenn Morris <rgm@gnu.org>
* unidata/unidata-gen.el (unidata-gen-files): Use pop.
Also take the output directory as an argument.
* unidata/Makefile.in: Simplify now that unidata-gen-files takes
the output directory as an argument (no need to cd, etc).
(abs_srcdir, abs_builddir): Remove.
(abs_top_builddir): Replace by top_builddir.
(${DSTDIR}/charprop.el): No need to cd. Pass dest as argument.
(${DSTDIR}/charprop.el, charprop.el):
No need to pass unidata.txt as argument.
* unidata/unidata-gen.el (unidata--ensure-compiled): New function.
(unidata-gen-table-name, unidata-gen-table-decomposition)
(unidata-gen-files): Use unidata--ensure-compiled.

View file

@ -24,12 +24,10 @@
SHELL = @SHELL@
srcdir = @srcdir@
abs_srcdir = @abs_srcdir@
abs_builddir = @abs_builddir@
top_srcdir = @top_srcdir@
abs_top_builddir = @abs_top_builddir@
top_builddir = @top_builddir@
EMACS = ${abs_top_builddir}/src/emacs
EMACS = ${top_builddir}/src/emacs
DSTDIR = ${top_srcdir}/lisp/international
emacs = "${EMACS}" -batch --no-site-file --no-site-lisp
@ -42,13 +40,13 @@ unidata.txt: ${srcdir}/UnicodeData.txt
sed -e 's/\([^;]*\);\(.*\)/(#x\1 "\2")/' -e 's/;/" "/g' < ${srcdir}/UnicodeData.txt > $@
${DSTDIR}/charprop.el: ${srcdir}/unidata-gen.elc unidata.txt
cd ${DSTDIR} && ${emacs} -l ${abs_srcdir}/unidata-gen \
-f unidata-gen-files ${abs_srcdir} "${abs_builddir}/unidata.txt"
${emacs} -L ${srcdir} -l unidata-gen -f unidata-gen-files \
${srcdir} "${DSTDIR}"
## Like the above, but generate in PWD rather than lisp/international.
charprop.el: ${srcdir}/unidata-gen.elc unidata.txt
${emacs} -L ${srcdir} -l unidata-gen \
-f unidata-gen-files ${srcdir} "${abs_builddir}/unidata.txt"
${emacs} -L ${srcdir} -l unidata-gen -f unidata-gen-files \
${srcdir}
install: charprop.el
cp charprop.el ${DSTDIR}

View file

@ -31,7 +31,7 @@
;; FILES TO BE GENERATED
;;
;; The entry function `unidata-gen-files' generates these files in
;; the current directory.
;; in directory specified by its dest-dir argument.
;;
;; charprop.el
;; It contains a series of forms of this format:
@ -90,9 +90,9 @@
(defvar unidata-list nil)
;; Name of the directory containing files of Unicode Character
;; Database.
;; Name of the directory containing files of Unicode Character Database.
;; Dynamically bound in unidata-gen-files.
(defvar unidata-dir nil)
(defun unidata-setup-list (unidata-text-file)
@ -1182,12 +1182,17 @@ is the character itself.")))
;; The entry function. It generates files described in the header
;; comment of this file.
(defun unidata-gen-files (&optional data-dir unidata-text-file)
;; Write files (charprop.el, uni-*.el) to dest-dir (default PWD),
;; using as input files from data-dir, and
;; unidata-text-file (default "unidata.txt" in PWD).
(defun unidata-gen-files (&optional data-dir dest-dir unidata-text-file)
(or data-dir
(setq data-dir (pop command-line-args-left)
unidata-text-file (pop command-line-args-left)))
dest-dir (or (pop command-line-args-left) default-directory)
unidata-text-file (or (pop command-line-args-left)
(expand-file-name "unidata.txt"))))
(let ((coding-system-for-write 'utf-8-unix)
(charprop-file "charprop.el")
(charprop-file (expand-file-name "charprop.el" dest-dir))
(unidata-dir data-dir))
(dolist (elt unidata-prop-alist)
(let* ((prop (car elt))
@ -1200,7 +1205,8 @@ is the character itself.")))
(dolist (elt unidata-prop-alist)
(let* ((prop (car elt))
(generator (unidata-prop-generator prop))
(file (unidata-prop-file prop))
(file (expand-file-name (unidata-prop-file prop) dest-dir))
(basename (file-name-nondirectory file))
(docstring (unidata-prop-docstring prop))
(describer (unidata-prop-describer prop))
(default-value (unidata-prop-default prop))
@ -1208,9 +1214,9 @@ is the character itself.")))
table)
;; Filename in this comment line is extracted by sed in
;; Makefile.
(insert (format ";; FILE: %s\n" file))
(insert (format ";; FILE: %s\n" basename))
(insert (format "(define-char-code-property '%S %S\n %S)\n"
prop file docstring))
prop basename docstring))
(with-temp-buffer
(message "Generating %s..." file)
(when (file-exists-p file)
@ -1235,7 +1241,7 @@ is the character itself.")))
";; coding: utf-8\n"
";; no-byte-compile: t\n"
";; End:\n\n"
(format ";; %s ends here\n" file)))
(format ";; %s ends here\n" basename)))
(write-file file)
(message "Generating %s...done" file))))
(message "Writing %s..." charprop-file)
@ -1243,7 +1249,8 @@ is the character itself.")))
";; coding: utf-8\n"
";; no-byte-compile: t\n"
";; End:\n\n"
(format ";; %s ends here\n" charprop-file)))))
(format ";; %s ends here\n"
(file-name-nondirectory charprop-file))))))