glibc's build system rebuilds too much under Plash
When glibc's build system is run under Plash, make rebuilds too much: it seems it always rebuilds all the targets, unnecessarily.
Possible reasons:
- Plash does not fill out the nanosecond field in "struct stat". This shouldn't be the cause because the filesystem I'm using doesn't provide subsecond timestamps anyway.
- Plash doesn't return "." and ".." entries from readdir(). This might be causing glob() (which make uses) to return different results.
Different globbing behaviour
Here is a small Makefile that reproduces the problem:
all:
@echo $(wildcard .)
Normally, this prints ".". Under Plash, it prints an empty line.
Causes:
- readdir() doesn't return a "." entry.
- Any entry from readdir() needs to have a non-zero inode number field, otherwise make ignores it (for some reason).
glibc makefiles
The following fragment in Makerules is responsible for making the different globbing behaviour rebuild everything:
# Make sure the subdirectory for object files gets created.
ifdef objpfx
ifeq (,$(wildcard $(objpfx).))
before-compile += $(objpfx).
$(objpfx).:
$(make-target-directory)
endif
endif
Commenting out this block allows make -C glibc-build to re-run without rebuilding anything.
make has some odd code in dir.c in REAL_DIR_ENTRY(): when building with glibc, if d_ino == 0, the directory entry is not considered a proper entry and is ignored.
Resolution
I have partly fixed this by changing glibc's Makerules.
