Rombobjörn

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--comfignat.mk13
1 files changed, 12 insertions, 1 deletions
diff --git a/comfignat.mk b/comfignat.mk
index ab709ba..aea3103 100644
--- a/comfignat.mk
+++ b/comfignat.mk
@@ -85,6 +85,17 @@ stagedir = ${builddir}/stage
# installed are written to stagedir, and then copied to their destination in
# the installation step.
+ifeq (${DESTDIR},)
+ install_cp_flags =
+else
+ install_cp_flags = --preserve=timestamps
+endif
+# Timestamps are preserved when installation is done to a staging directory.
+# This matters for files that aren't generated during the build but copied from
+# the source tree. Timestamps are not preserved when installation is done
+# directly to the target system, because that would change the timestamps of
+# existing directories.
+
#
# Containing makefiles should assign or append to these variables as needed:
@@ -213,7 +224,7 @@ ${stagedir}:
install: ${stagedir}
mkdir -p "${DESTDIR}/"
- cp -RPpf "${stagedir}"/* "${DESTDIR}/"
+ cp -RPf ${install_cp_flags} "${stagedir}"/* "${DESTDIR}/"
.PHONY: install
clean::