Skip to content

Commit 3d6603e

Browse files
committed
depends: Propagate well-known vars into depends
For example, doing: make CC=clang CXX=clang++ Should now propagate these settings down to depends packages
1 parent fa3288c commit 3d6603e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

depends/hosts/default.mk

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,18 @@ default_host_OTOOL = $(host_toolchain)otool
1313
default_host_NM = $(host_toolchain)nm
1414

1515
define add_host_tool_func
16+
ifneq ($(filter $(origin $1),undefined default),)
17+
# Do not consider the well-known var $1 if it is undefined or is taking a value
18+
# that is predefined by "make" (e.g. the make variable "CC" has a predefined
19+
# value of "cc")
1620
$(host_os)_$1?=$$(default_host_$1)
1721
$(host_arch)_$(host_os)_$1?=$$($(host_os)_$1)
1822
$(host_arch)_$(host_os)_$(release_type)_$1?=$$($(host_os)_$1)
23+
else
24+
$(host_os)_$1=$(or $($1),$($(host_os)_$1),$(default_host_$1))
25+
$(host_arch)_$(host_os)_$1=$(or $($1),$($(host_arch)_$(host_os)_$1),$$($(host_os)_$1))
26+
$(host_arch)_$(host_os)_$(release_type)_$1=$(or $($1),$($(host_arch)_$(host_os)_$(release_type)_$1),$$($(host_os)_$1))
27+
endif
1928
host_$1=$$($(host_arch)_$(host_os)_$1)
2029
endef
2130

0 commit comments

Comments
 (0)