-NM ?= nm
-
-# Syntax: $(call CMETRIC_o_h_template,<object_file>,<target_header>)
-define CMETRIC_o_h_template
-$(2): $(1)
- @$(QUIET_CMD_ECHO) " CMETRIC $$@"
- $(Q)if [ -n `dirname $$@` ] ; then \
- if [ ! -e `dirname $$@` ] ; then \
- mkdir -p `dirname $$@` ; fi ; fi
- $(Q)echo >$$@.tmp '/* Automatically generated from $$< */'
- $(Q)echo >>$$@.tmp '/* Conditionals to control compilation */'
-# Bellow, the tricks with redirection are for shells without set -o pipefail
-# (see http://www.mail-archive.com/dash@vger.kernel.org/msg00149.html)
- $(Q)exec 3>&1; status=`exec 4>&1 >&3; { $(NM) $$<; echo $$$$? >&4; }\
- | $(SED4OMK) -n 's/^ *0*\(0[0-9A-Fa-f]*\) *A *_cmetric2cond_\([A-Za-z_0-9]*\) */#define \2 0x\1/p' \
- | sort >>$$@.tmp` && exit $$$$status
- $(Q)echo >>$$@.tmp '/* Defines from the values defined to symbols in hexadecimal format */'
- $(Q)exec 3>&1; status=`exec 4>&1 >&3; { $(NM) $$<; echo $$$$? >&4; }\
- | $(SED4OMK) -n 's/^ *0*\(0[0-9A-Fa-f]*\) *A *_cmetric2def_\([A-Za-z_0-9]*\) */#define \2 0x\1/p' \
- | sort >>$$@.tmp` && exit $$$$status
- $(Q)echo >>$$@.tmp '/* Defines from the values defined to symbols in decimal format */'
- $(Q)exec 3>&1; status=`exec 4>&1 >&3; { $(NM) -td $$<; echo $$$$? >&4; }\
- | $(SED4OMK) -n 's/^ *0*\(0\|[1-9][0-9]*\) *A *_cmetric2defdec_\([A-Za-z_0-9]*\) */#define \2 \1/p' \
- | sort >>$$@.tmp` && exit $$$$status
- $(Q)mv $$@.tmp $$@
+# Syntax: $(call COMPILE_s_o_template,<source>,<target>,<additional c-flags>)
+define COMPILE_s_o_template
+ifeq ($$($(2)_s_TARGET),)
+$(2)_s_TARGET=1
+$(2): $(1) $$(GEN_HEADERS)
+ @$(QUIET_CMD_ECHO) " AS $$@"
+ $(Q)$$(S_o_COMPILE) $(3) -o $$@ -c $$<
+endif