通配符函数返回版本3.81中的排序结果,但它在版本4.2中执行此操作.是否有任何编译/运行时开关来控制这个功能?
下面显示了两个版本的GNU make的结果.
$ls a.mk a0.svp a1.svp a2.svp a3.svp a4.svp a5.svp a6.svp a7.svp a8.svp a9.svp $cat a.mk SVP_FILES := $(wildcard *.svp) all: @echo $(SVP_FILES) $make -f a.mk all a0.svp a1.svp **a2.svp a3.svp a4.svp a5.svp a6.svp a7.svp a8.svp a9.svp** $~/sandBox/bin/make -f a.mk all a0.svp a1.svp **a6.svp a5.svp a9.svp a4.svp a3.svp a2.svp a7.svp a8.svp** $make –v | head -n 1 GNU Make 3.81 $~/sandBox/bin/make -v | head -n 1 GNU Make 4.2
解决方法
如
NEWS文件中所述
Version 3.82 (28 Jul 2010)
[…]
- WARNING: Backward-incompatibility!
Wildcards were not documented as returning sorted values,but the results
have been sorted up until this release.. If your makefiles require sorted
results from wildcard expansions,use the$(sort ...)
function to request
it explicitly.
即SVP_FILES:= $(sort $(wildcard * .svp))