diff Makefile @ 2368:5e6e989cb349

Improve "make cleanup-style" to touch only files that have to be fixed
author Volker Grabsch <vog@notjusthosting.com>
date Fri, 30 Mar 2012 09:12:14 +0200
parents 1726cefccf0c
children 4f5f4af84b12
line wrap: on
line diff
--- a/Makefile	Fri Mar 30 08:08:03 2012 +0200
+++ b/Makefile	Fri Mar 30 09:12:14 2012 +0200
@@ -220,14 +220,17 @@
 
 cleanup-style:
 	@$(foreach FILE,$(wildcard $(addprefix $(TOP_DIR)/,Makefile index.html CNAME src/*.mk src/*test.* tools/*)),\
-            echo '[cleanup] $(FILE)'; \
-            $(SED) -i ' \
+            $(SED) ' \
                 s/\r//g; \
                 s/[ \t]\+$$//; \
                 s,^#!/bin/bash$$,#!/usr/bin/env bash,; \
                 $(if $(filter %Makefile,$(FILE)),,\
                     s/\t/    /g; \
                 ) \
-            ' $(FILE); \
+            ' < $(FILE) > $(TOP_DIR)/tmp-cleanup-style; \
+            diff -u $(FILE) $(TOP_DIR)/tmp-cleanup-style >/dev/null \
+                || { echo '[cleanup] $(FILE)'; \
+                     cp $(TOP_DIR)/tmp-cleanup-style $(FILE); }; \
+            rm -f $(TOP_DIR)/tmp-cleanup-style; \
         )