From c1cced632a40f8a6a9d2b868ee0618845e3eec74 Mon Sep 17 00:00:00 2001
From: Albert Graef <aggraef@gmail.com>
Date: Thu, 8 Mar 2018 08:28:03 +0100
Subject: [PATCH] Only regenerate s_stuff.h when needed, to avoid unneeded
 recompiles.

---
 packages/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/packages/Makefile b/packages/Makefile
index f5c1f8c09..e8600923c 100644
--- a/packages/Makefile
+++ b/packages/Makefile
@@ -377,8 +377,9 @@ doc_format:
 # from the latter by substituting PD_BUILD_VERSION.
 
 git_version: $(pd_src)/src/s_stuff.h.in
-	cd $(pd_src)/src/ && \
-	sed 's|^\(#define PD_BUILD_VERSION "\).*"|\1$(PD_BUILD_VERSION)"|' s_stuff.h.in > s_stuff.h
+	@cd $(pd_src)/src/ && \
+	sed 's|^\(#define PD_BUILD_VERSION "\).*"|\1$(PD_BUILD_VERSION)"|' s_stuff.h.in > s_stuff.h.new && \
+	(test -f s_stuff.h && diff -q s_stuff.h s_stuff.h.new > /dev/null && rm -f s_stuff.h.new && echo s_stuff.h unchanged || (rm -f s_stuff.h && mv s_stuff.h.new s_stuff.h))
 
 set_version:
 # change Pd's version number to reflect the extended build
-- 
GitLab