From facdea659083095a6ec8bcc7aa322f683898739b Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 22 Dec 2019 21:12:52 +0100 Subject: 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. --- ChangeLog | 7 +++++++ lib/Makefile.am | 26 +++++++++++++++++--------- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index c52f289..ca1ca30 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2019-12-22 Bruno Haible + + 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. + 2019-12-22 Bruno Haible build: Update after gnulib changed. 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 # : @@ -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 -- cgit v1.2.1