On 12/20/2009 08:39 AM, Stefan Weil wrote:
This makes rebuilds after source updates easier
for most users (who don't edit config-devices.mak).
Signed-off-by: Stefan Weil<w...@mail.berlios.de>\
Applied. Thanks.
Regards,
Anthony Liguori
---
Makefile | 20 +++++++++++++++-----
1 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index c1fa08c..684365d 100644
--- a/Makefile
+++ b/Makefile
@@ -43,12 +43,22 @@ config-all-devices.mak: $(SUBDIR_DEVICES_MAK)
%/config-devices.mak: default-configs/%.mak
$(call quiet-command,cat $< > $...@.tmp, " GEN $@")
- @if test -f $@ ; then \
- echo "WARNING: $@ out of date." ;\
- echo "Run \"make defconfig\" to regenerate." ; \
- rm $...@.tmp ; \
+ @if test -f $@; then \
+ if cmp -s $...@.old $@ || cmp -s $@ $...@.tmp; then \
+ mv $...@.tmp $@; \
+ cp -p $@ $...@.old; \
+ else \
+ if test -f $...@.old; then \
+ echo "WARNING: $@ (user modified) out of date.";\
+ else \
+ echo "WARNING: $@ out of date.";\
+ fi; \
+ echo "Run \"make defconfig\" to regenerate."; \
+ rm $...@.tmp; \
+ fi; \
else \
- mv $...@.tmp $@ ; \
+ mv $...@.tmp $@; \
+ cp -p $@ $...@.old; \
fi
defconfig: