summaryrefslogtreecommitdiff
path: root/linkers/mkapp.sh
blob: 4954ab206fb189de80fbfb2e4b7d35ce911c16c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#! /bin/sh
#
# Make an application using the object files in the RTL application.
# Please build the RTL application first.
#

if [ $# -ne 2 ]; then
  echo "error: bad arguments: ./mkapp <path to RTL app> <path to C compiler>"
  exit 2
fi

if [ ! -d $1 ]; then
  echo "error: not a directory: $1"
  exit 3
fi

if [ ! -f $2 ]; then
  echo "error: not a file: $2"
  exit 3
fi

o1="$1/xa.c.1.o"
o2="$1/x-long-name-to-create-gnu-extension-in-archive.c.1.o"

if [ ! -e ${o1} ]; then
  echo "error: cannot find: ${o1}"
  exit 4
fi

if [ ! -e ${o2} ]; then
  echo "error: cannot find: ${o2}"
  exit 4
fi

case $(uname -s) in
  Darwin) platform="darwin" ;;
  Linux)  platform="linux2" ;;
  WIN32)  platform="win32" ;;
  *)
    echo "error: unsupported platform"
    exit 5
esac

echo "./build-${platform}/rtems-ld -S --base $1/rtld --cc $2 -o rtl-app.rap ${o1} ${o2}"
./build-${platform}/rtems-ld -S --base $1/rtld --cc $2 -o rtl-app.rap ${o1} ${o2}

exit 0