• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2##
3##  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
4##
5##  Use of this source code is governed by a BSD-style license
6##  that can be found in the LICENSE file in the root of the source
7##  tree. An additional intellectual property rights grant can be found
8##  in the file PATENTS.  All contributing project authors may
9##  be found in the AUTHORS file in the root of the source tree.
10##
11
12
13verbose=0
14set -- $*
15for i; do
16    if [ "$i" = "-o" ]; then
17        on_of=1
18    elif [ "$i" = "-v" ]; then
19        verbose=1
20    elif [ "$i" = "-g" ]; then
21        args="${args} --debug"
22    elif [ "$on_of" = "1" ]; then
23        outfile=$i
24        on_of=0
25    elif [ -f "$i" ]; then
26        infiles="$infiles $i"
27    elif [ "${i#-l}" != "$i" ]; then
28        libs="$libs ${i#-l}"
29    elif [ "${i#-L}" != "$i" ]; then
30        libpaths="${libpaths} ${i#-L}"
31    else
32        args="${args} ${i}"
33    fi
34    shift
35done
36
37# Absolutize library file names
38for f in $libs; do
39    found=0
40    for d in $libpaths; do
41        [ -f "$d/$f" ] && infiles="$infiles $d/$f" && found=1 && break
42        [ -f "$d/lib${f}.so" ] && infiles="$infiles $d/lib${f}.so" && found=1 && break
43        [ -f "$d/lib${f}.a" ] && infiles="$infiles $d/lib${f}.a" && found=1 && break
44    done
45    [ $found -eq 0 ] && infiles="$infiles $f"
46done
47for d in $libpaths; do
48    [ -n "$libsearchpath" ] && libsearchpath="${libsearchpath},"
49    libsearchpath="${libsearchpath}$d"
50done
51
52cmd="armlink $args --userlibpath=$libsearchpath --output=$outfile $infiles"
53[ $verbose -eq 1 ] && echo $cmd
54$cmd
55