source: rtems/tools/build/multigen @ 2f3d804

5
Last change on this file since 2f3d804 was 65c6425, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 17:24:46

Remove CVS Id Strings (manual edits after script)

These modifications were required by hand after running the script.
In some cases, the file names did not match patterns. In others,
the format of the file did not match any common patterns.

  • Property mode set to 100755
File size: 3.3 KB
Line 
1#!/bin/sh
2
3version=0.1
4verbose=0
5target=
6custom=0
7config=0
8
9usage()
10{
11program=`basename $0`
12cat << EOF
13
14$program generates RTEMS custom/*.cfgs and config-files for gcc multilib
15variants a target's gcc supports
16
17Usage: $program [options]
18
19Options:
20        --target=STRING         target
21        --custom                generate make/custom/*.cfg files
22        --config                generate config scripts
23        --rtems=DIR             use DIR as location of RTEMS source tree
24        -v, --verbose           verbose
25        -h, --help              Print this usage
26        --version               Print version and exit
27
28Examples:
29$program --config --target=sh-rtems --rtems=/usr/src/rtems-4.5.0
30        Generates config scripts for all possible bare BSPs from all
31        valid multilib variants sh-rtems-gcc supports
32
33$program --custom --target=sh-rtems --rtems=/usr/src/rtems-4.5.0
34        Generates /usr/src/rtems-4.5.0/make/custom/*.cfg files
35        for all possible bare BSPs from the multilib variants
36        sh-rtems-gcc supports
37
38Written by Ralf Corsepius <corsepiu@faw.uni-ulm.de>
39EOF
40}
41
42while test $# -gt 0; do
43  case "$1" in
44  --rtems=*)
45    rtems_srcdir=`echo "$1" | sed -e 's%--rtems=\(.*\)%\1%g'`
46    ;;
47  --target=*)
48    target=`echo "$1" | sed -e 's%--target=\(.*\)%\1%g'`
49    ;;
50  -v|--verbose)
51    verbose=1
52    ;;
53  --custom)
54    custom=1
55    ;;
56  --config)
57    config=1
58    ;;
59  --version)
60    echo `basename $0` version $version
61    exit 0
62    ;;
63  -h|--help)
64    usage
65    exit 1
66    ;;
67  *)
68    echo "unknown option $1"
69    usage
70    exit 1
71    ;;
72  esac
73  shift
74done
75
76if test $# -gt 0; then
77  echo "Invalid number of arguments"
78  exit 1
79fi
80
81if test x$target = x; then
82  echo "Missing required option:"
83  echo "        --target"
84  exit 1
85fi
86
87if test x$rtems_srcdir = x; then
88  echo "Missing required option:"
89  echo "        --rtems"
90  exit 1
91fi
92
93if test $config -eq 0 && test $custom -eq 0; then
94  echo "Missing required option:"
95  echo "        --config"
96  echo "        --custom"
97  echo " (At least one of these is required)"
98  exit 1
99fi
100
101if test ! -r $rtems_srcdir/VERSION; then
102  echo "Can't find rtems"
103  echo "Check value passed to --rtems=<DIR>"
104  exit 1
105fi
106
107if test x$target != x ;then
108target_prefix=$target-
109fi
110 
111# Check for CC
112saved_IFS=$IFS; IFS=":"
113for i in $PATH; do
114  if test -f $i/${target_prefix}gcc; then
115    CC=$i/${target_prefix}gcc
116    break
117  fi
118done
119IFS=$saved_IFS
120
121if test x$CC = x; then
122  echo "No valid gcc found"
123  exit 1
124fi
125test $verbose -gt 0 && echo "Using $CC"
126
127for i in `${CC} --print-multi-lib 2>/dev/null`; do
128  dir=`echo $i | sed -e 's/;.*$//'`
129  case $dir in
130  .) f=$target
131     flags=""
132     ;;
133  *) f=`echo $target-$dir | sed -e 's%\/%-%g'`
134     flags=`echo $i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`
135     ;;
136  esac
137
138  if test $config -gt 0; then
139    cfg="rtems-config.$f"
140    test $verbose -gt 0 && echo "Generating: $cfg"
141
142cat << EOF > $cfg
143#!/bin/sh
144
145${rtems_srcdir}/configure --target=$target \\
146'--enable-bare-cpu-cflags=$flags' \\
147--enable-rtemsbsp="bare" \\
148--enable-bare-cpu-model=NONE \\
149--disable-networking \\
150--disable-tests \\
151--enable-maintainer-mode
152EOF
153    chmod +x $cfg
154  fi
155
156  if test $custom -gt 0; then
157    cfg=${rtems_srcdir}/make/custom/bare-$f.cfg
158    test $verbose -gt 0 && echo "Generating: $cfg"
159cat << EOF > $cfg
160#  Config file for the bare-$f BSP
161
162BARE_CPU_CFLAGS=$flags
163BARE_CPU_MODEL=NONE
164
165include \$(RTEMS_ROOT)/make/custom/bare.cfg
166EOF
167
168  fi
169done
170
171exit 0
Note: See TracBrowser for help on using the repository browser.