summaryrefslogtreecommitdiff
path: root/solenv/gbuild/Executable.mk
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2012-12-30 12:20:50 +0100
committerDavid Tardon <dtardon@redhat.com>2012-12-30 17:15:48 +0100
commit0d6f8e5c048d3caef43bf26f2ae683224dec6921 (patch)
tree8df46c6ea9777a4a46518b4fab0ab57c2b33dba6 /solenv/gbuild/Executable.mk
parentecc9896c9be9669ec1ea13a99c9aa624356b07aa (diff)
allow setting runtime deps of executables in one place
Change-Id: I325287cba773df848a8797486c149502abae9c9d
Diffstat (limited to 'solenv/gbuild/Executable.mk')
-rw-r--r--solenv/gbuild/Executable.mk46
1 files changed, 46 insertions, 0 deletions
diff --git a/solenv/gbuild/Executable.mk b/solenv/gbuild/Executable.mk
index 2fa67509e989..4683d0ec4163 100644
--- a/solenv/gbuild/Executable.mk
+++ b/solenv/gbuild/Executable.mk
@@ -31,10 +31,20 @@
# defined by platform
# gb_Executable_Executable_platform
+$(dir $(call gb_Executable_get_runtime_target,%)).dir :
+ $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
+
+$(dir $(call gb_Executable_get_runtime_target,%))%/.dir :
+ $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
+
+$(call gb_Executable_get_runtime_target,%) : $(call gb_Executable_get_target,%)
+ touch $@
+
.PHONY : $(call gb_Executable_get_clean_target,%)
$(call gb_Executable_get_clean_target,%) :
$(call gb_Helper_abbreviate_dirs,\
rm -f $(call gb_Executable_get_target,$*) \
+ $(call gb_Executable_get_runtime_target,$*) \
$(AUXTARGETS))
define gb_Executable_Executable
@@ -52,6 +62,7 @@ $(call gb_LinkTarget_set_targettype,$(2),Executable)
$(call gb_LinkTarget_add_libs,$(2),$(gb_STDLIBS))
$(call gb_Executable_get_target,$(1)) : $(call gb_LinkTarget_get_target,$(2)) \
| $(dir $(call gb_Executable_get_target,$(1))).dir
+$(call gb_Executable_get_runtime_target,$(1)) :| $(dir $(call gb_Executable_get_runtime_target,$(1))).dir
$(call gb_Executable_get_clean_target,$(1)) : $(call gb_LinkTarget_get_clean_target,$(2))
$(call gb_Executable_get_clean_target,$(1)) : AUXTARGETS :=
$(call gb_Executable_Executable_platform,$(1),$(2))
@@ -148,4 +159,39 @@ $(eval $(foreach method,\
$(call gb_Executable_forward_to_Linktarget,$(method))\
))
+# Run-time use
+
+# Add dependencies needed for running the executable
+#
+# gb_Executable_add_runtime_dependencies executable dependencies
+define gb_Executable_add_runtime_dependencies
+$(call gb_Executable_get_runtime_target,$(1)) : $(2)
+
+endef
+
+# Get dependencies needed for running the executable
+#
+# This is not strictly necessary, but it makes the use more similar to
+# ExternalExecutable.
+#
+# gb_Executable_get_runtime_dependencies executable
+define gb_Executable_get_runtime_dependencies
+$(call gb_Executable_get_runtime_target,$(1))
+endef
+
+define gb_Executable__get_command
+$(if $(filter NONE,$(gb_Executable_VALIDGROUPS)),,$(call gb_Output_error,executable group NONE does not exist!))
+$(if $(filter $(1),$(gb_Executable_NONE)),,$(gb_Helper_set_ld_path)) \
+ $(call gb_Executable_get_target_for_build,$(1))
+endef
+
+# Get complete command-line for running the executable
+#
+# This includes setting library path, if necessary.
+#
+# gb_Executable_get_command executable
+define gb_Executable_get_command
+$(strip $(call gb_Executable__get_command,$(1)))
+endef
+
# vim: set noet sw=4: