Makefile: fix config-devices.mak generation
authorBlue Swirl <blauwirbel@gmail.com>
Sat, 2 Oct 2010 14:28:08 +0000 (14:28 +0000)
committerBlue Swirl <blauwirbel@gmail.com>
Sat, 2 Oct 2010 14:28:08 +0000 (14:28 +0000)
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

index fca1e7a51fee877ca1dca9b1e5e1317311c0890f..7c71c83a18adb1ec0c867fa68f216048559bf4cb 100644 (file)
--- 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.";\