Hi,
make versions: 3.81, 3.82, 4.0, cvs (25.12.2013)
os: centos 6.4, crux 3.0 (both amd64)
lets consider following structure of makefiles:
# ls -R
.:
foo Makefile
./foo:
GNUmakefile
# cat Makefile
all:
make -C foo
# cat foo/GNUmakefile
breackage: not worky
.DEFAULT:
@echo $@
running make with -j more than one will produce following output:
# make -j2
make -C foo
make[1]: Entering directory `/tmp/t/foo'
make[1]: *** read jobs pipe: Is a directory. Stop.
make[1]: *** Waiting for unfinished jobs....
not
make[1]: Leaving directory `/tmp/t/foo'
make: *** [all] Error 2
# echo $?
2
If the GNUmakefile were named Makefile or if I've used $(MAKE) instead of make it would have worked properly:
# mv foo/GNUmakefile foo/Makefile
# make -j2
make -C foo
make[1]: Entering directory `/tmp/t/foo'
make[1]: warning: jobserver unavailable: using -j1. Add `+' to parent make rule.
not
worky
make[1]: Leaving directory `/tmp/t/foo'
The error wont happen also if "-f" is used (hence the directory foo).
My investigation have shown that read(2) (inside new_job() function which is defined in job.c) tries to read from file descriptor number 5 which in this special case happens to be a directory instead of a pipe (directory which fd nr. 5 points to is actually /tmp/t/foo).