Excerpts from Jakub Jelinek's message of Januar 13, 2025 2:58 pm:
> On Mon, Jan 13, 2025 at 02:45:28PM +0100, Arsen Arsenović wrote:
>> > So the former d/.deps/file.Po which handled both d/dmd/common/file.d and
>> > d/dmd/root/file.d in your case would be d/.deps/d-common-file.o.d and
>> > d/.deps/d-root-file.o.d while with the above DEPFILE it would be
>> > d/.deps/common-file.d and d/.deps/root-file.d
>> > There are no d/dmd/*-*.d files and among d/*-*.cc the only are just d-
>> > prefixed ones, and there are no clashes between the *.cc and *.d filenames:
>> > for i in gcc/d/*.cc; do j=`basename $i .cc`; find gcc/d -name $j.d; done
>> 
>> Relying that is more error-prone, I think.  While that is true today, it
>> might not stay true forever, and such a change won't be caught until it
>> fails again in the same way.
>> 
>> $@ is necessarily unique (however, still, with the proposed approach
>> d/foo.o and d-foo.o will collide).
> 
> We are talking about d/*.o object files and d/.deps/*.Po files corresponding
> to that.  As there are no subdirectories, the * must be necessarily unique.
> And it already uses $(@D) in the directory name ($(@D)/$(DEPDIR) in
> particular, so even if in the future some subdirectory for object files is
> added, it would still be unique, say if there is
> d/*.o and d/whatever/*.o, the deps files would be d/.deps/*.Po and
> d/whatever/.deps/*.Po.  There is no need to avoid clashes with files in
> the gcc main build directory, those have their own gcc/.deps/ rather than
> gcc/d/.deps/
> 

What about just building these all in subdirectories then, as per the 
source directory layout?

For example, changing the common package sources we end up with the 
following, though can't say I'm a strong fan of having test and 
optionally mkdir ran on every recipe execution.

--- a/gcc/d/Make-lang.in
+++ b/gcc/d/Make-lang.in
@@ -93,12 +93,12 @@ D_FRONTEND_OBJS = \
        d/canthrow.o \
        d/chkformat.o \
        d/clone.o \
-       d/common-bitfields.o \
-       d/common-charactertables.o \
-       d/common-file.o \
-       d/common-identifiertables.o \
-       d/common-outbuffer.o \
-       d/common-smallbuffer.o \
+       d/common/bitfields.o \
+       d/common/charactertables.o \
+       d/common/file.o \
+       d/common/identifiertables.o \
+       d/common/outbuffer.o \
+       d/common/smallbuffer.o \
        d/compiler.o \
        d/cond.o \
        d/constfold.o \
@@ -416,7 +416,8 @@ d/%.o: d/dmd/%.d
        $(DCOMPILE) $(D_INCLUDES) $<
        $(DPOSTCOMPILE)
 
-d/common-%.o: d/dmd/common/%.d
+d/common/%.o: d/dmd/common/%.d
+       -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR)
        $(DCOMPILE) $(D_INCLUDES) $<
        $(DPOSTCOMPILE)
 

Reply via email to