Mon 28 Sep 2009 09:00:48 PM UTC, original submission:
Building a target will fail with error:
under the following conditions:
1) target source is in a directory other than "." and is included
via vpath.
2) parallel build is deactivated, warning is:
warning: jobserver unavailable: using -j1
Here's a sample set of files and a procedure to reproduce:
Files:
dir1/Makefile
dir1/build.sh
dir1/dir.mk
dir1/main.c
dir2/f.c
----------
Makefile:
----------
default:
@./build.sh
----------
build.sh:
----------
make -f dir.mk
----------
dir.mk:
----------
vpath %c ./:../dir2:
main: main.o f.o
$(CC) -o main $^
clean:
rm -f main.o f.o main
----------
main.c:
----------
main()
{
f();
}
----------
f.c:
----------
f()
{
return(0);
}
=========
When in dir1, "make -f dir.mk" is fine. So is "make -j2 dir.mk".
"make" alone is fine.
The failure is triggered with "make -j2" [-f Makefile].
make[1]: Entering directory `.../dir1'
make[1]: warning: jobserver unavailable: using -j1. Add `+' to parent make rule.
cc -c -o main.o main.c
make[1]: *** No rule to make target `f.o', needed by `main'. Stop.
make[1]: Leaving directory `.../dir1'
make: *** [default] Error 2
When parallel builds are deactivated, the rule to make the target is lost when vpath is involved.
|