tool -> gcc_tooldir

Jeffrey A Law law@cygnus.com
Fri Jan 22 08:23:00 GMT 1999


As discussed on the egcs list:

The core issue is we want to be able to use a directory relative to $libsubdir
which gets us to $tooldir.  This is one of the important changes needed to
allow the gcc hierarchy to move around without needing to fiddle with -B args
or setting GCC_EXEC_PREFIX.


First requirement is we do not want to hose $tooldir uses in other Makefiles
outside of gcc -- consider a naked gdb installation, we can't reference
$libsubdir because it is specific to gcc installations.

  * Thus, we do not want to change the toplevel tooldir specification, nor do
    we want to remove it from flags to pass.

  * Therefore, gcc must not use tooldir, it'll have to use a different name.
    $(gcc_relative_tooldir) or something like that.


We also do not want to hose configurations which explicitly specify locations
for tooldir or libsubdir.  For simplicity, we can avoid this if $tooldir
looks like anything other than $prefix/$target_alias or libsubdir looks like
anything other than $prefix/$libdir/gcc-lib/$target_alias/$target_version.
For that case we'll just use the $tooldir value provided by the toplevel
configury/Makefile machinery.

I've taken the first step and renamed tooldir to gcc_tooldir with this patch.
I'll submit a patch to set gcc_tooldir to tooldir for cases where using a
relative path is not appropriate.


        * Makefile.in (tooldir): Replace with gcc_tooldir.

Index: Makefile.in
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/Makefile.in,v
retrieving revision 1.216
diff -c -3 -p -r1.216 Makefile.in
*** Makefile.in	1999/01/20 23:33:47	1.216
--- Makefile.in	1999/01/22 14:42:03
*************** bindir = @bindir@
*** 277,283 ****
  libdir = @libdir@
  # Directory in which the compiler finds executables, libraries, etc.
  libsubdir = $(libdir)/gcc-lib/$(target_alias)/$(version)
! # Used to produce a relative $(tooldir) in gcc.o
  unlibsubdir = ../../..
  # Directory in which the compiler finds g++ includes.
  gxx_include_dir= @gxx_include_dir@
--- 277,283 ----
  libdir = @libdir@
  # Directory in which the compiler finds executables, libraries, etc.
  libsubdir = $(libdir)/gcc-lib/$(target_alias)/$(version)
! # Used to produce a relative $(gcc_tooldir) in gcc.o
  unlibsubdir = ../../..
  # Directory in which the compiler finds g++ includes.
  gxx_include_dir= @gxx_include_dir@
*************** gxx_include_dir= @gxx_include_dir@
*** 285,291 ****
  includedir = $(local_prefix)/include
  # assertdir is overridden in cross-make.
  # (But this currently agrees with what is in cross-make.)
! assertdir = $(tooldir)/include
  # where the info files go
  infodir = @infodir@
  # Extension (if any) to put in installed man-page filename.
--- 285,291 ----
  includedir = $(local_prefix)/include
  # assertdir is overridden in cross-make.
  # (But this currently agrees with what is in cross-make.)
! assertdir = $(gcc_tooldir)/include
  # where the info files go
  infodir = @infodir@
  # Extension (if any) to put in installed man-page filename.
*************** mandir = @mandir@
*** 299,305 ****
  man1dir = $(mandir)/man1
  # Directory in which to find other cross-compilation tools and headers.
  # Used in install-cross.
! tooldir = $(libsubdir)/$(unlibsubdir)/../$(target_alias)
  # Since tooldir does not exist at build-time, use -B$(build_tooldir)/bin/
  build_tooldir = $(exec_prefix)/$(target_alias)
  # Dir for temp files.
--- 299,305 ----
  man1dir = $(mandir)/man1
  # Directory in which to find other cross-compilation tools and headers.
  # Used in install-cross.
! gcc_tooldir = $(libsubdir)/$(unlibsubdir)/../$(target_alias)
  # Since tooldir does not exist at build-time, use -B$(build_tooldir)/bin/
  build_tooldir = $(exec_prefix)/$(target_alias)
  # Dir for temp files.
*************** FLAGS_TO_PASS = \
*** 631,636 ****
--- 631,637 ----
  	"local_prefix=$(local_prefix)" \
  	"gxx_include_dir=$(gxx_include_dir)" \
  	"tooldir=$(tooldir)" \
+ 	"gcc_tooldir=$(gcc_tooldir)" \
  	"bindir=$(bindir)" \
  	"libsubdir=$(libsubdir)"
  #
*************** cccp.o: cccp.c $(CONFIG_H) pcp.h version
*** 1889,1896 ****
  	  -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
  	  -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
  	  -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
! 	  -DCROSS_INCLUDE_DIR=\"$(tooldir)/sys-include\" \
! 	  -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
  	  -c `echo $(srcdir)/cccp.c | sed 's,^\./,,'`
  
  LIBCPP_OBJS =	cpplib.o cpphash.o cppalloc.o cpperror.o cppexp.o cppfiles.o \
--- 1891,1898 ----
  	  -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
  	  -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
  	  -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
! 	  -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \
! 	  -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
  	  -c `echo $(srcdir)/cccp.c | sed 's,^\./,,'`
  
  LIBCPP_OBJS =	cpplib.o cpphash.o cppalloc.o cpperror.o cppexp.o cppfiles.o \
*************** cpplib.o: cpplib.c $(CONFIG_H) cpplib.h 
*** 1918,1925 ****
  	  -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
  	  -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
  	  -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
! 	  -DCROSS_INCLUDE_DIR=\"$(tooldir)/sys-include\" \
! 	  -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
  	  -c `echo $(srcdir)/cpplib.c | sed 's,^\./,,'`
  
  cpperror.o: cpperror.c $(CONFIG_H) cpplib.h machmode.h system.h
--- 1920,1927 ----
  	  -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
  	  -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
  	  -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
! 	  -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \
! 	  -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
  	  -c `echo $(srcdir)/cpplib.c | sed 's,^\./,,'`
  
  cpperror.o: cpperror.c $(CONFIG_H) cpplib.h machmode.h system.h
*************** protoize.o: protoize.c $(srcdir)/../incl
*** 1956,1963 ****
  	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
            -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
  	  -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
! 	  -DCROSS_INCLUDE_DIR=\"$(tooldir)/sys-include\" \
! 	  -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
  	  -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
  	  -DSTD_PROTO_DIR=\"$(libsubdir)\" \
  	  $(srcdir)/protoize.c
--- 1958,1965 ----
  	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
            -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
  	  -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
! 	  -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \
! 	  -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
  	  -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
  	  -DSTD_PROTO_DIR=\"$(libsubdir)\" \
  	  $(srcdir)/protoize.c
*************** unprotoize.o: unprotoize.c protoize.c $(
*** 1967,1974 ****
  	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
            -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
  	  -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
! 	  -DCROSS_INCLUDE_DIR=\"$(tooldir)/sys-include\" \
! 	  -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
  	  -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
  	  -DSTD_PROTO_DIR=\"$(libsubdir)\" \
  	  $(srcdir)/unprotoize.c
--- 1969,1976 ----
  	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
            -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
  	  -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
! 	  -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \
! 	  -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
  	  -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
  	  -DSTD_PROTO_DIR=\"$(libsubdir)\" \
  	  $(srcdir)/unprotoize.c
*************** stmp-fixinc: $(FIXINCLUDES) gsyslimits.h
*** 2098,2110 ****
  	  cp $(srcdir)/gsyslimits.h include/syslimits.h; \
  	fi
  	chmod a+r include/syslimits.h
! # If $(SYSTEM_HEADER_DIR) is $(tooldir)/sys-include, and
  # that directory exists, then make sure that $(libsubdir) exists.
! # This is because cpp is compiled to find $(tooldir)/include via
  # $(libsubdir)/$(unlibsubdir), which will only work if $(libsubdir)
  # exists.
! 	if [ "$(SYSTEM_HEADER_DIR)" = "$(tooldir)/sys-include" ] \
! 	   && [ -d $(tooldir)/sys-include ]; then \
  	  if [ -d $(libdir) ] ; then true ; else mkdir $(libdir) ; fi; \
  	  if [ -d $(libdir)/gcc-lib ] ; then true ; else mkdir $(libdir)/gcc-lib; fi; \
  	  if [ -d $(libdir)/gcc-lib/$(target_alias) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target_alias) ; fi; \
--- 2100,2112 ----
  	  cp $(srcdir)/gsyslimits.h include/syslimits.h; \
  	fi
  	chmod a+r include/syslimits.h
! # If $(SYSTEM_HEADER_DIR) is $(gcc_tooldir)/sys-include, and
  # that directory exists, then make sure that $(libsubdir) exists.
! # This is because cpp is compiled to find $(gcc_tooldir)/include via
  # $(libsubdir)/$(unlibsubdir), which will only work if $(libsubdir)
  # exists.
! 	if [ "$(SYSTEM_HEADER_DIR)" = "$(gcc_tooldir)/sys-include" ] \
! 	   && [ -d $(gcc_tooldir)/sys-include ]; then \
  	  if [ -d $(libdir) ] ; then true ; else mkdir $(libdir) ; fi; \
  	  if [ -d $(libdir)/gcc-lib ] ; then true ; else mkdir $(libdir)/gcc-lib; fi; \
  	  if [ -d $(libdir)/gcc-lib/$(target_alias) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target_alias) ; fi; \
*************** installdirs:
*** 2387,2393 ****
  	done
  	-if [ -d $(bindir) ] ; then true ; else mkdir $(bindir) ; chmod a+rx $(bindir) ; fi
  	-if [ -d $(includedir) ] ; then true ; else mkdir $(includedir) ; chmod a+rx $(includedir) ; fi
! 	-if [ -d $(tooldir) ] ; then true ; else mkdir $(tooldir) ; chmod a+rx $(tooldir) ; fi
  	-if [ -d $(assertdir) ] ; then true ; else mkdir $(assertdir) ; chmod a+rx $(assertdir) ; fi
  	-if [ -d $(infodir) ] ; then true ; else mkdir $(infodir) ; chmod a+rx $(infodir) ; fi
  # We don't use mkdir -p to create the parents of man1dir,
--- 2389,2395 ----
  	done
  	-if [ -d $(bindir) ] ; then true ; else mkdir $(bindir) ; chmod a+rx $(bindir) ; fi
  	-if [ -d $(includedir) ] ; then true ; else mkdir $(includedir) ; chmod a+rx $(includedir) ; fi
! 	-if [ -d $(gcc_tooldir) ] ; then true ; else mkdir $(gcc_tooldir) ; chmod a+rx $(gcc_tooldir) ; fi
  	-if [ -d $(assertdir) ] ; then true ; else mkdir $(assertdir) ; chmod a+rx $(assertdir) ; fi
  	-if [ -d $(infodir) ] ; then true ; else mkdir $(infodir) ; chmod a+rx $(infodir) ; fi
  # We don't use mkdir -p to create the parents of man1dir,
*************** install-common: native installdirs $(EXT
*** 2453,2466 ****
  	fi
  
  # Install the driver program as $(target_alias)-gcc
! # and also as either gcc (if native) or $(tooldir)/bin/gcc.
  install-driver: xgcc$(exeext)
  	-if [ -f gcc-cross$(exeext) ] ; then \
  	  rm -f $(bindir)/$(GCC_CROSS_NAME)$(exeext); \
  	  $(INSTALL_PROGRAM) gcc-cross$(exeext) $(bindir)/$(GCC_CROSS_NAME)$(exeext); \
! 	  if [ -d $(tooldir)/bin/. ] ; then \
! 	    rm -f $(tooldir)/bin/gcc$(exeext); \
! 	    $(INSTALL_PROGRAM) gcc-cross$(exeext) $(tooldir)/bin/gcc$(exeext); \
  	  else true; fi; \
  	else \
  	  rm -f $(bindir)/$(GCC_INSTALL_NAME)$(exeext); \
--- 2455,2468 ----
  	fi
  
  # Install the driver program as $(target_alias)-gcc
! # and also as either gcc (if native) or $(gcc_tooldir)/bin/gcc.
  install-driver: xgcc$(exeext)
  	-if [ -f gcc-cross$(exeext) ] ; then \
  	  rm -f $(bindir)/$(GCC_CROSS_NAME)$(exeext); \
  	  $(INSTALL_PROGRAM) gcc-cross$(exeext) $(bindir)/$(GCC_CROSS_NAME)$(exeext); \
! 	  if [ -d $(gcc_tooldir)/bin/. ] ; then \
! 	    rm -f $(gcc_tooldir)/bin/gcc$(exeext); \
! 	    $(INSTALL_PROGRAM) gcc-cross$(exeext) $(gcc_tooldir)/bin/gcc$(exeext); \
  	  else true; fi; \
  	else \
  	  rm -f $(bindir)/$(GCC_INSTALL_NAME)$(exeext); \



More information about the Gcc-patches mailing list