From eadb436d5c09f7983c3a687086e5af6b6e9f5510 Mon Sep 17 00:00:00 2001
From: Yuta Saito <kateinoigakukun@gmail.com>
Date: Fri, 9 May 2025 23:48:27 +0800
Subject: [PATCH] Preserve file timestamps when copying files in the install
 target (#581)

This change makes it so that the timestamps of installed header files
are only updated when the contents of the header files change. This
change is beneficial for incremental builds of projects depending on
wasi-libc. For example, the Swift project builds wasi-libc as part of
its build process, and this change reduces the number of build products
in the Swift build that are unnecessarily rebuilt.

This is a 2nd attempt of
https://github.com/WebAssembly/wasi-libc/pull/530 but much simpler
thanks to @abrown 's build work
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 8a4f1a4a..4f5fb62b 100644
--- a/Makefile
+++ b/Makefile
@@ -816,7 +816,7 @@ endif
 
 install: finish
 	mkdir -p "$(INSTALL_DIR)"
-	cp -r "$(SYSROOT)/lib" "$(SYSROOT)/share" "$(SYSROOT)/include" "$(INSTALL_DIR)"
+	cp -p -r "$(SYSROOT)/lib" "$(SYSROOT)/share" "$(SYSROOT)/include" "$(INSTALL_DIR)"
 
 DEFINED_SYMBOLS = $(SYSROOT_SHARE)/defined-symbols.txt
 UNDEFINED_SYMBOLS = $(SYSROOT_SHARE)/undefined-symbols.txt
-- 
GitLab