Patchwork [1/2] Makefile: fix config-devices.mak generation

login
register
mail settings
Submitter Blue Swirl
Date Sept. 26, 2010, 9:05 a.m.
Message ID <AANLkTimdPt0Ne6m4LMGqDxLTqKG8Dgrpc3jwznsrQv=L@mail.gmail.com>
Download mbox | patch
Permalink /patch/65775/
State New
Headers show

Comments

Blue Swirl - Sept. 26, 2010, 9:05 a.m.
The logic of detecting changes in default-configs/*.mak is
flawed as can be demonstrated by 'touch default-configs/*.mak'
followed by make. This results in a message claiming that user
made changes to the */config-devices.mak files.

Fix by separating the detection of changes made by the user and
changes in the default-configs.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
 Makefile |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

Patch

diff --git a/Makefile b/Makefile
index 090d632..ff39025 100644
--- a/Makefile
+++ b/Makefile
@@ -43,9 +43,11 @@  config-all-devices.mak: $(SUBDIR_DEVICES_MAK)
 %/config-devices.mak: default-configs/%.mak
 	$(call quiet-command,cat $< > $@.tmp, "  GEN   $@")
 	@if test -f $@; then \
-	  if cmp -s $@.old $@ || cmp -s $@ $@.tmp; then \
-	    mv $@.tmp $@; \
-	    cp -p $@ $@.old; \
+	  if cmp -s $@.old $@; then \
+	    if ! cmp -s $@ $@.tmp; then \
+	      mv $@.tmp $@; \
+	      cp -p $@ $@.old; \
+	    fi; \
 	  else \
 	    if test -f $@.old; then \
 	      echo "WARNING: $@ (user modified) out of date.";\