#!/bin/sh
#
#  Library Optimizer Tool build script for the uClibc-0.9.19 libc
#
#  Usage:  build <archdir> <archprefix> <srcdir> <destdir> <strip> <object>...
#

# Base of architecture-dependent directory
ARCHDIR=$1

# Prefix of architecture-dependent tools
ARCHPREFIX=$2

# Pathname of the source filesystem
TARGETDIR=$3

# Pathname of library file to generate
DEST=$4

# "strip" or "nostrip"
STRIP=$5

shift 5

# 
TOOLPREFIX=${ARCHDIR}/bin/${ARCHPREFIX}

${TOOLPREFIX}gcc \
	-shared \
 	-o ${DEST} \
        -nostdlib \
	-Wl,--warn-common \
	-W1,--warn-once \
  	-Wl,-soname=libuClibc.so.0 \
  	-e __uClibc_init \
	$* ./req/*.o 

#if [ "$STRIP" = "strip" ] ; then
  ${TOOLPREFIX}strip -R .note -R .comment ${DEST}
#fi
