public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: Makefile: only regenerate cygwin_version.c if it changes
Date: Tue, 13 Dec 2022 13:16:37 +0000 (GMT)	[thread overview]
Message-ID: <20221213131637.914C838533F7@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=f34db341fc8d6dbec37946dc537331be50f90343

commit f34db341fc8d6dbec37946dc537331be50f90343
Author:     Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Tue Dec 13 13:25:06 2022 +0100
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Tue Dec 13 14:16:13 2022 +0100

    Cygwin: Makefile: only regenerate cygwin_version.c if it changes
    
    Make sure to create a new cygwin_version.c if it either doesn't
    exist yet, or if it would be different from the former file.
    This avoids unnecessary DLL rebuilding.
    
    Fixes: 97eb64b909bc ("Cygwin: uname: generate default release string from git as well")
    Fixes: 4949a82cde98 ("Cygwin: uname: fix building in non-git source dir")
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/Makefile.am | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/Makefile.am b/winsup/cygwin/Makefile.am
index e61f72716e10..cf12b97f838a 100644
--- a/winsup/cygwin/Makefile.am
+++ b/winsup/cygwin/Makefile.am
@@ -419,12 +419,20 @@ dirs = $(srcdir) $(srcdir)/fhandler $(srcdir)/lib $(srcdir)/libc $(srcdir)/math
 find_src_files = $(wildcard $(dir)/*.[chS]) $(wildcard $(dir)/*.cc)
 src_files := $(foreach dir,$(dirs),$(find_src_files))
 
+# Regenerate uname_version.c only if it doesn't exist or if it differs
+# from the former uname_version.c
 uname_version.c: .FORCE
 	$(AM_V_GEN)cd $(srcdir) && \
 	echo "const char *uname_dev_version = \
 	\"$$(git rev-parse --git-dir >/dev/null 2>&1 && \
 	     git describe --dirty | sed -e 's/cygwin-//')\";" \
-	     > $(abs_builddir)/uname_version.c
+	     > $(abs_builddir)/uname_version-pre.c && \
+	if [ -f $(abs_builddir)/uname_version.c ] && \
+	   cmp $(abs_builddir)/uname_version.c \
+	       $(abs_builddir)/uname_version-pre.c >/dev/null 2>&1 ; \
+	then :; else \
+	       mv $(abs_builddir)/uname_version-pre.c \
+		  $(abs_builddir)/uname_version.c; fi
 .FORCE:
 
 # mkvers.sh creates version.cc in the first place, winver.o always

                 reply	other threads:[~2022-12-13 13:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221213131637.914C838533F7@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).