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]

cross compile fixes



AR, RANLIB, etc are defined as the target tools.  Thus using them to build
the host archive libcpp.a is wrong.  This patch fixes the libcpp.a rules to
use the host tools explicitly.

It also adds libcpp.a to STAGESTUFF so that it gets rebuilt during each stage
of the compiler and removed by a make clean.


        * Makefile.in (HOST_AR): Define.
        (HOST_AR_FLAGS, HOST_RANLIB, HOST_RANLIB_TEST): Similarly.
        (libcpp.a): Use the host tools explicitly.
        (STAGESTUFF): Add libcpp.a.


Index: Makefile.in
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/./gcc/Makefile.in,v
retrieving revision 1.197
diff -c -3 -p -r1.197 Makefile.in
*** Makefile.in	1998/11/23 16:41:09	1.197
--- Makefile.in	1998/11/24 20:45:21
*************** RANLIB = ranlib
*** 114,119 ****
--- 114,124 ----
  # Test to use to see whether ranlib exists on the system.
  RANLIB_TEST = [ -f /usr/bin/ranlib -o -f /bin/ranlib ]
  
+ HOST_AR = ar
+ HOST_AR_FLAGS = rc
+ HOST_RANLIB = ranlib
+ HOST_RANLIB_TEST = [ -f /usr/bin/ranlib -o -f /bin/ranlib ]
+ 
  # Compiler to use for compiling libgcc1.a.
  # OLDCC should not be the GNU C compiler,
  # since that would compile typical libgcc1.a functions such as mulsi3
*************** STAGESTUFF = *$(objext) insn-flags.h ins
*** 677,683 ****
   gcov$(exeext) *.bp \
   *.greg *.lreg *.combine *.flow *.cse *.jump *.rtl *.tree *.loop \
   *.dbr *.jump2 *.sched *.cse2 *.sched2 *.stack *.gcse \
!  *.[si] \
   $(LANG_STAGESTUFF)
  
  # Members of libgcc1.a.
--- 682,688 ----
   gcov$(exeext) *.bp \
   *.greg *.lreg *.combine *.flow *.cse *.jump *.rtl *.tree *.loop \
   *.dbr *.jump2 *.sched *.cse2 *.sched2 *.stack *.gcse \
!  *.[si] libcpp.a \
   $(LANG_STAGESTUFF)
  
  # Members of libgcc1.a.
*************** cccp.o: cccp.c $(CONFIG_H) pcp.h version
*** 1886,1894 ****
  LIBCPP_OBJS =	cpplib.o cpphash.o cppalloc.o cpperror.o cppexp.o cppfiles.o \
  		cppulp.o prefix.o version.o mbchar.o @extra_cpp_objs@
  
  libcpp.a: $(LIBCPP_OBJS)
! 	$(AR) $(ARFLAGS) libcpp.a $(LIBCPP_OBJS)
! 	if $(RANLIB_TEST) ; then $(RANLIB) libcpp.a ; else true ; fi
  
  cppmain$(exeext): cppmain.o libcpp.a $(LIBDEPS)
  	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cppmain$(exeext) cppmain.o \
--- 1891,1905 ----
  LIBCPP_OBJS =	cpplib.o cpphash.o cppalloc.o cpperror.o cppexp.o cppfiles.o \
  		cppulp.o prefix.o version.o mbchar.o @extra_cpp_objs@
  
+ # All the other archives built/used by this makefile are for targets.  This
+ # one is strictly for the host.
+ #
+ # For various reasons AR, RANLIB, etc are all set to the target tools and
+ # must not be used here.  Instead explicitly use the host versions.
+ #
  libcpp.a: $(LIBCPP_OBJS)
! 	$(HOST_AR) $(HOST_AR_FLAGS) libcpp.a $(LIBCPP_OBJS)
! 	if $(HOST_RANLIB_TEST) ; then $(HOST_RANLIB) libcpp.a ; else true ; fi
  
  cppmain$(exeext): cppmain.o libcpp.a $(LIBDEPS)
  	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cppmain$(exeext) cppmain.o \

Jeff Law (law@cygnus.com)
Cygnus Solutions		EGCS GNU Compiler System
http://www.cygnus.com		http://www.cygnus.com/egcs



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