summaryrefslogtreecommitdiff
path: root/scripts/Makefile.lib
diff options
context:
space:
mode:
authorSam Ravnborg <sam@mars.ravnborg.org>2004-10-27 04:07:03 +0200
committerSam Ravnborg <sam@mars.ravnborg.org>2004-10-27 04:07:03 +0200
commit298039e7b2dc1bd12cb2944707ede23c8af770c4 (patch)
tree2a5e7c2b681f7c97d64c276c91184bcc7406fadf /scripts/Makefile.lib
parent6a7cb7739139cd5994a2be73e9c4088a70a568c2 (diff)
kbuild/usr: initramfs list fixed and simplified
Moving logic to scripts/gen_initramfs_list.sh make a nice cleanup in usr/Makefile. A new initramfs image will be generated if the initramfs_list file changes. This patch also fixes the bug with make O=.. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/Makefile.lib')
-rw-r--r--scripts/Makefile.lib27
1 files changed, 27 insertions, 0 deletions
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 3a7663b901f0..6e75ced8b583 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -232,3 +232,30 @@ descend =$(Q)$(MAKE) -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build ob
# Usage:
# $(Q)$(MAKE) $(build)=dir
build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
+
+# filechk is used to check if the content of a generated file is updated.
+# Sample usage:
+# define filechk_sample
+# echo $KERNELRELEASE
+# endef
+# version.h : Makefile
+# $(call filechk,sample)
+# The rule defined shall write to stdout the content of the new file.
+# The existing file will be compared with the new one.
+# - If no file exist it is created
+# - If the content differ the new file is used
+# - If they are equal no change, and no timestamp update
+
+define filechk
+ $(Q)set -e; \
+ echo ' CHK $@'; \
+ mkdir -p $(dir $@); \
+ $(filechk_$(1)) $(2) > $@.tmp; \
+ if [ -r $@ ] && cmp -s $@ $@.tmp; then \
+ rm -f $@.tmp; \
+ else \
+ echo ' UPD $@'; \
+ mv -f $@.tmp $@; \
+ fi
+endef
+