Makefile GNU make 4.3中可能存在的错误?

Makefile GNU make 4.3中可能存在的错误?,makefile,gnu-make,Makefile,Gnu Make,我正在使用的软件的Makefile中有以下行: VERSION = $(subst $(space),.,$(wordlist 1,2,$(subst ., ,$(patsubst v%,%,$(shell cat VERSION))))) 其中VERSION是包含软件确切版本的文件(f.e3.12.3) 我不是Makefiles方面的专家,但这一行应该返回主要版本(没有v指示标记),在本例中是3.12。它确实如此,或者至少,当你用GNU make运行它时,它确实如此。正如G.M.所提到的,这

我正在使用的软件的Makefile中有以下行:

VERSION = $(subst $(space),.,$(wordlist 1,2,$(subst ., ,$(patsubst v%,%,$(shell cat VERSION)))))
其中
VERSION
是包含软件确切版本的文件(f.e
3.12.3


我不是Makefiles方面的专家,但这一行应该返回主要版本(没有
v
指示标记),在本例中是3.12。它确实如此,或者至少,当你用GNU make运行它时,它确实如此。正如G.M.所提到的,这一切都取决于你如何定义空间,你还没有展示给我们

我使用GNU make 4.3的“普通”方式定义
空间
,它对我起了作用:

E =
space = $E $E
VERSION = $(subst $(space),.,$(wordlist 1,2,$(subst ., ,$(patsubst v%,%,$(shell cat VERSION)))))

$(info VERSION='$(VERSION)')
然后:


正如MadScientist和G.M所提到的,问题在于
空间的定义。我没注意到它被定义为

space =
space +=
根据Makefile 4.3更改日志:

* WARNING: Backward-incompatibility!
  Previously appending using '+=' to an empty variable would result in a value
  starting with a space.  Now the initial space is only added if the variable
  already contains some value.  Similarly, appending an empty string does not
  add a trailing space.
+=
对空变量的预期行为已更改。。。这就是问题所在


多谢各位

你能提供一个完整的makefile吗?空间是如何定义的?哦。你完全正确,我没有注意到我将空格定义为:``space=space+=```并且
+=
对空变量的行为发生了变化!你好你说得对,我没有注意到我使用
+=
将空格定义为一个空变量。。。在这个新版本中,这已经改变了!
* WARNING: Backward-incompatibility!
  Previously appending using '+=' to an empty variable would result in a value
  starting with a space.  Now the initial space is only added if the variable
  already contains some value.  Similarly, appending an empty string does not
  add a trailing space.