On Tue, Dec 8, 2015 at 4:39 PM Rich Felker <dalias@libc.org> wrote:
I get:

make: *** No rule to make target `obj/include/bits', needed by `obj/include/bits/alltypes.h'.  Stop.

I think this is because $(dir...) intentionally leaves the trailing
slash, so you have to remove it to get the desired behavior.

I'm not sure why I don't see the same behavior in my setting, but I used make -p and you're correct, $(dir ...) leaves the trailing slashes.
 
First I tried:

OBJ_DIRS = $(sort $(patsubst %/,%,$(dir $(ALL_LIBS) $(ALL_TOOLS) $(OBJS) $(GENH) $(GENH_INT))) $(addprefix obj/, crt crt/$(ARCH) include))

but this does not seem to be sufficient, because of:

$(OBJS) $(LOBJS): | $(sort $(dir $(OBJS)))

Adding patsubst there would work too, but I wonder if it even makes
sense to have fine-grained dir dependencies, rather than just making
all the targets in this section of the makefile depend on $(OBJ_DIRS).
Thoughts?

I've used the approach you suggested yesterday over IRC which simplifies the Makefile a bit.
 
../configure: Makefile already exists in the working directory

This isn't what I would expect either. Normally you want to be able to
re-run configure with different options. There's probably a little bit
of subtlety here because we would like to avoid overwriting an actual
file (if somebody copied and edited a makefile here) but happily
replace a symlink.

I've expanded the check to cover both the existing file and symlink case.
 
Aside from these issues it seems to be okay/working for me. I'd
appreciate comments from anyone else who's tried it.

I've been using the previous version in my setup for about two weeks now and haven't found any further issue but I'd like to hear from others if they found any issues.