diff options
author | Bruno Haible <bruno@clisp.org> | 2019-12-22 21:12:52 +0100 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2019-12-22 21:12:52 +0100 |
commit | facdea659083095a6ec8bcc7aa322f683898739b (patch) | |
tree | c964ba71f13835cbac3b19cea1001d0f1072a230 /lib/Makefile.am | |
parent | e741a0f18c571a20c0bc86c5bbfd6bb565ac44f7 (diff) | |
download | libunistring-facdea659083095a6ec8bcc7aa322f683898739b.tar.gz |
build: Don't erase the .sym file if 'sed' is not GNU sed.
* lib/Makefile.am (libunistring.sym): Test the exit status of the
declared.sh command. Preserve the existing libunistring.sym if it
failed.
Diffstat (limited to 'lib/Makefile.am')
-rw-r--r-- | lib/Makefile.am | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am index aa32f57..3798a0a 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -242,16 +242,24 @@ HEADERS_WITH_EXTERNS = \ # '-export-symbols', but we don't use this option, because it would prevent us # from building some of the gnulib unit tests. $(srcdir)/libunistring.sym : $(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 libunistring.sym."; \ 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 # <https://www.gnu.org/prep/standards/html_node/Makefile-Basics.html>: @@ -261,7 +269,7 @@ $(srcdir)/libunistring.sym : $(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 += libunistring.sym-t +MOSTLYCLEANFILES += libunistring.sym-t1 libunistring.sym-t2 MAINTAINERCLEANFILES += libunistring.sym EXTRA_DIST += libunistring.sym declared.sh |