blob: 75c342e97ce3923eff0eec8647a90823b16c4d4f [file] [log] [blame]
Guillaume Martreseb2fbea2013-08-14 18:56:48 -07001#!/bin/sh
John Koleszar0ea50ce2010-05-18 11:58:33 -04002##
John Koleszarc2140b82010-09-09 08:16:39 -04003## Copyright (c) 2010 The WebM project authors. All Rights Reserved.
John Koleszar0ea50ce2010-05-18 11:58:33 -04004##
John Koleszar94c52e42010-06-18 12:39:21 -04005## Use of this source code is governed by a BSD-style license
John Koleszar09202d82010-06-04 16:19:40 -04006## 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
John Koleszar94c52e42010-06-18 12:39:21 -04008## in the file PATENTS. All contributing project authors may
John Koleszar09202d82010-06-04 16:19:40 -04009## be found in the AUTHORS file in the root of the source tree.
John Koleszar0ea50ce2010-05-18 11:58:33 -040010##
11
12
13verbose=0
14set -- $*
15for i; do
Guillaume Martreseb2fbea2013-08-14 18:56:48 -070016 if [ "$i" = "-o" ]; then
John Koleszar0ea50ce2010-05-18 11:58:33 -040017 on_of=1
Guillaume Martreseb2fbea2013-08-14 18:56:48 -070018 elif [ "$i" = "-v" ]; then
John Koleszar0ea50ce2010-05-18 11:58:33 -040019 verbose=1
Guillaume Martreseb2fbea2013-08-14 18:56:48 -070020 elif [ "$i" = "-g" ]; then
Attila Nagy0905af32011-02-04 10:21:43 +020021 args="${args} --debug"
Guillaume Martreseb2fbea2013-08-14 18:56:48 -070022 elif [ "$on_of" = "1" ]; then
John Koleszar0ea50ce2010-05-18 11:58:33 -040023 outfile=$i
Attila Nagy0905af32011-02-04 10:21:43 +020024 on_of=0
John Koleszar0ea50ce2010-05-18 11:58:33 -040025 elif [ -f "$i" ]; then
26 infiles="$infiles $i"
Guillaume Martreseb2fbea2013-08-14 18:56:48 -070027 elif [ "${i#-l}" != "$i" ]; then
John Koleszar0ea50ce2010-05-18 11:58:33 -040028 libs="$libs ${i#-l}"
Guillaume Martreseb2fbea2013-08-14 18:56:48 -070029 elif [ "${i#-L}" != "$i" ]; then
Attila Nagy0905af32011-02-04 10:21:43 +020030 libpaths="${libpaths} ${i#-L}"
John Koleszar0ea50ce2010-05-18 11:58:33 -040031 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