This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch: automatic dependencies for gcc


* Tom Tromey wrote on Tue, Mar 25, 2008 at 04:35:48PM CET:
> 
> Naturally, if there are problems, let me know and I will fix them.

> +++ gcc/doc/install.texi	(working copy)
> @@ -285,7 +285,7 @@
>  Necessary to uncompress GCC @command{tar} files when source code is
>  obtained via FTP mirror sites.
>  
> -@item GNU make version 3.79.1 (or later)
> +@item GNU make version 3.80 (or later)

Do you check this at build time?  Hmm, .FEATURES is available as of 3.81
only, otherwise you could check that for presence of 'order-only'.
It seems that 3.79.1 errors out when it sees '|' in dependencies, so
I guess there is no problem concerning silent failure.

> +++ gcc/Makefile.in	(working copy)
[...]
> @@ -904,9 +847,17 @@
>  	   -I$(srcdir)/../include @INCINTL@ \
>  	   $(CPPINC) $(GMPINC) $(DECNUMINC)
>  
> -.c.o:
> -	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $< $(OUTPUT_OPTION)
> +COMPILE.base = $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) -o $@
> +ifeq ($(DEPMODE),depmode=gcc3)
> +COMPILE = $(COMPILE.base) -MT $@ -MMD -MP -MF $(*D)/$(DEPDIR)/$(*F).Po

I forgot one more thing here.  If gcc is interrupted, it may leave an
incomplete dependency file here, which can lead to make erroring out
next time (make won't remove the .Po file upon interrupt, as it's not
listed as target).  You could use $(*D)/$(DEPDIR)/$(*F).Tpo and a
subsequent mv to *.Po as automake does.

Even if there were an easy way to write something like
  %.o %.Po: %.c
then make wouldn't remove the .Po file after a kill or quit signal.

Same holds for BUILDCOMPILE, of course.

depcomp already takes care of atomicity for the case DEPMODE != gcc3.

BTW, should I file a bug report about -MF not being atomic?

> +else
> +COMPILE = source='$<' object='$@' libtool=no \
> +    DEPDIR=$(DEPDIR) $(DEPMODE) $(depcomp) $(COMPILE.base)
> +endif
>  
> +%.o: %.c
> +	$(COMPILE) $<

Another thing: have you tried a parallel (make -jN) build with this on a
multi-way system?

Yet another thing: you removed this from objcp/Make-lang.in:

> +++ gcc/objcp/Make-lang.in	(working copy)
[...]
> -# The following must be an explicit rule; please keep in sync with the implicit
> -# one in Makefile.in.
> -objcp/objcp-act.o : objc/objc-act.c \
[...]

which leads to a build failure:

| make[3]: *** No rule to make target `objcp/objcp-act.o', needed by `cc1objplus'.  Stop.
| make[3]: *** Waiting for unfinished jobs....

Cheers,
Ralf


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]