Patch: automatic dependencies for gcc

Ralf Wildenhues Ralf.Wildenhues@gmx.de
Sun Mar 9 14:40:00 GMT 2008


* Tom Tromey wrote on Sat, Mar 08, 2008 at 07:49:55PM CET:
> 
> I'll re-bootstrap on the compile farm with something like this.

Thanks.  I haven't found obvious issues with it yet.  Well, if someone
inadvertently deletes some .deps files, things won't be rebuilt.  

> >>>>> "Ralf" == Ralf Wildenhues <Ralf.Wildenhues@gmx.de> writes:
> Ralf> -COMPILE = $(COMPILE.base) -o $@ -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Po
> Ralf> +COMPILE = $(COMPILE.base) -o $@ -MT $@ -MMD -MP -MF $(dir $*)/$(DEPDIR)/$(notdir $*).Po
> 
> I think I will change this to use $(*D) and $(*F).

Sure.

> Ralf> --include $(patsubst %.o, $(DEPDIR)/%.Po, $(ALL_HOST_OBJS))
> Ralf> +DEPFILES = $(foreach obj, $(ALL_HOST_OBJS), \
> Ralf> +	     $(dir $(obj))$(DEPDIR)/$(patsubst %.o,%.Po,$(notdir $(obj))))
> 
> This makes it tempting to change depcomp instead  :)

Fair enough.  Well, the one-time complexity of the above should be
weighed against losing sync with upstream (hmm, not too dynamic ATM ;-).

The reason I see against my proposal that IMVHO carries real weight
would be if you were to require up to date deps files.  I would not know
how to easily reformulate
  %.o $(DEPDIR)/%.d: %.c

rules into the subdir/$(DEPDIR) scheme.  Why aren't you using this BTW?
It would already be a bit safer than what you currently have, even if
you don't go all the way and make $(DEPFILES) a prerequisite of 'all'.

> Ralf>  AC_CONFIG_COMMANDS([gccdepdir],[
> Ralf> -  ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/mkinstalldirs $DEPDIR/build
> Ralf> +  ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/mkinstalldirs build/$DEPDIR
> Ralf>    for lang in $subdirs
> Ralf>    do
> Ralf> -      ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/mkinstalldirs $DEPDIR/$lang
> Ralf> +      ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/mkinstalldirs $lang/$DEPDIR
> Ralf>    done], [subdirs="$subdirs" ac_aux_dir=$ac_aux_dir DEPDIR=$DEPDIR])
>  
> In Quagmire I create necessary directories in the Makefile.  I wonder
> whether we should just do that here as well.  I'll take a look.

That would just be sensible.  Automake only creates them at
config.status time because it requires all dep files to be present (as
stubs at least) at make time.  IIRC, the .dirstamp semantics otherwise
used by Automake code are due to some non-GNU make implementations not
liking directories as targets.

Cheers,
Ralf



More information about the Gcc-patches mailing list