Regenerate semantic grammars if the generating code changes

* admin/grammars/Makefile.in (emacs): Set load-prefer-newer.
(grammar_bovine, grammar_wisent): New variables.
(${bovinedir}/%-by.el, ${bovinedir}/scm-by.el)
(${cedetdir}/semantic/%-wy.el, ${wisentdir}/%-wy.el)
(${wisentdir}/javat-wy.el, ${cedetdir}/srecode/srt-wy.el):
Depend on the source file for the generating function.
* lisp/cedet/semantic/bovine/grammar.el (bovine--make-parser-1):
* lisp/cedet/semantic/wisent/grammar.el (wisent--make-parser-1):
Force generation of the output file.  The previous "is the output
newer than the input" failed to account for changes in the
generation code itself.  Force so we can let make figure it out.
This commit is contained in:
Glenn Morris 2021-04-04 16:57:55 -07:00
parent 258a17855b
commit 9cb3db0bad
3 changed files with 12 additions and 12 deletions

View file

@ -34,7 +34,7 @@ top_builddir = @top_builddir@
unexport EMACSDATA EMACSDOC EMACSPATH
EMACS = ${top_builddir}/src/emacs
emacs = EMACSLOADPATH= "${EMACS}" -batch --no-site-file --no-site-lisp
emacs = EMACSLOADPATH= "${EMACS}" -batch --no-site-file --no-site-lisp --eval '(setq load-prefer-newer t)'
make_bovine = ${emacs} -l semantic/bovine/grammar -f bovine-batch-make-parser
make_wisent = ${emacs} -l semantic/wisent/grammar -f wisent-batch-make-parser
@ -43,6 +43,9 @@ cedetdir = ${top_srcdir}/lisp/cedet
bovinedir = ${cedetdir}/semantic/bovine
wisentdir = ${cedetdir}/semantic/wisent
grammar_bovine = ${bovinedir}/grammar.el
grammar_wisent = ${wisentdir}/grammar.el
BOVINE = \
${bovinedir}/c-by.el \
${bovinedir}/make-by.el \
@ -68,36 +71,33 @@ bovine: ${BOVINE}
wisent: ${WISENT}
## TODO add dependencies on semantic/{bovine,wisent}/grammar.el
## c-by.el, make-by.el.
${bovinedir}/%-by.el: ${srcdir}/%.by
${bovinedir}/%-by.el: ${srcdir}/%.by ${grammar_bovine}
$(AM_V_GEN)[ ! -f "$@" ] || chmod +w "$@"
$(AM_V_at)${make_bovine} -o "$@" $<
${bovinedir}/scm-by.el: ${srcdir}/scheme.by
${bovinedir}/scm-by.el: ${srcdir}/scheme.by ${grammar_bovine}
$(AM_V_GEN)[ ! -f "$@" ] || chmod +w "$@"
$(AM_V_at)${make_bovine} -o "$@" $<
## grammar-wy.el
${cedetdir}/semantic/%-wy.el: ${srcdir}/%.wy
${cedetdir}/semantic/%-wy.el: ${srcdir}/%.wy ${grammar_wisent}
$(AM_V_GEN)[ ! -f "$@" ] || chmod +w "$@"
$(AM_V_at)${make_wisent} -o "$@" $<
## js-wy.el, python-wy.el
${wisentdir}/%-wy.el: ${srcdir}/%.wy
${wisentdir}/%-wy.el: ${srcdir}/%.wy ${grammar_wisent}
$(AM_V_GEN)[ ! -f "$@" ] || chmod +w "$@"
$(AM_V_at)${make_wisent} -o "$@" $<
${wisentdir}/javat-wy.el: ${srcdir}/java-tags.wy
${wisentdir}/javat-wy.el: ${srcdir}/java-tags.wy ${grammar_wisent}
$(AM_V_GEN)[ ! -f "$@" ] || chmod +w "$@"
$(AM_V_at)${make_wisent} -o "$@" $<
${cedetdir}/srecode/srt-wy.el: ${srcdir}/srecode-template.wy
${cedetdir}/srecode/srt-wy.el: ${srcdir}/srecode-template.wy ${grammar_wisent}
$(AM_V_GEN)[ ! -f "$@" ] || chmod +w "$@"
$(AM_V_at)${make_wisent} -o "$@" $<
.PHONY: distclean bootstrap-clean maintainer-clean extraclean gen-clean
distclean:

View file

@ -475,7 +475,7 @@ Menu items are appended to the common grammar menu.")
(with-current-buffer (find-file-noselect infile)
(setq infile buffer-file-name)
(if outdir (setq default-directory outdir))
(semantic-grammar-create-package nil t))
(semantic-grammar-create-package t t))
(error (message "%s" (error-message-string err)) nil)))
lang filename copyright-end)
(when (and packagename

View file

@ -477,7 +477,7 @@ Menu items are appended to the common grammar menu.")
(condition-case err
(with-current-buffer (find-file-noselect infile)
(if outdir (setq default-directory outdir))
(semantic-grammar-create-package nil t))
(semantic-grammar-create-package t t))
(error (message "%s" (error-message-string err)) nil)))
output-data)
(when (setq output-data (assoc packagename wisent-make-parsers--parser-file-name))