Skip to content

Commit

Permalink
depends: Propagate well-known vars into depends
Browse files Browse the repository at this point in the history
For example, doing:

  make CC=clang CXX=clang++

Should now propagate these settings down to depends packages
  • Loading branch information
dongcarl committed May 27, 2020
1 parent fa3288c commit 3d6603e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions depends/hosts/default.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 3d6603e

Please sign in to comment.