I created several test*.c files
$ ls
Makefile test2.c test3.c test4.c test5.c test6.c test7.c test8.c test9.c
All test*.c have same code except filename and fucntion name
$ cat test2.c
#include <stdio.h>
int test_2_()
{
return 0;
}
$ cat test3.c
#include <stdio.h>
int test_3_()
{
return 0;
}
$ cat test4.c
#include <stdio.h>
int test_4_()
{
return 0;
}
Makefile is very simple, just echo $(src):
$ cat Makefile
src = $(wildcard *.c)
seq:
@echo $(src)
Now, my question is what's the sequence of wildcard
$ make seq
test2.c test4.c test6.c test3.c test8.c test9.c test5.c test7.c
If it's arranged in alphabetical order, it should be "test2.c test3.c test4.c ...", but actually it's "test2.c test4.c test6.c test3.c test8.c test9.c test5.c test7.c"
And it's not follow the file update time order
$ for i in `ls test*`;do echo $i;touch $i;sleep 1;done
test2.c
test3.c
test4.c
test5.c
test6.c
test7.c
test8.c
test9.c
$ make seq
test2.c test4.c test6.c test3.c test8.c test9.c test5.c test7.c
question from:
https://stackoverflow.com/questions/65713777/what-is-the-sequence-of-wildcard-function-in-makefile 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…