#!/bin/sh
# Construct makefile for libgcc.
#   Copyright (C) 2000 Free Software Foundation, Inc.
#
# This file is part of GCC.

# Arguments, taken from the environment, since there are a lot
# of them, and positional args becomes quite ugly.
#
# objext
# LIB1ASMFUNCS
# LIB2FUNCS
# LIB2FUNCS_ST
# LIB2ADD
# LIB2ADD_ST 
# LIB2ADDEH
# LIB2ADDEHDEP
# FPBIT
# FPBIT_FUNCS
# LIB2_DIVMOD_FUNCS
# DPBIT
# DPBIT_FUNCS
# LIBGCC
# MULTILIBS
# EXTRA_MULTILIB_PARTS
# SHLIB_EXT
# SHLIB_LINK
# SHLIB_MULTILIB
# SHLIB_MKMAP
# SHLIB_MAPFILES
# SHLIB_NM_FLAGS
# SHLIB_INSTALL

# Make needs VPATH to be literal.
echo 'srcdir = @srcdir@'
# /* APPLE LOCAL libcc_kext */
echo 'objdir = @objdir@'
echo 'VPATH = @srcdir@'
echo 'EQ = ='
echo
echo 'force:'
echo

# Disable SHLIB_LINK if shared libgcc not enabled.
if [ "@enable_shared@" = "no" ]; then
  SHLIB_LINK=""
fi

# Build lines.

gcc_compile='$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES)'
make_compile='$(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
	  AR_FOR_TARGET="$(AR_FOR_TARGET)" \
	  AR_CREATE_FOR_TARGET="$(AR_CREATE_FOR_TARGET)" \
	  AR_EXTRACT_FOR_TARGET="$(AR_EXTRACT_FOR_TARGET)" \
	  AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" \
	  CC="$(CC)" CFLAGS="$(CFLAGS)" \
	  HOST_PREFIX="$(HOST_PREFIX)" \
	  HOST_PREFIX_1="$(HOST_PREFIX_1)" \
	  LANGUAGES="$(LANGUAGES)"'

# Dependencies for libgcc2.c
libgcc2_c_dep='stmp-dirs $(srcdir)/libgcc2.c $(CONFIG_H) $(MACHMODE_H) longlong.h gbl-ctors.h config.status stmp-int-hdrs tsystem.h'" $LIB2ADDEHDEP"

# Dependencies for fp-bit.c
fpbit_c_dep='stmp-dirs config.status tsystem.h'

# APPLE LOCAL begin libcc_kext
# Dependencies for libcc_kext
libcc_kext_c_dep='stmp-dirs $(srcdir)/libgcc2.c $(CONFIG_H) $(MACHMODE_H) longlong.h config.status stmp-int-hdrs tsystem.h'

# Kext-specific flags are here instead of Makefile.in because build_gcc currently builds libgcc.a and libcc_kext.a with 'all' target.
libcc_kext_flags='-Dmalloc=kern_os_malloc -Dfree=kern_os_free -DLIBCC_KEXT -static -fno-exceptions'
# APPLE LOCAL end libcc_kext

#
# Build libgcc1 components.
#

libgcc1_objs=""

for name in $LIB1ASMFUNCS; do
  for ml in $MULTILIBS; do
    dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
    flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
    out="libgcc/${dir}/${name}${objext}"

    echo ${out}: stmp-dirs '$(srcdir)/config/$(LIB1ASMSRC)'
    echo "	$gcc_compile" $flags -DL$name -xassembler-with-cpp \
	  -c '$(srcdir)/config/$(LIB1ASMSRC)' -o $out

    # Remove any objects from LIB2FUNCS and LIB2_DIVMOD_FUNCS that are
    # defined as optimized assembly code in LIB1ASMFUNCS.
    LIB2FUNCS=`echo $LIB2FUNCS | sed -e 's/^'$name' //' \
				     -e 's/ '$name' / /' \
				     -e 's/ '$name'$//'`
    LIB2_DIVMOD_FUNCS=`echo $LIB2_DIVMOD_FUNCS | sed -e 's/^'$name' //' \
				                     -e 's/ '$name' / /' \
				                     -e 's/ '$name'$//'`
  done
  libgcc1_objs="$libgcc1_objs ${name}${objext}"
done

#
# Build libgcc2 components.
#

libgcc2_objs=""
libgcc2_st_objs=""
libgcc2_eh_objs=""

for name in $LIB2FUNCS; do
  for ml in $MULTILIBS; do
    dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
    flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
    out="libgcc/${dir}/${name}${objext}"

    echo $out: $libgcc2_c_dep
    echo "	$gcc_compile" '$(MAYBE_USE_COLLECT2)' $flags -DL$name \
      -c '$(srcdir)/libgcc2.c' -o $out
  done
  libgcc2_objs="$libgcc2_objs ${name}${objext}"
done

for name in $LIB2FUNCS_ST; do
  for ml in $MULTILIBS; do
    dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
    flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
    out="libgcc/${dir}/${name}${objext}"

    echo $out: $libgcc2_c_dep
    echo "	$gcc_compile" '$(MAYBE_USE_COLLECT2)' $flags -DL$name \
      -c '$(srcdir)/libgcc2.c' -o $out
  done
  libgcc2_st_objs="$libgcc2_st_objs ${name}${objext}"
done

for name in $LIB2_DIVMOD_FUNCS; do
  for ml in $MULTILIBS; do
    dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
    flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
    out="libgcc/${dir}/${name}${objext}"

    echo $out: $libgcc2_c_dep
    echo "	$gcc_compile" '$(MAYBE_USE_COLLECT2)' $flags -DL$name \
      -c '$(srcdir)/libgcc2.c' -fexceptions -fnon-call-exceptions -o $out
  done
  libgcc2_objs="$libgcc2_objs ${name}${objext}"
done

if [ "$FPBIT" ]; then
  for name in $FPBIT_FUNCS; do
    for ml in $MULTILIBS; do
      dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
      flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
      out="libgcc/${dir}/${name}${objext}"

      echo $out: $FPBIT $fpbit_c_dep
      echo "	$gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
	  -c $FPBIT -o $out
    done
    libgcc2_objs="$libgcc2_objs ${name}${objext}"
  done
fi

if [ "$DPBIT" ]; then
  for name in $DPBIT_FUNCS; do
    for ml in $MULTILIBS; do
      dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
      flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
      out="libgcc/${dir}/${name}${objext}"

      echo $out: $DPBIT $fpbit_c_dep
      echo "	$gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
	  -c $DPBIT -o $out
    done
    libgcc2_objs="$libgcc2_objs ${name}${objext}"
  done
fi

# APPLE LOCAL begin libcc_kext
if [ "$FPBIT" ]; then					# kext
  for name in $FPBIT_FUNCS; do				# kext
    for ml in $MULTILIBS; do				# kext
      dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`	# kext
      flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;	# kext
      out="libcc_kext/${dir}/${name}${objext}"		# kext
							# kext
      echo ''						# kext
      echo $out: $FPBIT $fpbit_c_dep			# kext
      echo "	$gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
        -c $FPBIT -o $out				# kext
    done						# kext
    libcc_kext2_objs="$libcc_kext2_objs ${name}${objext}"  # kext
  done							# kext
fi							# kext
							# kext
if [ "$DPBIT" ]; then					# kext
  for name in $DPBIT_FUNCS; do				# kext
    for ml in $MULTILIBS; do				# kext
      dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`	# kext
      flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;	# kext
      out="libcc_kext/${dir}/${name}${objext}"		# kext
							# kext
      echo ''						# kext
      echo $out: $DPBIT $fpbit_c_dep			# kext
      echo "	$gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
	-c $DPBIT -o $out				# kext
    done						# kext
    libcc_kext2_objs="$libcc_kext2_objs ${name}${objext}"  # kext
  done							# kext
fi							# kext
# APPLE LOCAL end libcc_kext

for file in $LIB2ADD; do
  name=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//' -e 's/[.]txt$//'`
  oname=`echo $name | sed -e 's,.*/,,'`

  for ml in $MULTILIBS; do
    dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
    flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
    out="libgcc/${dir}/${oname}${objext}"
    if [ ${name}.asm = ${file} ]; then
      flags="$flags -xassembler-with-cpp"
    fi

    echo $out: stmp-dirs $file
    echo "	$gcc_compile" $flags -c $file -o $out
  done
  libgcc2_objs="$libgcc2_objs ${oname}${objext}"
done

# APPLE LOCAL begin libcc_kext
for file in $LIB2ADD; do				# kext
  name=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//' -e 's/[.]txt$//'` # kext
  oname=`echo $name | sed -e 's,.*/,,'`			# kext
  for ml in $MULTILIBS; do				# kext
    dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'` # kext
    flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; # kext
    out="libcc_kext/${dir}/${oname}${objext}"		# kext
    if [ ${name}.asm = ${file} ]; then			# kext
      flags="$flags -xassembler-with-cpp"		# kext
    fi							# kext
							# kext
    echo $out: stmp-dirs $file				# kext
    echo "	$gcc_compile" $flags -c $file -o $out	# kext
  done							# kext
  libcc_kext2_objs="$libcc_kext2_objs ${oname}${objext}" # kext
done							# kext
# APPLE LOCAL end libcc_kext

for file in $LIB2ADDEH; do
  name=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//' -e 's/[.]txt$//'`
  oname=`echo $name | sed -e 's,.*/,,'`

  for ml in $MULTILIBS; do
    dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
    flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
    out="libgcc/${dir}/${oname}${objext}"
    if [ ${name}.asm = ${file} ]; then
      flags="$flags -xassembler-with-cpp"
    fi

    echo $out: stmp-dirs $file
    echo "	$gcc_compile" $flags -fexceptions -c $file -o $out
  done
  if [ "$SHLIB_LINK" ]; then
    libgcc2_eh_objs="$libgcc2_eh_objs ${oname}${objext}"
  else
    libgcc2_objs="$libgcc2_objs ${oname}${objext}"
  fi
done

for file in $LIB2ADD_ST; do
  name=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//' -e 's/[.]txt$//'`
  oname=`echo $name | sed -e 's,.*/,,'`

  for ml in $MULTILIBS; do
    dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
    flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
    out="libgcc/${dir}/${oname}${objext}"
    if [ ${name}.asm = ${file} ]; then
      flags="$flags -xassembler-with-cpp"
    fi

    echo $out: stmp-dirs $file
    echo "	$gcc_compile" $flags -c $file -o $out
  done
  libgcc2_st_objs="$libgcc2_st_objs ${oname}${objext}"
done

# APPLE LOCAL begin libcc_kext
#
# Build libcc_kext components.
#

libcc_kext2_supcxx_objs=""

for name in $LIBKFUNCS; do
  for ml in $MULTILIBS; do
    dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
    flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`
    out="libcc_kext/${dir}/${name}${objext}"

    echo ''
    echo $out: $libcc_kext_c_dep
    echo "	$gcc_compile" $flags -DL$name $libcc_kext_flags \
      -c '$(srcdir)/libgcc2.c' -o $out
  done
  libcc_kext2_objs="$libcc_kext2_objs ${name}${objext}"
done

for name in $LIBKSUPCXXFUNCS; do
  for ml in $MULTILIBS; do
    dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
    flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`
    stem=`echo ${name} | sed -e 's/\.[^.]*//'`
    cxx_root='$(srcdir)/../libstdc++-v3' ; cxx_root_incl=${cxx_root}/include
    config_stuff='$(objdir)'
    file=${cxx_root}/libsupc++/${name}
    incls="-I${cxx_root}/libsupc++ -I${cxx_root_incl}/std -I${cxx_root_incl}/c_std -I${config_stuff}"
    out="libcc_kext/${dir}/${stem}${objext}"

    echo ''
    echo $out: $libcc_kext_cxxsup_dep $file
    echo "	$gcc_compile" $flags $libcc_kext_flags $incls \
      -c $file -o $out
  done
  libcc_kext2_supcxx_objs="$libcc_kext2_supcxx_objs ${stem}${objext}"
done
# APPLE LOCAL end libcc_kext

# SHLIB_MKMAP
# SHLIB_MAPFILES
for ml in $MULTILIBS; do
  dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
  flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;

  libgcc_objs=""
  libgcc_eh_objs=""
  for o in $libgcc1_objs; do
    libgcc_objs="$libgcc_objs libgcc/${dir}/$o"
  done
  for o in $libgcc2_objs; do
    libgcc_objs="$libgcc_objs libgcc/${dir}/$o"
  done
  for o in $libgcc2_eh_objs; do
    libgcc_eh_objs="$libgcc_eh_objs libgcc/${dir}/$o"
  done
  libgcc_sh_objs="$libgcc_objs $libgcc_eh_objs"
  shlib_deps="$libgcc_sh_objs"

  libgcc_st_objs=""
  for o in $libgcc2_st_objs; do
    libgcc_st_objs="$libgcc_st_objs libgcc/${dir}/$o"
  done

  # APPLE LOCAL begin libcc_kext
  libcc_kext_objs=""
  for o in $libcc_kext2_objs; do
    libcc_kext_objs="$libcc_kext_objs libcc_kext/${dir}/$o"
  done

  libcc_kext_supcxx_objs=""
  for o in $libcc_kext2_supcxx_objs; do
    libcc_kext_objs="$libcc_kext_objs libcc_kext/${dir}/$o"
  done
  # APPLE LOCAL end libcc_kext

  if [ "$SHLIB_LINK" -a "$SHLIB_MKMAP" -a -z "$mapfile" ]; then
    mapfile="libgcc.map"
    echo ""
    echo "${mapfile}: $SHLIB_MKMAP $SHLIB_MAPFILES $libgcc_sh_objs"
    echo '	{ $(NM_FOR_TARGET)'" $SHLIB_NM_FLAGS $libgcc_sh_objs; echo %%; cat $SHLIB_MAPFILES; } | "'$(AWK)'" -f $SHLIB_MKMAP > "'tmp-$@'
    echo '	mv tmp-$@ $@'
  fi
  shlib_deps="$shlib_deps $mapfile"

  # Depend on EXTRA_MULTILIB_PARTS, since that's where crtbegin/end
  # usually are put in a true multilib situation.
  for f in $EXTRA_MULTILIB_PARTS; do
    shlib_deps="$shlib_deps $dir/$f"
  done

  echo ""
  echo "${dir}/libgcc.a: $libgcc_objs $libgcc_st_objs"
  echo "	-rm -rf ${dir}/libgcc.a"
  echo '	$(AR_CREATE_FOR_TARGET)' ${dir}/libgcc.a $libgcc_objs $libgcc_st_objs
  echo '	if $(RANLIB_TEST_FOR_TARGET) ; then' \\
  echo '	  $(RANLIB_FOR_TARGET)' ${dir}/libgcc.a ';' \\
  echo '	else true; fi;'

  if [ "$SHLIB_LINK" ]; then

    echo ""
    echo "${dir}/libgcc_eh.a: $libgcc_eh_objs"
    echo "	-rm -rf ${dir}/libgcc_eh.a"
    echo '	$(AR_CREATE_FOR_TARGET)' ${dir}/libgcc_eh.a $libgcc_eh_objs
    echo '	if $(RANLIB_TEST_FOR_TARGET) ; then' \\
    echo '	  $(RANLIB_FOR_TARGET)' ${dir}/libgcc_eh.a ';' \\
    echo '	else true; fi;'

    if [ -z "$SHLIB_MULTILIB" ]; then
      if [ "$dir" = "." ]; then
	shlib_base_name="libgcc_s";
      else
	shlib_base_name=libgcc_s_`echo $dir | sed s,/,_,g`
      fi
      echo ""
      echo "${dir}/${shlib_base_name}${SHLIB_EXT}: $shlib_deps"
      echo "	$SHLIB_LINK" \
	 | sed -e "s%@multilib_flags@%$flags%g" \
	       -e "s%@multilib_dir@%$dir%g" \
	       -e "s%@shlib_objs@%$libgcc_sh_objs%g" \
	       -e "s%@shlib_base_name@%$shlib_base_name%g" \
	       -e "s%@shlib_map_file@%$mapfile%g"
    elif [ "$SHLIB_MULTILIB" = "$dir" ]; then
      shlib_base_name="libgcc_s";
      echo ""
      echo "${shlib_base_name}${SHLIB_EXT}: $shlib_deps"
      echo "	$SHLIB_LINK" \
	 | sed -e "s%@multilib_flags@%$flags%g" \
	       -e "s%@multilib_dir@%$dir%g" \
	       -e "s%@shlib_objs@%$libgcc_sh_objs%g" \
	       -e "s%@shlib_base_name@%$shlib_base_name%g" \
	       -e "s%@shlib_map_file@%$mapfile%g"
    fi
  fi

# /* APPLE LOCAL begin libcc_kext */
  echo ""
  echo "${dir}/libcc_kext.a: $libcc_kext_objs $libcc_kext_supcxx_objs"
  echo "	-rm -rf ${dir}/libcc_kext.a"
  echo '	$(AR_CREATE_FOR_TARGET)' ${dir}/libcc_kext.a $libcc_kext_objs $libcc_kext_supcxx_objs
  echo '	nmedit -p' ${dir}/libcc_kext.a
  echo '	if $(RANLIB_TEST_FOR_TARGET) ; then' \\
  echo '	  $(RANLIB_FOR_TARGET)' ${dir}/libcc_kext.a ';' \\
  echo '	else true; fi;'
# /* APPLE LOCAL end libcc_kext */

done

# /* APPLE LOCAL libcc_kext */
dirs='libgcc libcc_kext'
for ml in $MULTILIBS; do
  dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
  if [ $dir != . ]; then
    dirs="$dirs libgcc/${dir}"
  fi
done
echo ''
echo 'libgcc-stage-start:'
echo '	for dir in '"${dirs}"'; do \'
echo '	  if [ -d $(stage)/$$dir ]; then true; else mkdir $(stage)/$$dir; fi; \'
echo '	done'
echo '	-for dir in '"${dirs}"'; do \'
echo '	  mv $$dir/*'"${objext}"' $(stage)/$$dir; \'
echo '	done'

echo ""
all=stmp-dirs
# /* APPLE LOCAL libcc_kext */
dirs='libgcc libcc_kext'

for ml in $MULTILIBS; do
  dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
  if [ $dir != . ]; then
    dirs="$dirs ${dir} libgcc/${dir}"
  fi
  all="$all ${dir}/libgcc.a"
  if [ "$SHLIB_LINK" ]; then
    all="$all ${dir}/libgcc_eh.a"
    if [ -z "$SHLIB_MULTILIB" ]; then
      if [ "$dir" = "." ]; then
	suff="";
      else
	suff=_`echo $dir | sed s,/,_,g`
      fi
      all="$all ${dir}/libgcc_s${suff}${SHLIB_EXT}"
    elif [ "$SHLIB_MULTILIB" = "$dir" ]; then
      all="$all libgcc_s${SHLIB_EXT}"
    fi
  fi
done

echo 'stmp-dirs: force'
echo '	for d in '"$dirs"'; do \'
echo '	  if [ -d $$d ]; then true; else '$mkinstalldirs' $$d; fi; \'
echo '	done'
echo '	if [ -f stmp-dirs ]; then true; else touch stmp-dirs; fi'

for f in $EXTRA_MULTILIB_PARTS; do
  for ml in $MULTILIBS; do
    dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
    flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
    case $dir in
    .) out=$f ; t= ;;
    *) out=$dir/$f ; t=$dir/ ;;
    esac
    case $out in
    # Prevent `make' from interpreting $out as a macro assignment
    *'$(EQ)'*) targ="T_TARGET=$out T_TARGET" ;;
    *) targ=$out ;;
    esac

    echo $out: stmp-dirs
    echo "	$make_compile" \\
    echo '	  LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)' $flags '" ' \\
    echo '	  MULTILIB_CFLAGS="'$flags'"' T=$t $targ

    all="$all $out"
  done
done

echo ""
echo "all: $all"

echo ""
echo "install: $all"
for ml in $MULTILIBS; do
  dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
  if [ $dir != . ]; then
    ldir='$(libsubdir)'/$dir
    echo "	if [ -d $ldir ]; then true; else mkdir $ldir; chmod a+rx $ldir; fi;"
  else
    ldir='$(libsubdir)'
  fi
  echo '	$(INSTALL_DATA)' ${dir}/libgcc.a ${ldir}/
  echo '	$(RANLIB_FOR_TARGET)' ${ldir}/libgcc.a
# /* APPLE LOCAL begin libcc_kext */
  echo '	if [ -e' "${ldir}/libcc_kext.a" ']; then \'
  echo '	  $(INSTALL_DATA)' ${dir}/libcc_kext.a ${ldir}/'; \'
  echo '	  $(RANLIB_FOR_TARGET)' ${ldir}/libcc_kext.a'; \'
  echo '	fi'
# /* APPLE LOCAL end libcc_kext */

  if [ "$SHLIB_LINK" ]; then
    echo '	$(INSTALL_DATA)' ${dir}/libgcc_eh.a ${ldir}/
    echo '	$(RANLIB_FOR_TARGET)' ${ldir}/libgcc_eh.a

    if [ -z "$SHLIB_MULTILIB" ]; then
      if [ "$dir" = "." ]; then
	shlib_base_name="libgcc_s";
      else
	shlib_base_name=libgcc_s_`echo $dir | sed s,/,_,g`
      fi
      echo "	$SHLIB_INSTALL" \
	| sed -e "s%@shlib_base_name@%$shlib_base_name%g"
    elif [ "$SHLIB_MULTILIB" = "$dir" ]; then
      shlib_base_name="libgcc_s";
      echo "	$SHLIB_INSTALL" \
	| sed -e "s%@shlib_base_name@%$shlib_base_name%g"
    fi
  fi
done
for f in $EXTRA_MULTILIB_PARTS; do
  for ml in $MULTILIBS; do
    dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
    if [ $dir != . ]; then
      out=${dir}/$f
      ldir='$(libsubdir)'/$dir
    else
      out=$f
      ldir='$(libsubdir)'
    fi
    echo '	$(INSTALL_DATA)' $out $ldir/
  done
done
