unidir = ${top_srcdir}/lisp/international
emacs = "${EMACS}" -batch --no-site-file --no-site-lisp
+lparen = (
+unifiles = $(addprefix ${unidir}/,$(sort $(shell sed -n 's/^[ \t][ \t]*${lparen}"\(uni-[^"]*\)"$$/\1/p' ${srcdir}/unidata-gen.el)))
+
# 'make' verbosity.
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
am__v_at_0 = @
am__v_at_1 =
-.PHONY: all unifiles
+.PHONY: all
-all: ${top_srcdir}/src/macuvs.h unifiles ${unidir}/charscript.el
+all: ${top_srcdir}/src/macuvs.h ${unifiles} ${unidir}/charscript.el \
+ ${unidir}/charprop.el
## Specify .elc as an order-only prereq so as to not needlessly rebuild
## target just because the .elc is missing.
$(AM_V_GEN)sed -e 's/\([^;]*\);\(.*\)/(#x\1 "\2")/' -e 's/;/" "/g' \
< $< > $@
-PHONY_EXTRAS =
-.PHONY: $(PHONY_EXTRAS)
+## charprop doesn't actually depend on unifiles, but for now at least
+## pretend that it does since other Makefiles assume that if charprop
+## is up-to-date, the unifiles are too.
+${unidir}/charprop.el: ${unifiles} ${srcdir}/unidata-gen.el | ${srcdir}/unidata-gen.elc
+ $(AM_V_at)[ ! -f $@ ] || chmod +w $@
+ $(AM_V_GEN)${emacs} -L ${srcdir} -l unidata-gen \
+ -f unidata-gen-charprop $@
-${unidir}/charprop.el: ${srcdir}/unidata-gen.el \
+${unifiles}: ${srcdir}/unidata-gen.el \
${srcdir}/UnicodeData.txt ${srcdir}/BidiMirroring.txt \
${srcdir}/BidiBrackets.txt | \
${srcdir}/unidata-gen.elc unidata.txt
- ifneq (,$(wildcard $@))
- $(AM_V_at)cd $(unidir) && \
- for f in charprop.el `sed -n 's/^;; FILE: //p' < charprop.el`; do \
- [ ! -f $$f ] || [ -w $$f ] || chmod +w $$f || exit; \
- done
- endif
- $(AM_V_GEN)${emacs} -L ${srcdir} -l unidata-gen -f unidata-gen-files \
- ${srcdir} "${unidir}"
-
-## Check for deleted uni- files, and if any such, force a rebuild.
-## Perhaps a more elegant way would be for the previous rule
-## to generate a Makefile fragment explicitly listing the uni- files,
-## which this file could include. If no fragment, rebuild everything.
-unifiles: ${unidir}/charprop.el
- $(AM_V_at)for f in `sed -n 's/^;; FILE: //p' < $<`; do \
- [ -f $(unidir)/$$f ] || exec $(MAKE) PHONY_EXTRAS=$< $<; \
- done
+ $(AM_V_at)[ ! -f $@ ] || chmod +w $@
+ $(AM_V_GEN)${emacs} -L ${srcdir} -l unidata-gen \
+ -f unidata-gen-file $@ ${srcdir}
.PHONY: charscript.el
## Cf leim/ja-dic (which is much slower).
extraclean:
rm -f ${top_srcdir}/src/macuvs.h ${unidir}/charscript.el*
- ifneq (,$(wildcard $(unidir)/charprop.el))
- cd $(unidir) && \
- rm -f `sed -n 's/^;; FILE: //p' < charprop.el` charprop.el
- endif
+ rm -f ${unifiles} ${unidir}/charprop.el
+
;; SPECIAL NOTICE
;;
;; This file must be byte-compilable/loadable by `temacs' and also
-;; the entry function `unidata-gen-files' must be runnable by `temacs'.
+;; the entry function `unidata-gen-file' must be runnable by `temacs'.
;; FILES TO BE GENERATED
;;
-;; The entry function `unidata-gen-files' generates these files in
-;; in directory specified by its dest-dir argument.
+;; The entry functions `unidata-gen-file' and `unidata-gen-charprop'
+;; generate these files:
;;
;; charprop.el
;; It contains a series of forms of this format:
;; Name of the directory containing files of Unicode Character Database.
-;; Dynamically bound in unidata-gen-files.
+;; Dynamically bound in unidata-gen-file.
(defvar unidata-dir nil)
(defun unidata-setup-list (unidata-text-file)
;; VAL-LIST: list of specially ordered property values
(defconst unidata-file-alist
- '(("uni-name.el"
+ '(
+ ;; NB this list is parsed by the Makefile to extract the names of
+ ;; the uni-*.el files, so preserve the formatting of those lines.
+ ("uni-name.el"
(name
1 unidata-gen-table-name
"Unicode character name.
char val1 char val2)))
(sit-for 0))))))))
+;; The entry functions. They generate files described in the header
+;; comment of this file.
+
(defun unidata-gen-file (&optional file data-dir unidata-text-file)
"Generate lisp file FILE from Unicode data."
(or file
(insert (format "(define-char-code-property '%S %S\n %S)\n"
(unidata-prop-prop proplist) (car elt)
(unidata-prop-docstring proplist)))))
- (message "Writing %s..." charprop-file)
+ (or noninteractive (message "Writing %s..." charprop-file))
(insert ";; Local Variables:\n"
";; coding: utf-8\n"
";; version-control: never\n"
(format ";; %s ends here\n"
(file-name-nondirectory charprop-file)))))
-;; The entry function. It generates files described in the header
-;; comment of this 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)
- 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)
- (coding-system-for-read 'utf-8)
- (unidata-dir data-dir))
- (unidata-setup-list unidata-text-file)
- (dolist (elt unidata-file-alist)
- (unidata-gen-file (expand-file-name (car elt) dest-dir)
- data-dir unidata-text-file))
- (unidata-gen-charprop (expand-file-name "charprop.el" dest-dir))))
-
\f
;;; unidata-gen.el ends here
;; This is because PATH_DUMPLOADSEARCH is just "../lisp".
(if (or (equal (member "bootstrap" command-line-args) '("bootstrap"))
;; FIXME this is irritatingly fragile.
- (equal (nth 4 command-line-args) "unidata-gen.el")
- (equal (nth 7 command-line-args) "unidata-gen-files")
+ (and (stringp (nth 4 command-line-args))
+ (string-match "^unidata-gen\\(\\.elc?\\)?$"
+ (nth 4 command-line-args)))
+ (member (nth 7 command-line-args) '("unidata-gen-file"
+ "unidata-gen-charprop"))
(if (fboundp 'dump-emacs)
(string-match "src/bootstrap-emacs" (nth 0 command-line-args))
t))