]> rtime.felk.cvut.cz Git - omk.git/commitdiff
Added generation of binary dependencies from .map file
authorMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 30 Dec 2008 13:24:27 +0000 (14:24 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 30 Dec 2008 13:24:27 +0000 (14:24 +0100)
snippets/Makefile.rules.test
snippets/prepare

index 30e1bb36889d7f2132a5d41c91646eaaa6c6f7fa..c6a17e7364f9acf885dd51a1ef8b9faa1b76789b 100644 (file)
@@ -53,9 +53,13 @@ $$(eval $$(call prepare_rule_goal,\
        $$(call program_cmd,$(1))))
 endef
 
-program_cmd = $(if $(filter %.cc,$($(1)_SOURCES)),$(CXX),$(CC)) \
+program_cmd = set -e; $(if $(filter %.cc,$($(1)_SOURCES)),$(CXX),$(CC)) \
        $($(1)_OBJS) $($(1)_LIBS:%=-l%) $(LOADLIBES) $(LDFLAGS) -Wl,-rpath-link,$(USER_LIB_DIR) \
-       -Wl,-Map,$(USER_OBJS_DIR)/$(1).exe.map -o $$@
+       -Wl,-Map,$(USER_OBJS_DIR)/$(1).exe.map -o $$@; \
+       echo "$$@: \\" >$(USER_OBJS_DIR)/$(1).exe.d; \
+       sed -n -e 's|^LOAD \(.*\)$$$$|  \1  \&|p' $(USER_OBJS_DIR)/$(1).exe.map|tr '&' '\134'  >>$(USER_OBJS_DIR)/$(1).exe.d; \
+       echo >>$(USER_OBJS_DIR)/$(1).exe.d
+
 
 $(foreach prog,$(bin_PROGRAMS),$(eval $(call program_template,$(prog),bin)))
 #$(foreach prog,$(bin_PROGRAMS),$(info >>>$(call program_template,$(prog),bin)<<<))
index 8284577bc15b328f9b5edaa4595de971c2d3994f..d81e9e88555a81f64b870243a185d04c5a6b1a36 100644 (file)
@@ -18,9 +18,10 @@ omk_inc_file = $(if $(filter $(BUILD_DIR_NAME)%,$(omk_inc_rule)),\
 
 target_omk_file = $(OMK_WORK_DIR)/$(notdir $(1)).target.omk
 
+# >\< substitution to preserve \ in echo argument
 # >'< substitution is for echo to work,
 # >$< substitution to preserve $ when reloading .omk.inc file
-subst-cmd = $(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(1))))
+subst-cmd = $(subst $$,$$$$,$(call escsq,$(subst \,\\,$(1))))
 
 ###
 # prepare_rule is used to generate .omk.inc files during prepare-pass.