]> git.eshelyaron.com Git - emacs.git/commitdiff
Generate each unicode lisp file independently
authorGlenn Morris <rgm@gnu.org>
Tue, 25 Apr 2017 05:53:22 +0000 (22:53 -0700)
committerGlenn Morris <rgm@gnu.org>
Tue, 25 Apr 2017 06:06:27 +0000 (23:06 -0700)
This is better for parallel builds, eg it eliminates race
conditions from having one process write multiple files.
* admin/unidata/Makefile.in (lparen, unifiles): New variables.
Parse unidata-gen.el, not charprop.el, to get the list of uni- files.
(all): Explicitly list the output lisp files.
(PHONY_EXTRAS): Remove.
(${unidir}/charprop.el): Change rule to just be for this file.
(${unifiles}): New rule to write each unicode lisp file.
(extraclean): Simplify.
* admin/unidata/unidata-gen.el (unidata-gen-charprop):
Quieten in batch mode.
(unidata-gen-files): Remove, no longer used.
* lisp/loadup.el: Update command-line parser.

admin/unidata/Makefile.in
admin/unidata/unidata-gen.el
lisp/loadup.el

index f58303b6d76fa1d745c6b6cc53d2eee3098892eb..5cc43bc3718eddb6924498fda18b42a20c70e9c6 100644 (file)
@@ -33,6 +33,9 @@ EMACS = ${top_builddir}/src/emacs
 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@
 
@@ -51,9 +54,10 @@ am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
 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.
@@ -71,30 +75,21 @@ unidata.txt: ${srcdir}/UnicodeData.txt
        $(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
@@ -123,7 +118,5 @@ maintainer-clean: distclean
 ## 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
+
index 5f3cd1c8d3ed1629955907c935cf945e10ef31a5..cdd7ff01db4c02825c3cb693c6b361282914cb5d 100644 (file)
 ;; 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:
@@ -94,7 +94,7 @@
 
 ;; 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.
@@ -1388,6 +1391,9 @@ Property value is a symbol `o' (Open), `c' (Close), or `n' (None)."
                                  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
@@ -1443,7 +1449,7 @@ Property value is a symbol `o' (Open), `c' (Close), or `n' (None)."
        (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"
@@ -1453,27 +1459,6 @@ Property value is a symbol `o' (Open), `c' (Close), or `n' (None)."
            (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
index 112282740a89f5be50e9b969a29f2373c6de7567..9dc43daa3a0f8478bcaad4ab3c6dedc99ca1dfba 100644 (file)
 ;; 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))