aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorGlenn Morris2017-04-24 22:53:22 -0700
committerGlenn Morris2017-04-24 23:06:27 -0700
commit5b0fdefb4ca54b0d3dac3047ac1e4b380beb6ba7 (patch)
treeba51a863ba3114d3e7e075824971bf4094d184cd /admin
parentc1e71d3899daca49e216dfa3a6e6e07169d02e1e (diff)
downloademacs-5b0fdefb4ca54b0d3dac3047ac1e4b380beb6ba7.tar.gz
emacs-5b0fdefb4ca54b0d3dac3047ac1e4b380beb6ba7.zip
Generate each unicode lisp file independently
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.
Diffstat (limited to 'admin')
-rw-r--r--admin/unidata/Makefile.in45
-rw-r--r--admin/unidata/unidata-gen.el39
2 files changed, 31 insertions, 53 deletions
diff --git a/admin/unidata/Makefile.in b/admin/unidata/Makefile.in
index f58303b6d76..5cc43bc3718 100644
--- a/admin/unidata/Makefile.in
+++ b/admin/unidata/Makefile.in
@@ -33,6 +33,9 @@ EMACS = ${top_builddir}/src/emacs
33unidir = ${top_srcdir}/lisp/international 33unidir = ${top_srcdir}/lisp/international
34emacs = "${EMACS}" -batch --no-site-file --no-site-lisp 34emacs = "${EMACS}" -batch --no-site-file --no-site-lisp
35 35
36lparen = (
37unifiles = $(addprefix ${unidir}/,$(sort $(shell sed -n 's/^[ \t][ \t]*${lparen}"\(uni-[^"]*\)"$$/\1/p' ${srcdir}/unidata-gen.el)))
38
36# 'make' verbosity. 39# 'make' verbosity.
37AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 40AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
38 41
@@ -51,9 +54,10 @@ am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
51am__v_at_0 = @ 54am__v_at_0 = @
52am__v_at_1 = 55am__v_at_1 =
53 56
54.PHONY: all unifiles 57.PHONY: all
55 58
56all: ${top_srcdir}/src/macuvs.h unifiles ${unidir}/charscript.el 59all: ${top_srcdir}/src/macuvs.h ${unifiles} ${unidir}/charscript.el \
60 ${unidir}/charprop.el
57 61
58## Specify .elc as an order-only prereq so as to not needlessly rebuild 62## Specify .elc as an order-only prereq so as to not needlessly rebuild
59## target just because the .elc is missing. 63## target just because the .elc is missing.
@@ -71,30 +75,21 @@ unidata.txt: ${srcdir}/UnicodeData.txt
71 $(AM_V_GEN)sed -e 's/\([^;]*\);\(.*\)/(#x\1 "\2")/' -e 's/;/" "/g' \ 75 $(AM_V_GEN)sed -e 's/\([^;]*\);\(.*\)/(#x\1 "\2")/' -e 's/;/" "/g' \
72 < $< > $@ 76 < $< > $@
73 77
74PHONY_EXTRAS = 78## charprop doesn't actually depend on unifiles, but for now at least
75.PHONY: $(PHONY_EXTRAS) 79## pretend that it does since other Makefiles assume that if charprop
80## is up-to-date, the unifiles are too.
81${unidir}/charprop.el: ${unifiles} ${srcdir}/unidata-gen.el | ${srcdir}/unidata-gen.elc
82 $(AM_V_at)[ ! -f $@ ] || chmod +w $@
83 $(AM_V_GEN)${emacs} -L ${srcdir} -l unidata-gen \
84 -f unidata-gen-charprop $@
76 85
77${unidir}/charprop.el: ${srcdir}/unidata-gen.el \ 86${unifiles}: ${srcdir}/unidata-gen.el \
78 ${srcdir}/UnicodeData.txt ${srcdir}/BidiMirroring.txt \ 87 ${srcdir}/UnicodeData.txt ${srcdir}/BidiMirroring.txt \
79 ${srcdir}/BidiBrackets.txt | \ 88 ${srcdir}/BidiBrackets.txt | \
80 ${srcdir}/unidata-gen.elc unidata.txt 89 ${srcdir}/unidata-gen.elc unidata.txt
81 ifneq (,$(wildcard $@)) 90 $(AM_V_at)[ ! -f $@ ] || chmod +w $@
82 $(AM_V_at)cd $(unidir) && \ 91 $(AM_V_GEN)${emacs} -L ${srcdir} -l unidata-gen \
83 for f in charprop.el `sed -n 's/^;; FILE: //p' < charprop.el`; do \ 92 -f unidata-gen-file $@ ${srcdir}
84 [ ! -f $$f ] || [ -w $$f ] || chmod +w $$f || exit; \
85 done
86 endif
87 $(AM_V_GEN)${emacs} -L ${srcdir} -l unidata-gen -f unidata-gen-files \
88 ${srcdir} "${unidir}"
89
90## Check for deleted uni- files, and if any such, force a rebuild.
91## Perhaps a more elegant way would be for the previous rule
92## to generate a Makefile fragment explicitly listing the uni- files,
93## which this file could include. If no fragment, rebuild everything.
94unifiles: ${unidir}/charprop.el
95 $(AM_V_at)for f in `sed -n 's/^;; FILE: //p' < $<`; do \
96 [ -f $(unidir)/$$f ] || exec $(MAKE) PHONY_EXTRAS=$< $<; \
97 done
98 93
99 94
100.PHONY: charscript.el 95.PHONY: charscript.el
@@ -123,7 +118,5 @@ maintainer-clean: distclean
123## Cf leim/ja-dic (which is much slower). 118## Cf leim/ja-dic (which is much slower).
124extraclean: 119extraclean:
125 rm -f ${top_srcdir}/src/macuvs.h ${unidir}/charscript.el* 120 rm -f ${top_srcdir}/src/macuvs.h ${unidir}/charscript.el*
126 ifneq (,$(wildcard $(unidir)/charprop.el)) 121 rm -f ${unifiles} ${unidir}/charprop.el
127 cd $(unidir) && \ 122
128 rm -f `sed -n 's/^;; FILE: //p' < charprop.el` charprop.el
129 endif
diff --git a/admin/unidata/unidata-gen.el b/admin/unidata/unidata-gen.el
index 5f3cd1c8d3e..cdd7ff01db4 100644
--- a/admin/unidata/unidata-gen.el
+++ b/admin/unidata/unidata-gen.el
@@ -26,12 +26,12 @@
26;; SPECIAL NOTICE 26;; SPECIAL NOTICE
27;; 27;;
28;; This file must be byte-compilable/loadable by `temacs' and also 28;; This file must be byte-compilable/loadable by `temacs' and also
29;; the entry function `unidata-gen-files' must be runnable by `temacs'. 29;; the entry function `unidata-gen-file' must be runnable by `temacs'.
30 30
31;; FILES TO BE GENERATED 31;; FILES TO BE GENERATED
32;; 32;;
33;; The entry function `unidata-gen-files' generates these files in 33;; The entry functions `unidata-gen-file' and `unidata-gen-charprop'
34;; in directory specified by its dest-dir argument. 34;; generate these files:
35;; 35;;
36;; charprop.el 36;; charprop.el
37;; It contains a series of forms of this format: 37;; It contains a series of forms of this format:
@@ -94,7 +94,7 @@
94 94
95;; Name of the directory containing files of Unicode Character Database. 95;; Name of the directory containing files of Unicode Character Database.
96 96
97;; Dynamically bound in unidata-gen-files. 97;; Dynamically bound in unidata-gen-file.
98(defvar unidata-dir nil) 98(defvar unidata-dir nil)
99 99
100(defun unidata-setup-list (unidata-text-file) 100(defun unidata-setup-list (unidata-text-file)
@@ -167,7 +167,10 @@
167;; VAL-LIST: list of specially ordered property values 167;; VAL-LIST: list of specially ordered property values
168 168
169(defconst unidata-file-alist 169(defconst unidata-file-alist
170 '(("uni-name.el" 170 '(
171 ;; NB this list is parsed by the Makefile to extract the names of
172 ;; the uni-*.el files, so preserve the formatting of those lines.
173 ("uni-name.el"
171 (name 174 (name
172 1 unidata-gen-table-name 175 1 unidata-gen-table-name
173 "Unicode character name. 176 "Unicode character name.
@@ -1388,6 +1391,9 @@ Property value is a symbol `o' (Open), `c' (Close), or `n' (None)."
1388 char val1 char val2))) 1391 char val1 char val2)))
1389 (sit-for 0)))))))) 1392 (sit-for 0))))))))
1390 1393
1394;; The entry functions. They generate files described in the header
1395;; comment of this file.
1396
1391(defun unidata-gen-file (&optional file data-dir unidata-text-file) 1397(defun unidata-gen-file (&optional file data-dir unidata-text-file)
1392 "Generate lisp file FILE from Unicode data." 1398 "Generate lisp file FILE from Unicode data."
1393 (or file 1399 (or file
@@ -1443,7 +1449,7 @@ Property value is a symbol `o' (Open), `c' (Close), or `n' (None)."
1443 (insert (format "(define-char-code-property '%S %S\n %S)\n" 1449 (insert (format "(define-char-code-property '%S %S\n %S)\n"
1444 (unidata-prop-prop proplist) (car elt) 1450 (unidata-prop-prop proplist) (car elt)
1445 (unidata-prop-docstring proplist))))) 1451 (unidata-prop-docstring proplist)))))
1446 (message "Writing %s..." charprop-file) 1452 (or noninteractive (message "Writing %s..." charprop-file))
1447 (insert ";; Local Variables:\n" 1453 (insert ";; Local Variables:\n"
1448 ";; coding: utf-8\n" 1454 ";; coding: utf-8\n"
1449 ";; version-control: never\n" 1455 ";; version-control: never\n"
@@ -1453,27 +1459,6 @@ Property value is a symbol `o' (Open), `c' (Close), or `n' (None)."
1453 (format ";; %s ends here\n" 1459 (format ";; %s ends here\n"
1454 (file-name-nondirectory charprop-file))))) 1460 (file-name-nondirectory charprop-file)))))
1455 1461
1456;; The entry function. It generates files described in the header
1457;; comment of this file.
1458
1459;; Write files (charprop.el, uni-*.el) to dest-dir (default PWD),
1460;; using as input files from data-dir, and
1461;; unidata-text-file (default "unidata.txt" in PWD).
1462(defun unidata-gen-files (&optional data-dir dest-dir unidata-text-file)
1463 (or data-dir
1464 (setq data-dir (pop command-line-args-left)
1465 dest-dir (or (pop command-line-args-left) default-directory)
1466 unidata-text-file (or (pop command-line-args-left)
1467 (expand-file-name "unidata.txt"))))
1468 (let ((coding-system-for-write 'utf-8-unix)
1469 (coding-system-for-read 'utf-8)
1470 (unidata-dir data-dir))
1471 (unidata-setup-list unidata-text-file)
1472 (dolist (elt unidata-file-alist)
1473 (unidata-gen-file (expand-file-name (car elt) dest-dir)
1474 data-dir unidata-text-file))
1475 (unidata-gen-charprop (expand-file-name "charprop.el" dest-dir))))
1476
1477 1462
1478 1463
1479;;; unidata-gen.el ends here 1464;;; unidata-gen.el ends here