Update dependencies with "make dep-am".
[deliverable/binutils-gdb.git] / ld / genscripts.sh
index eea5401515beba8e8bf3b1a9b0fd928870e41fde..f6a29703d4b9163f534a4455f384ca5f16f89989 100755 (executable)
@@ -1,23 +1,32 @@
 #!/bin/sh
 # genscripts.sh - generate the ld-emulation-target specific files
 #
-# Usage: genscripts.sh srcdir libdir host target target_alias \
-# default_emulation native_lib_dirs this_emulation tool_dir
+# Usage: genscripts.sh srcdir libdir exec_prefix \
+#        host target target_alias default_emulation \
+#        native_lib_dirs this_emulation tool_dir
 #
 # Sample usage:
-# genscripts.sh /djm/ld-devo/devo/ld /usr/local/lib sparc-sun-sunos4.1.3 \
-# sparc-sun-sunos4.1.3 sparc-sun-sunos4.1.3 sun4 "" sun3 sparc-sun-sunos4.1.3
+# genscripts.sh /djm/ld-devo/devo/ld /usr/local/lib /usr/local \
+#  sparc-sun-sunos4.1.3 sparc-sun-sunos4.1.3 sparc-sun-sunos4.1.3 sun4 \
+#  "" sun3 sparc-sun-sunos4.1.3
 # produces sun3.x sun3.xbn sun3.xn sun3.xr sun3.xu em_sun3.c
 
 srcdir=$1
 libdir=$2
-host=$3
-target=$4
-target_alias=$5
-DEFAULT_EMULATION=$6
-NATIVE_LIB_DIRS=$7
-EMULATION_NAME=$8
-tool_lib=`echo ${libdir} | sed -e 's|/lib$||'`/${9-$target_alias}/lib
+exec_prefix=$3
+host=$4
+target=$5
+target_alias=$6
+EMULATION_LIBPATH=$7
+NATIVE_LIB_DIRS=$8
+EMULATION_NAME=$9
+shift 9
+# Can't use ${1:-$target_alias} here due to an Ultrix shell bug.
+if [ "x$1" = "x" ] ; then
+  tool_lib=${exec_prefix}/${target_alias}/lib
+else
+  tool_lib=${exec_prefix}/$1/lib
+fi
 
 # Include the emulation-specific parameters:
 . ${srcdir}/emulparams/${EMULATION_NAME}.sh
@@ -36,26 +45,24 @@ fi
 # To force a logically empty LIB_PATH, do LIBPATH=":".
 
 if [ "x${LIB_PATH}" = "x" ] ; then
+  # Cross, or native non-default emulation not requesting LIB_PATH.
+  LIB_PATH=
+
   if [ "x${host}" = "x${target}" ] ; then
-    if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then
-      # Native.
-      LIB_PATH=/lib:/usr/lib
-      if [ -n "${NATIVE_LIB_DIRS}" ]; then
-       LIB_PATH=${LIB_PATH}:${NATIVE_LIB_DIRS}
-      fi
-      if [ "${libdir}" != /usr/lib ]; then
-       LIB_PATH=${LIB_PATH}:${libdir}
-      fi
-      if [ "${libdir}" != /usr/local/lib ] ; then
-       LIB_PATH=${LIB_PATH}:/usr/local/lib
-      fi
-    else
-      # Native, but not default emulation.
-      LIB_PATH=
-    fi
-  else
-    # Cross.
-    LIB_PATH=
+    case " $EMULATION_LIBPATH " in
+      *" ${EMULATION_NAME} "*)
+        # Native, and default or emulation requesting LIB_PATH.
+        LIB_PATH=/lib:/usr/lib
+        if [ -n "${NATIVE_LIB_DIRS}" ]; then
+         LIB_PATH=${LIB_PATH}:${NATIVE_LIB_DIRS}
+        fi
+        if [ "${libdir}" != /usr/lib ]; then
+         LIB_PATH=${LIB_PATH}:${libdir}
+        fi
+        if [ "${libdir}" != /usr/local/lib ] ; then
+         LIB_PATH=${LIB_PATH}:/usr/local/lib
+        fi
+    esac
   fi
 fi
 
@@ -127,7 +134,9 @@ if test -n "$GENERATE_SHLIB_SCRIPT"; then
     ldscripts/${EMULATION_NAME}.xs
 fi
 
-test "$DEFAULT_EMULATION" = "$EMULATION_NAME" && COMPILE_IN=true
+for i in $EMULATION_LIBPATH ; do
+  test "$i" = "$EMULATION_NAME" && COMPILE_IN=true
+done
 
 # Generate e${EMULATION_NAME}.c.
 . ${srcdir}/emultempl/${TEMPLATE_NAME-generic}.em
This page took 0.023389 seconds and 4 git commands to generate.