Avoid reuse of old dictionary when building new.

And simplify the _dict pattern rule.  If a build had completed in the
directory before and "make distclean" had not been run ??_dict
dictionaries still existed, if one of these was rebuilt espeak-ng
loaded the old (out of date) one first resulting in inconsistent
execution of the build the second time round.  The change removes the
target before building it thus ensuring that old, possibly damaged, data
is not used.

I also changed the extraction of the language code; the GNU make %
(pattern) extension along with the long-standing $* extension (which
precedes GNU make) allow the match to the '%' to be used directly in the
command line.  The cd .. at the end of the command is unnecessary; make
(all versions) execute each command line using a single system() call,
so the cd never happens inside make.

Signed-off-by: John Bowler <jbowler@acm.org>
This commit is contained in:
John Bowler
2021-04-29 10:43:56 -07:00
parent 18d807d680
commit 8954354ba1
+8 -2
View File
@@ -484,10 +484,16 @@ dictsource/%_emoji:
dictsource/%_extra:
touch $@
# NOTE: % (pattern) rules are GNU make specific we can extract the 'stem' that
# matched the % in the target ($@) using $(*F) (which isn't GNU make specific,
# just this interpretation is.)
#
# The rm $@ stops espeak-ng trying to load the old dictionary when it is run
# (at the cost of a spurious error message.)
espeak-ng-data/%_dict: src/espeak-ng phsource/phonemes.stamp
@echo " DICT $@"
@cd dictsource && ESPEAK_DATA_PATH=$(CURDIR) LD_LIBRARY_PATH=../src:${LD_LIBRARY_PATH} ../src/espeak-ng \
--compile=`echo $@ | sed -e 's,espeak-ng-data/,,g' -e 's,_dict,,g'` && cd ..
rm -f $@
cd dictsource && ESPEAK_DATA_PATH=$(CURDIR) ../src/espeak-ng --compile="$(*F)"
dictionaries: \
espeak-ng-data/af_dict \