]> rtime.felk.cvut.cz Git - omk.git/commitdiff
Move cmetric rules to a separate snippet
authorMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 25 Nov 2013 16:22:45 +0000 (17:22 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 25 Nov 2013 16:22:45 +0000 (17:22 +0100)
snippets/Makefile.rules.linux
snippets/Makefile.rules.rtems
snippets/Makefile.rules.sysless
snippets/gcc.omk
snippets/linux.omk
snippets/rtems.omk
snippets/sdcc.omk
snippets/sysless.omk
snippets/vxworks.omk

index bbe3d719e73fab499118e66f50e011a9cf8312ef..f01dceb6a280dec5a6cd84e0a927330b1b60b593 100644 (file)
@@ -4,6 +4,7 @@ include wvtest.omk #omkbuild
 include include.omk #omkbuild
 include linux.omk #omkbuild
 include linux-kernel.omk #omkbuild
+include cmetric.omk #omkbuild
 include config_h.omk #omkbuild
 include qt.omk #omkbuild
 include sources-list.omk #omkbuild
index 231865f4c04da8123a055e9c177c6619cf7ddf60..4e1307997af6a5ebebd014e1838af4cf989feec3 100644 (file)
@@ -2,5 +2,6 @@ OMK_RULES_TYPE=rtems
 include base.omk #omkbuild
 include include.omk #omkbuild
 include rtems.omk #omkbuild
+include cmetric.omk #omkbuild
 include config_h.omk #omkbuild
 include sources-list.omk #omkbuild
index 3b6162d5023832b3db73dfa31e39a8d0b43c543a..14b3532893fcfbad71fd25cb484ff53b61c61385 100644 (file)
@@ -3,6 +3,7 @@ include base.omk #omkbuild
 include gcc.omk #omkbuild
 include include.omk #omkbuild
 include sysless.omk #omkbuild
+include cmetric.omk #omkbuild
 include config_h.omk #omkbuild
 include sources-list.omk #omkbuild
 include localeval.omk #omkbuild
index fc16cdb55c3cbbe9205598239fa15c6764a13a1c..142fdb8a72b7dc939b96abb82722c6f12e54e51a 100644 (file)
@@ -30,8 +30,6 @@
 # COMPILE_c_o_template, COMPILE_cc_o_template, COMPILE_S_o_template -
 # templates that create rules for compilation of sources
 
-# CMETRIC_o_h_template - FIXME
-
 # PROGRAM_template, LIBRARY_template, SOLIB_template - templates that
 # create rules for compilation of a program, library and shared
 # library. The rules can use rules produced by COMPILE_xxx_template.
@@ -122,31 +120,6 @@ $(2): $(1) $$(GEN_HEADERS)
        fi
 endef
 
-# 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 $$@
-endef
-
 # Syntax: $(call PROGRAM_template,<executable-name>,<dir>,<link-variant>)
 define PROGRAM_template
 
index cad9e677456a52c7fe5625bf4062f735550e6cfb..d65ccd0517f38fcb34a3527fdd94cf3985cf5742 100644 (file)
@@ -167,33 +167,6 @@ $(2): $(1) $$(GEN_HEADERS)
 endif
 endef
 
-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 $$@
-endef
-
 # Syntax: $(call COMPILE_idl_template,</path/to/src.idl>,<basename>)
 define COMPILE_idl_template
 
@@ -310,19 +283,6 @@ $(OMK_WORK_DIR)/lib$(1).$(SOLIB_EXT).omkvar: $(TARGET_LOBJS)
 library-pass-local: $(OMK_WORK_DIR)/lib$(1).$(SOLIB_EXT).omkvar
 endef
 
-library-pass-local: $(addprefix $(USER_INCLUDE_DIR)/,$(cmetric_include_HEADERS)) \
-
-# Special rules for CMETRIC generated headers
-
-$(foreach cmetrh,$(cmetric_include_HEADERS),$(eval $(call COMPILE_c_o_template,\
-               $(SOURCES_DIR)/$($(basename $(notdir $(cmetrh)))_CMETRIC_SOURCES),\
-               $($(basename $(notdir $(cmetrh)))_CMETRIC_SOURCES:%.c=%.o),)))
-$(foreach cmetrh,$(cmetric_include_HEADERS),$(eval $(call CMETRIC_o_h_template,\
-               $($(basename $(notdir $(cmetrh)))_CMETRIC_SOURCES:%.c=%.o),\
-               $(addprefix $(USER_INCLUDE_DIR)/,$(cmetrh)))))
-
-GEN_HEADERS+=$(cmetric_include_HEADERS:%=$(USER_INCLUDE_DIR)/%)
-
 # Generate rules for compilation of programs and libraries
 
 $(foreach prog,$(utils_PROGRAMS),$(eval $(call PROGRAM_template,$(prog),$(USER_UTILS_DIR),$(EXE_SUFFIX))))
@@ -371,7 +331,7 @@ $(foreach lib,$(shared_libs),$(eval $(call solib_link_template,$(lib))))
 link-shared-libs: $(shared_libs:%=$(USER_LIB_DIR)/lib%.$(SOLIB_EXT))
 endif # link-shared-libs
 
-$(eval $(call omk_pass_template, library-pass,$(USER_OBJS_DIR),USER_RULE_TEMPLATES=y,$(lib_LIBRARIES)$(shared_LIBRARIES)))
+$(eval $(call omk_pass_template, library-pass,$(USER_OBJS_DIR),USER_RULE_TEMPLATES=y,$(lib_LIBRARIES)$(shared_LIBRARIES)$(cmetric_include_HEADERS)))
 $(eval $(call omk_pass_template, binary-pass, $(USER_OBJS_DIR),USER_RULE_TEMPLATES=y,$(bin_PROGRAMS)$(utils_PROGRAMS)$(test_PROGRAMS)$(bin_SCRIPTS)))
 
 $(eval $(call omk_pass_template,clean,$(USER_OBJS_DIR),,always))
index 127220f43d0c5cdf092deaea0a6b6f3f21d831f5..079435c8bb6a4af2da40a14f73c9b765d1eb12d4 100644 (file)
@@ -161,31 +161,6 @@ $(2): $(1) $$(GEN_HEADERS)
        fi
 endef
 
-# 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 $$@
-endef
-
 idl_COMPILE = $(IDL_COMPILER)
 
 define COMPILE_idl_template
@@ -290,21 +265,10 @@ endef
 
 
 
-library-pass-local: $(addprefix $(USER_INCLUDE_DIR)/,$(cmetric_include_HEADERS)) \
-                   $(lib_LIBRARIES:%=$(USER_LIB_DIR)/lib%.a) $(shared_LIBRARIES:%=$(USER_LIB_DIR)/lib%.so)
+library-pass-local: $(lib_LIBRARIES:%=$(USER_LIB_DIR)/lib%.a) $(shared_LIBRARIES:%=$(USER_LIB_DIR)/lib%.so)
 
 binary-pass-local: $(bin_PROGRAMS:%=$(USER_BIN_DIR)/%) $(utils_PROGRAMS:%=$(USER_UTILS_DIR)/%) $(test_PROGRAMS:%=$(USER_TESTS_DIR)/%)
 
-# Special rules for CMETRIC generated headers
-
-$(foreach cmetrh,$(cmetric_include_HEADERS),$(eval $(call COMPILE_c_o_template,\
-               $(SOURCES_DIR)/$($(basename $(notdir $(cmetrh)))_CMETRIC_SOURCES),\
-               $($(basename $(notdir $(cmetrh)))_CMETRIC_SOURCES:%.c=%.o),)))
-$(foreach cmetrh,$(cmetric_include_HEADERS),$(eval $(call CMETRIC_o_h_template,\
-               $($(basename $(notdir $(cmetrh)))_CMETRIC_SOURCES:%.c=%.o),\
-               $(addprefix $(USER_INCLUDE_DIR)/,$(cmetrh)))))
-
-GEN_HEADERS+=$(cmetric_include_HEADERS:%=$(USER_INCLUDE_DIR)/%)
 GEN_HEADERS+=$(filter %.h,$(USER_IDLS:%.idl=%.h))
 
 # Generate rules for compilation of programs and libraries
index f98e17152f78f674aded6e44556f99f6c2af54a2..0999a616fd5e90b3ab8188719ef7b03f915c7d9b 100644 (file)
@@ -231,8 +231,7 @@ $(foreach src,$(filter %.S,$(USER_SOURCES)),$(eval $(call COMPILE_S_o_template,$
 $(foreach src,$(filter %.asm,$(USER_SOURCES)), $(eval $(call COMPILE_asm_o_template,$(SOURCES_DIR)/$(src),$(src:%.asm=%$(OBJ_EXT)),)))
 
 
-library-pass-local: $(addprefix $(USER_INCLUDE_DIR)/,$(cmetric_include_HEADERS)) \
-                   $(lib_LIBRARIES:%=$(LIB_DIR)/$(LIB_PREF)%$(LIB_EXT)) $(shared_LIBRARIES:%=$(LIB_DIR)/$(LIB_PREF)%.so) \
+library-pass-local: $(lib_LIBRARIES:%=$(LIB_DIR)/$(LIB_PREF)%$(LIB_EXT)) $(shared_LIBRARIES:%=$(LIB_DIR)/$(LIB_PREF)%.so) \
                    $(addprefix $(LIB_DIR)/,$(lib_OBJS))
 
 ifneq ($(link_VARIANTS),)
index c872d76b65c03c741cd0348b44e0bfc3fae179e5..5b50e9d63b6be1040212009e1fdb03e1c79c998d 100644 (file)
@@ -88,17 +88,6 @@ OBJS_DIR    := $(USER_OBJS_DIR)
 
 $(eval $(COMPILER_DEFS_template))
 
-# Special rules for CMETRIC generated headers
-
-$(foreach cmetrh,$(cmetric_include_HEADERS),$(eval $(call COMPILE_c_o_template,\
-               $(SOURCES_DIR)/$($(basename $(notdir $(cmetrh)))_CMETRIC_SOURCES),\
-               $($(basename $(notdir $(cmetrh)))_CMETRIC_SOURCES:%.c=%.o),)))
-$(foreach cmetrh,$(cmetric_include_HEADERS),$(eval $(call CMETRIC_o_h_template,\
-               $($(basename $(notdir $(cmetrh)))_CMETRIC_SOURCES:%.c=%.o),\
-               $(addprefix $(USER_INCLUDE_DIR)/,$(cmetrh)))))
-
-GEN_HEADERS+=$(cmetric_include_HEADERS:%=$(USER_INCLUDE_DIR)/%)
-
 # Generate rules for compilation of programs and libraries
 ifneq ($(link_VARIANTS),)
 $(foreach prog,$(bin_PROGRAMS),$(foreach link,$(link_VARIANTS),$(eval $(call PROGRAM_template,$(prog),$(USER_BIN_DIR),$(link)))))
@@ -153,8 +142,7 @@ $(foreach src,$(filter %.cxx,$(SOLIB_SOURCES)),$(eval $(call COMPILE_cc_o_templa
 $(foreach src,$(filter %$(ASM_EXT),$(SOLIB_SOURCES)),$(eval $(call COMPILE_S_o_template,$(SOURCES_DIR)/$(src),$(src:%$(ASM_EXT)=%.lo),$(SOLIB_PICFLAGS))))
 $(foreach src,$(filter %.c,$(SOLIB_GEN_SOURCES)),$(eval $(call COMPILE_c_o_template,$(src),$(src:%.c=%.lo),$(SOLIB_PICFLAGS))))
 
-library-pass-local: $(addprefix $(USER_INCLUDE_DIR)/,$(cmetric_include_HEADERS)) \
-                   $(lib_LIBRARIES:%=$(LIB_DIR)/$(LIB_PREF)%$(LIB_EXT)) $(shared_LIBRARIES:%=$(LIB_DIR)/$(LIB_PREF)%.so) \
+library-pass-local: $(lib_LIBRARIES:%=$(LIB_DIR)/$(LIB_PREF)%$(LIB_EXT)) $(shared_LIBRARIES:%=$(LIB_DIR)/$(LIB_PREF)%.so) \
                    $(addprefix $(LIB_DIR)/,$(lib_OBJS))
 
 ifneq ($(link_VARIANTS),)
@@ -253,7 +241,7 @@ run: run-$(firstword $(link_VARIANTS))
 # Generate pass rules from generic templates
 
 $(eval $(call omk_pass_template, include-pass, $(LOCAL_BUILD_DIR),,$(include_HEADERS)$(nobase_include_HEADERS)$(renamed_include_HEADERS)$(lib_LDSCRIPTS)$(config_include_HEADERS)$(LOCAL_CONFIG_H)))
-$(eval $(call omk_pass_template, library-pass, $(LOCAL_BUILD_DIR),TARGET_RULE_TEMPLATES=y,$(lib_LIBRARIES)$(shared_LIBRARIES)$(lib_obj_SOURCES)))
+$(eval $(call omk_pass_template, library-pass, $(LOCAL_BUILD_DIR),TARGET_RULE_TEMPLATES=y,$(lib_LIBRARIES)$(shared_LIBRARIES)$(lib_obj_SOURCES)$(cmetric_include_HEADERS)))
 $(eval $(call omk_pass_template, binary-pass,  $(LOCAL_BUILD_DIR),TARGET_RULE_TEMPLATES=y,$(bin_PROGRAMS) $(test_PROGRAMS)))
 $(eval $(call omk_pass_template, utils-pass,   $(LOCAL_BUILD_DIR),HOST_RULE_TEMPLATES=y,$(utils_PROGRAMS)))
 $(eval $(call omk_pass_template, dep,    $(LOCAL_BUILD_DIR),,always))
index dfcad50497cf86590bdbb88ed1c3c92338f90dbd..7c10f46a5e67e7baeb79b6be8b5e1587f5d7fbcc 100644 (file)
@@ -174,8 +174,7 @@ $(eval $(call omk_pass_template,include-pass,$(USER_OBJS_DIR),,always))
 
 $(eval $(call include-pass-template,$(USER_INCLUDE_DIR),include))
 
-library-pass-local: $(addprefix $(USER_INCLUDE_DIR)/,$(cmetric_include_HEADERS)) \
-                   $(lib_LIBRARIES:%=$(USER_LIB_DIR)/lib%.a) $(shared_LIBRARIES:%=$(USER_LIB_DIR)/lib%.$(SOLIB_EXT))
+library-pass-local: $(lib_LIBRARIES:%=$(USER_LIB_DIR)/lib%.a) $(shared_LIBRARIES:%=$(USER_LIB_DIR)/lib%.$(SOLIB_EXT))
 
 binary-pass-local: $(bin_PROGRAMS:%=$(USER_BIN_DIR)/%.vxe) $(test_PROGRAMS:%=$(USER_TESTS_DIR)/%.vxe) $(utils_PROGRAMS:%=$(USER_UTILS_DIR)/%.vxe)