From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24619 invoked by alias); 6 Sep 2011 15:15:34 -0000 Received: (qmail 24610 invoked by uid 22791); 6 Sep 2011 15:15:30 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,TW_JL,TW_TX,TW_VX,TW_ZC X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 06 Sep 2011 15:15:14 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 528D32BAF24 for ; Tue, 6 Sep 2011 11:15:10 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id tPoZyhl9UoUV for ; Tue, 6 Sep 2011 11:15:10 -0400 (EDT) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id 41EC32BAE58 for ; Tue, 6 Sep 2011 11:15:10 -0400 (EDT) Received: by kwai.gnat.com (Postfix, from userid 4192) id 3A61592A55; Tue, 6 Sep 2011 11:15:10 -0400 (EDT) Date: Tue, 06 Sep 2011 15:15:00 -0000 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Subject: [Ada] clean ups in Makefiles Message-ID: <20110906151510.GA5213@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-09/txt/msg00406.txt.bz2 As discussed recently, this patch reintroduces some Makefile hunks that had been removed in the past. These hunks allow (at least partially) to use gnattools/gnatlib targets to be used individually when using --disable-libada and alos reduce differences between FSF and AdaCore repositories, thus making it easier to merge changes in the future and avoid conflicts. Tested on x86_64-pc-linux-gnu, committed on trunk. * gcc-interface/Makefile.in, gcc-interface/Make-lang.in (gnattools, regnattools, cross-gnattools, canadian-gnattools, gnatlib, gnatlib-sjlj, gnatlib-zcx, gnatlib-shared, gnatlib_and_tools): New targets. (TOOLS_FLAGS_TO_PASS): New. (../stamp-tools): Reintroduce, to avoid merge conflicts. -- Index: gcc-interface/Makefile.in =================================================================== --- gcc-interface/Makefile.in (revision 178592) +++ gcc-interface/Makefile.in (working copy) @@ -2315,8 +2315,32 @@ LIBGNAT=../$(RTSDIR)/libgnat.a +TOOLS_FLAGS_TO_PASS= \ + "CC=$(CC)" \ + "CFLAGS=$(CFLAGS)" \ + "LDFLAGS=$(LDFLAGS)" \ + "ADAFLAGS=$(ADAFLAGS)" \ + "INCLUDES=$(INCLUDES_FOR_SUBDIR)"\ + "ADA_INCLUDES=$(ADA_INCLUDES) $(ADA_INCLUDES_FOR_SUBDIR)"\ + "libsubdir=$(libsubdir)" \ + "exeext=$(exeext)" \ + "fsrcdir=$(fsrcdir)" \ + "srcdir=$(fsrcdir)" \ + "TOOLS_LIBS=$(TOOLS_LIBS) $(TGT_LIB)" \ + "GNATMAKE=$(GNATMAKE)" \ + "GNATLINK=$(GNATLINK)" \ + "GNATBIND=$(GNATBIND)" + GCC_LINK=$(CC) $(GCC_LINK_FLAGS) $(ADA_INCLUDES) +# Build directory for the tools. Let's copy the target-dependent +# sources using the same mechanism as for gnatlib. The other sources are +# accessed using the vpath directive below +# Note: dummy target, stamp-tools is mainly handled by gnattools. + +../stamp-tools: + touch ../stamp-tools + # when compiling the tools, the runtime has to be first on the path so that # it hides the runtime files lying with the rest of the sources ifeq ($(TOOLSCASE),native) @@ -2335,7 +2359,38 @@ vpath %.h ../ endif -common-tools: +# gnatmake/link tools cannot always be built with gnatmake/link for bootstrap +# reasons: gnatmake should be built with a recent compiler, a recent compiler +# may not generate ALI files compatible with an old gnatmake so it is important +# to be able to build gnatmake without a version of gnatmake around. Once +# everything has been compiled once, gnatmake can be recompiled with itself +# (see target gnattools1-re) +gnattools1: ../stamp-tools ../stamp-gnatlib-$(RTSDIR) + $(MAKE) -C tools -f ../Makefile $(TOOLS_FLAGS_TO_PASS) \ + TOOLSCASE=native \ + ../../gnatmake$(exeext) ../../gnatlink$(exeext) + +# gnatmake/link can be built with recent gnatmake/link if they are available. +# This is especially convenient for building cross tools or for rebuilding +# the tools when the original bootstrap has already be done. +gnattools1-re: ../stamp-tools + $(MAKE) -C tools -f ../Makefile $(TOOLS_FLAGS_TO_PASS) \ + TOOLSCASE=cross INCLUDES="" gnatmake-re gnatlink-re + +# these tools are built with gnatmake & are common to native and cross +gnattools2: ../stamp-tools + $(MAKE) -C tools -f ../Makefile $(TOOLS_FLAGS_TO_PASS) \ + TOOLSCASE=native common-tools $(EXTRA_GNATTOOLS) + +# those tools are only built for the cross version +gnattools4: ../stamp-tools +ifeq ($(ENABLE_VXADDR2LINE),true) + $(MAKE) -C tools -f ../Makefile $(TOOLS_FLAGS_TO_PASS) \ + TOOLSCASE=cross top_buildir=../../.. \ + ../../vxaddr2line$(exeext) +endif + +common-tools: ../stamp-tools $(GNATMAKE) -j0 -c -b $(ADA_INCLUDES) \ --GNATBIND="$(GNATBIND)" --GCC="$(CC) $(ALL_ADAFLAGS)" \ gnatchop gnatcmd gnatkr gnatls gnatprep gnatxref gnatfind gnatname \ @@ -2359,22 +2414,22 @@ $(GNATLINK) -v gnatclean -o ../../gnatclean$(exeext) \ --GCC="$(GCC_LINK)" $(TOOLS_LIBS) -../../gnatsym$(exeext): +../../gnatsym$(exeext): ../stamp-tools $(GNATMAKE) -c $(ADA_INCLUDES) gnatsym --GCC="$(CC) $(ALL_ADAFLAGS)" $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatsym $(GNATLINK) -v gnatsym -o $@ --GCC="$(GCC_LINK)" $(TOOLS_LIBS) -../../gnatdll$(exeext): +../../gnatdll$(exeext): ../stamp-tools $(GNATMAKE) -c $(ADA_INCLUDES) gnatdll --GCC="$(CC) $(ALL_ADAFLAGS)" $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatdll $(GNATLINK) -v gnatdll -o $@ --GCC="$(GCC_LINK)" $(TOOLS_LIBS) -../../vxaddr2line$(exeext): targext.o +../../vxaddr2line$(exeext): ../stamp-tools targext.o $(GNATMAKE) -c $(ADA_INCLUDES) vxaddr2line --GCC="$(CC) $(ALL_ADAFLAGS)" $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) vxaddr2line $(GNATLINK) -v vxaddr2line -o $@ --GCC="$(GCC_LINK)" targext.o $(CLIB) -gnatmake-re: link.o targext.o +gnatmake-re: ../stamp-tools link.o targext.o $(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 @@ -2385,7 +2440,7 @@ # with the former version of gnatlink itself which cannot override itself. # gnatlink-re cannot be run at the same time as gnatmake-re, hence the # dependency -gnatlink-re: link.o targext.o gnatmake-re +gnatlink-re: ../stamp-tools 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) \ Index: gcc-interface/Make-lang.in =================================================================== --- gcc-interface/Make-lang.in (revision 178565) +++ gcc-interface/Make-lang.in (working copy) @@ -545,6 +545,39 @@ gnatbind$(exeext): ada/b_gnatb.o $(CONFIG_H) $(GNATBIND_OBJS) ggc-none.o libcommon-target.a $(LIBDEPS) +$(GCC_LINK) -o $@ ada/b_gnatb.o $(GNATBIND_OBJS) ggc-none.o libcommon-target.a $(LIBS) $(SYSLIBS) $(CFLAGS) +# use target-gcc target-gnatmake target-gnatbind target-gnatlink +gnattools: $(GCC_PARTS) $(CONFIG_H) prefix.o force + $(MAKE) -C ada $(FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) \ + ADA_INCLUDES="-I- -I../rts"\ + CC="../../xgcc -B../../" GNATBIND="../../gnatbind" gnattools1 + $(MAKE) -C ada $(ADA_TOOLS_FLAGS_TO_PASS) gnattools2 + +regnattools: + $(MAKE) -C ada $(ADA_TOOLS_FLAGS_TO_PASS) gnattools1-re + $(MAKE) -C ada $(ADA_TOOLS_FLAGS_TO_PASS) gnattools2 + +cross-gnattools: force + $(MAKE) -C ada $(ADA_TOOLS_FLAGS_TO_PASS) gnattools1-re + $(MAKE) -C ada $(ADA_TOOLS_FLAGS_TO_PASS) gnattools2 + $(MAKE) -C ada $(ADA_TOOLS_FLAGS_TO_PASS) gnattools4 + +canadian-gnattools: force + $(MAKE) -C ada $(ADA_TOOLS_FLAGS_TO_PASS) gnattools1-re + $(MAKE) -C ada $(ADA_TOOLS_FLAGS_TO_PASS) gnattools2 + +gnatlib gnatlib-sjlj gnatlib-zcx gnatlib-shared: ada/s-oscons.ads force + $(MAKE) -C ada $(FLAGS_TO_PASS) \ + GNATLIBFLAGS="$(GNATLIBFLAGS)" \ + GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \ + TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" \ + THREAD_KIND="$(THREAD_KIND)" \ + TRACE="$(TRACE)" \ + FORCE_DEBUG_ADAFLAGS="$(FORCE_DEBUG_ADAFLAGS)" \ + $@ + +# use only for native compiler +gnatlib_and_tools: gnatlib gnattools + # use cross-gcc gnat-cross: force make $(GNAT1_ADA_OBJS) CC="gcc -B../stage1/" CFLAGS="-S -gnatp" \