[Ada] Speed up build of gnatools

Duncan Sands baldrick@free.fr
Tue Sep 6 11:14:00 GMT 2011


Hi Arnaud,

> Now that gnatmake supports -j0, it's possible to speed up the build of
> gnattools during GNAT build by using gnatmake -j0 instead of gnatmake.
>
> This is useful since gnattools is the only target which isn't parallelized
> in the Makefile before this change.

this means using as many processes as there are CPUs, right?  It seems pretty
dubious to me to use more processes than the user maybe asked for.  For example
I have to restrict the number of CPUs used when building GCC to less than I have
since otherwise my machine overheats and turns itself off.  Is there some way
to get at the -j level the user passed to the top-level make and use that?

Ciao, Duncan.

>
> Tested on x86_64-linux-gnu, committed on trunk.
>
> 2011-09-06  Arnaud Charlet<charlet@adacore.com>
>
> 	* gcc-interface/Makefile.in (common-tools, gnatmake-re,
> 	gnatlink-re): Speed up by using -j0.
>
> --
> Index: gcc-interface/Makefile.in
> ===================================================================
> --- gcc-interface/Makefile.in	(revision 178566)
> +++ gcc-interface/Makefile.in	(working copy)
> @@ -2336,7 +2336,7 @@
>   endif
>
>   common-tools:
> -	$(GNATMAKE) -c -b $(ADA_INCLUDES) \
> +	$(GNATMAKE) -j0 -c -b $(ADA_INCLUDES) \
>   	  --GNATBIND="$(GNATBIND)" --GCC="$(CC) $(ALL_ADAFLAGS)" \
>   	  gnatchop gnatcmd gnatkr gnatls gnatprep gnatxref gnatfind gnatname \
>   	  gnatclean -bargs $(ADA_INCLUDES) $(GNATBIND_FLAGS)
> @@ -2375,16 +2375,18 @@
>   	$(GNATLINK) -v vxaddr2line -o $@ --GCC="$(GCC_LINK)" targext.o $(CLIB)
>
>   gnatmake-re:  link.o targext.o
> -	$(GNATMAKE) $(ADA_INCLUDES) -u sdefault --GCC="$(CC) $(MOST_ADA_FLAGS)"
> -	$(GNATMAKE) -c $(ADA_INCLUDES) gnatmake --GCC="$(CC) $(ALL_ADAFLAGS)"
> +	$(GNATMAKE) -j0 $(ADA_INCLUDES) -u sdefault --GCC="$(CC) $(MOST_ADA_FLAGS)"
> +	$(GNATMAKE) -j0 -c $(ADA_INCLUDES) gnatmake --GCC="$(CC) $(ALL_ADAFLAGS)"
>   	$(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatmake
>   	$(GNATLINK) -v gnatmake -o ../../gnatmake$(exeext) \
>   		--GCC="$(GCC_LINK)" $(TOOLS_LIBS)
>
>   # Note the use of the "mv" command in order to allow gnatlink to be linked with
>   # with the former version of gnatlink itself which cannot override itself.
> -gnatlink-re:  link.o targext.o
> -	$(GNATMAKE) -c $(ADA_INCLUDES) gnatlink --GCC="$(CC) $(ALL_ADAFLAGS)"
> +# gnatlink-re cannot be run at the same time as gnatmake-re, hence the
> +# dependency
> +gnatlink-re: link.o targext.o gnatmake-re
> +	$(GNATMAKE) -j0 -c $(ADA_INCLUDES) gnatlink --GCC="$(CC) $(ALL_ADAFLAGS)"
>   	$(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatlink
>   	$(GNATLINK) -v gnatlink -o ../../gnatlinknew$(exeext) \
>   		    --GCC="$(GCC_LINK)" $(TOOLS_LIBS)



More information about the Gcc-patches mailing list