From: Bruno Haible Date: Tue, 24 Dec 2019 16:37:00 +0000 (+0100) Subject: libtextstyle: Don't erase the .sym.in file if 'sed' is not GNU sed. X-Git-Tag: v0.20.2~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0036b12f77e451a10b9b6613c808bf5308cb87fb;p=thirdparty%2Fgettext.git libtextstyle: Don't erase the .sym.in file if 'sed' is not GNU sed. * libtextstyle/lib/Makefile.am (libtextstyle.sym.in): Test the exit status of the declared.sh command. Preserve the existing libtextstyle.sym if it failed. --- diff --git a/libtextstyle/lib/Makefile.am b/libtextstyle/lib/Makefile.am index 1b182a02f..ac9a0fe42 100644 --- a/libtextstyle/lib/Makefile.am +++ b/libtextstyle/lib/Makefile.am @@ -149,16 +149,24 @@ HEADERS_WITH_EXTERNS = \ # '-export-symbols', but we don't use this option, because it may prevent us # from building some of the unit tests. $(srcdir)/libtextstyle.sym.in : $(HEADERS_WITH_EXTERNS) - for f in $(HEADERS_WITH_EXTERNS); do \ - if test -f $$f; then \ - cat $$f; \ + if \ + for f in $(HEADERS_WITH_EXTERNS); do \ + if test -f $$f; then \ + cat $$f; \ + else \ + cat $(srcdir)/$$f; \ + fi; \ + done \ + | $(srcdir)/declared.sh > $@-t1; \ + then \ + LC_ALL=C sort < $@-t1 | LC_ALL=C uniq > $@-t2 && mv $@-t2 $@; \ + else \ + if test -f $@; then \ + echo "Continuing with existing libtextstyle.sym.in."; \ else \ - cat $(srcdir)/$$f; \ + exit 1; \ fi; \ - done \ - | $(srcdir)/declared.sh | LC_ALL=C sort | LC_ALL=C uniq \ - > $@-t - mv $@-t $@ + fi # We distribute it because declared.sh relies on GNU sed. # The GNU Coding Standards say in # : @@ -168,7 +176,7 @@ $(srcdir)/libtextstyle.sym.in : $(HEADERS_WITH_EXTERNS) # So Makefile rules to update them should put the updated files in the # source directory." # Therefore we put this file in the source directory, not the build directory. -MOSTLYCLEANFILES += libtextstyle.sym.in-t +MOSTLYCLEANFILES += libtextstyle.sym.in-t1 libtextstyle.sym.in-t2 MAINTAINERCLEANFILES += libtextstyle.sym.in EXTRA_DIST += libtextstyle.sym.in declared.sh