]> rtime.felk.cvut.cz Git - omk.git/commitdiff
cmetric: Generate the output to .tmp and rename it only after all steps are successful
authorMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 25 Sep 2009 12:57:03 +0000 (14:57 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 25 Sep 2009 12:57:03 +0000 (14:57 +0200)
snippets/linux.omk

index 2ba497a55306fe5fd7384d67d5ff64b6b6c20063..f45e230267684ec6a6c2bb859544a00909b7a81e 100644 (file)
@@ -239,15 +239,17 @@ $(2): $(1)
        $(Q)if [ -n `dirname $$@` ] ; then \
              if [ ! -e `dirname $$@` ] ; then \
                mkdir -p `dirname $$@` ; fi ; fi
-       $(Q)echo >$$@ '/* Automatically generated from $$< */'
-       $(Q)echo >>$$@ '/* Conditionals to control compilation */'
+       $(Q)echo >$$@.tmp '/* Automatically generated from $$< */'
+       $(Q)echo >>$$@.tmp '/* Conditionals to control compilation */'
+
        $(Q)set -o pipefail ; $(NM) $$< \
                | sed -n 's/^ *0*\(0[0-9A-Fa-f]*\) *A *_cmetric2cond_\([A-Za-z_0-9]*\) */#define \2 0x\1/p' \
-               | sort >>$$@
-       $(Q)echo >>$$@ '/* Defines from the values defined to symbols */'
+               | sort >>$$@.tmp
+       $(Q)echo >>$$@.tmp '/* Defines from the values defined to symbols */'
        $(Q)set -o pipefail ; $(NM) $$< \
                | sed -n 's/^ *0*\(0[0-9A-Fa-f]*\) *A *_cmetric2def_\([A-Za-z_0-9]*\) */#define \2 0x\1/p' \
-               | sort >>$$@
+               | sort >>$$@.tmp
+       $(Q)mv $$@.tmp $$@
 endef