diff options
author | Carl Dong <contact@carldong.me> | 2020-04-29 16:30:40 -0400 |
---|---|---|
committer | Carl Dong <contact@carldong.me> | 2020-05-27 17:39:47 -0400 |
commit | 3d6603e340d6d461832f0aa204b04343d34af3d4 (patch) | |
tree | 6ff64d4d2ae0c559a51e3bd8b7158ba8d6574075 | |
parent | fa3288cda12537b2e99a3cc7e14dfff3e944884f (diff) |
depends: Propagate well-known vars into depends
For example, doing:
make CC=clang CXX=clang++
Should now propagate these settings down to depends packages
-rw-r--r-- | depends/hosts/default.mk | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/depends/hosts/default.mk b/depends/hosts/default.mk index 144e5f88b7..258619a9d0 100644 --- a/depends/hosts/default.mk +++ b/depends/hosts/default.mk @@ -13,9 +13,18 @@ default_host_OTOOL = $(host_toolchain)otool default_host_NM = $(host_toolchain)nm define add_host_tool_func +ifneq ($(filter $(origin $1),undefined default),) +# Do not consider the well-known var $1 if it is undefined or is taking a value +# that is predefined by "make" (e.g. the make variable "CC" has a predefined +# value of "cc") $(host_os)_$1?=$$(default_host_$1) $(host_arch)_$(host_os)_$1?=$$($(host_os)_$1) $(host_arch)_$(host_os)_$(release_type)_$1?=$$($(host_os)_$1) +else +$(host_os)_$1=$(or $($1),$($(host_os)_$1),$(default_host_$1)) +$(host_arch)_$(host_os)_$1=$(or $($1),$($(host_arch)_$(host_os)_$1),$$($(host_os)_$1)) +$(host_arch)_$(host_os)_$(release_type)_$1=$(or $($1),$($(host_arch)_$(host_os)_$(release_type)_$1),$$($(host_os)_$1)) +endif host_$1=$$($(host_arch)_$(host_os)_$1) endef |