From 87ae37abeeeac294451d5739cb6b6fd332b794e0 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Tue, 30 Dec 2008 14:24:27 +0100 Subject: [PATCH] Added generation of binary dependencies from .map file --- snippets/Makefile.rules.test | 8 ++++++-- snippets/prepare | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/snippets/Makefile.rules.test b/snippets/Makefile.rules.test index 30e1bb3..c6a17e7 100644 --- a/snippets/Makefile.rules.test +++ b/snippets/Makefile.rules.test @@ -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)<<<)) diff --git a/snippets/prepare b/snippets/prepare index 8284577..d81e9e8 100644 --- a/snippets/prepare +++ b/snippets/prepare @@ -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. -- 2.39.2