functions.mk: allow setting to an empty value

set() is a function of two variables but the and()
check for *both* is incorrect as one might need to
override a previously set variable with empty string;
this has manifested itself with a case like this:

  @$(call set,ROOTPW_EMPTY,1)
  # ...
  @$(call set,ROOTPW_EMPTY,)
This commit is contained in:
Michael Shigorin 2014-09-18 01:39:37 +04:00
parent 2fa7259510
commit a3ddce7a81

View File

@ -22,7 +22,8 @@ endef
# ...set() comments out any previous definition
# and then appends an assigning rule...
set = $(and $(1),$(2),$(set_body))
# NB: $(2) could be empty
set = $(and $(1),$(set_body))
define set_body
{ $(log_body); \
sed -i 's|^$(1)[ ]*[+?]*=.*$$|#& # overridden by $@|' "$(CONFIG)"; \