> -lib/%.o: crt/%.o
> +lib/%.o: $(objdir)/crt/%.o
> cp $< $@
I don't see how this gets arch versions of crti.o/crtn.o. I think you
must be producing the dummy ones from the empty .c files, which won't
work. Actually once this is all done the dummy .c files there can
probably be removed, or we could remove them right away to eliminate
the need for another filter-out here (but I don't think that's really
needed anyway since it's a small fixed set of files we can hard-code).
That was a mistake. I've added explicit rules for both crti.o and crtn.o.
BTW that made me realize one semantic change in how the new build
system treats arch files: src/*/$(ARCH)/*.s (and .sub and whatever
other types we add) will get used now even if there's no .c file by
the same name in the parent directory. This actually looks to be
really nice -- we can eliminate dummy .c files that are empty and only
have them when the generic implementation works for some/most archs.
We can also move the arch/$(ARCH)/src/* files to appropriate
src/*/$(ARCH) locations based on what code they go with.
True, do you want me to remove all these files in the same or a separate patch?
> +test -f Makefile || ln -sf $srcdir/Makefile .
Is there a reason you do it this way rather than checking for
srcdir=.? The reason I ask is that existence of a stray makefile
that's not a symlink to the musl makefile should probably be an error
here rather than silently ignored. But maybe there are more things to
consider..
There is no particular reason, failing in case of existing Makefile sounds like a better solution.