Skip to content
Snippets Groups Projects
  • Maciej W. Rozycki's avatar
    d364c4ce
    ada: Make the names of uninstalled cross-gnattools consistent across builds · d364c4ce
    Maciej W. Rozycki authored
    We suffer from an inconsistency in the names of uninstalled gnattools
    executables in cross-compiler configurations.  The cause is a recipe we
    have:
    
    ada.all.cross:
    	for tool in $(ADA_TOOLS) ; do \
    	  if [ -f $$tool$(exeext) ] ; \
    	  then \
    	    $(MV) $$tool$(exeext) $$tool-cross$(exeext); \
    	  fi; \
    	done
    
    the intent of which is to give the names of gnattools executables the
    '-cross' suffix, consistently with the compiler drivers: 'gcc-cross',
    'g++-cross', etc.
    
    A problem with the recipe is that this 'make' target is called too early
    in the build process, before gnattools have been made.  Consequently no
    renames happen and owing to that they are conditional on the presence of
    the individual executables the recipe succeeds doing nothing.
    
    However if a target is requested later on such as 'make pdf' that does
    not cause gnattools executables to be rebuilt, then 'ada.all.cross' does
    succeed in renaming the executables already present in the build tree.
    Then if the 'gnat' testsuite is run later on which expects non-suffixed
    'gnatmake' executable, it does not find the 'gnatmake-cross' executable
    in the build tree and may either catastrophically fail or incorrectly
    use a system-installed copy of 'gnatmake'.
    
    Of course if a target is requested such as `make all' that does cause
    gnattools executables to be rebuilt, then both suffixed and non-suffixed
    uninstalled executables result.
    
    Fix the problem by moving the renaming of gnattools to a separate 'make'
    recipe, pasted into a new 'gnattools-cross-mv' target and the existing
    legacy 'cross-gnattools' target.  Then invoke the new target explicitly
    from the 'gnattools-cross' recipe in gnattools/.
    
    Update the test harness accordingly, so that suffixed gnattools are used
    in cross-compilation testsuite runs.
    
    	gcc/ada/
    	* gcc-interface/Make-lang.in (ada.all.cross): Move recipe to...
    	(GNATTOOLS_CROSS_MV): ... this new variable.
    	(cross-gnattools): Paste it here.
    	(gnattools-cross-mv): New target.
    
    	gnattools/
    	* Makefile.in (gnattools-cross): Also build 'gnattools-cross-mv'
    	in GCC_DIR.
    
    	gcc/testsuite/
    	* lib/gnat.exp (local_find_gnatmake, find_gnatclean): Use
    	'-cross' suffix where testing a cross-compiler.
    d364c4ce
    History
    ada: Make the names of uninstalled cross-gnattools consistent across builds
    Maciej W. Rozycki authored
    We suffer from an inconsistency in the names of uninstalled gnattools
    executables in cross-compiler configurations.  The cause is a recipe we
    have:
    
    ada.all.cross:
    	for tool in $(ADA_TOOLS) ; do \
    	  if [ -f $$tool$(exeext) ] ; \
    	  then \
    	    $(MV) $$tool$(exeext) $$tool-cross$(exeext); \
    	  fi; \
    	done
    
    the intent of which is to give the names of gnattools executables the
    '-cross' suffix, consistently with the compiler drivers: 'gcc-cross',
    'g++-cross', etc.
    
    A problem with the recipe is that this 'make' target is called too early
    in the build process, before gnattools have been made.  Consequently no
    renames happen and owing to that they are conditional on the presence of
    the individual executables the recipe succeeds doing nothing.
    
    However if a target is requested later on such as 'make pdf' that does
    not cause gnattools executables to be rebuilt, then 'ada.all.cross' does
    succeed in renaming the executables already present in the build tree.
    Then if the 'gnat' testsuite is run later on which expects non-suffixed
    'gnatmake' executable, it does not find the 'gnatmake-cross' executable
    in the build tree and may either catastrophically fail or incorrectly
    use a system-installed copy of 'gnatmake'.
    
    Of course if a target is requested such as `make all' that does cause
    gnattools executables to be rebuilt, then both suffixed and non-suffixed
    uninstalled executables result.
    
    Fix the problem by moving the renaming of gnattools to a separate 'make'
    recipe, pasted into a new 'gnattools-cross-mv' target and the existing
    legacy 'cross-gnattools' target.  Then invoke the new target explicitly
    from the 'gnattools-cross' recipe in gnattools/.
    
    Update the test harness accordingly, so that suffixed gnattools are used
    in cross-compilation testsuite runs.
    
    	gcc/ada/
    	* gcc-interface/Make-lang.in (ada.all.cross): Move recipe to...
    	(GNATTOOLS_CROSS_MV): ... this new variable.
    	(cross-gnattools): Paste it here.
    	(gnattools-cross-mv): New target.
    
    	gnattools/
    	* Makefile.in (gnattools-cross): Also build 'gnattools-cross-mv'
    	in GCC_DIR.
    
    	gcc/testsuite/
    	* lib/gnat.exp (local_find_gnatmake, find_gnatclean): Use
    	'-cross' suffix where testing a cross-compiler.