$(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