source: rtems/tools/build/multigen @ 1ef6250

4.104.114.84.95
Last change on this file since 1ef6250 was 1ef6250, checked in by Joel Sherrill <joel.sherrill@…>, on 06/14/00 at 22:02:50

New file from Ralf.

  • Property mode set to 100755
File size: 3.2 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 x$target != x ;then
102target_prefix=$target-
103fi
104 
105# Check for CC
106saved_IFS=$IFS; IFS=":"
107for i in $PATH; do
108  if test -f $i/${target_prefix}gcc; then
109    CC=$i/${target_prefix}gcc
110    break
111  fi
112done
113IFS=$saved_IFS
114
115if test x$CC = x; then
116  echo "No valid gcc found"
117  exit 1
118fi
119test $verbose -gt 0 && echo "Using $CC"
120
121for i in `${CC} --print-multi-lib 2>/dev/null`; do
122  dir=`echo $i | sed -e 's/;.*$//'`
123  case $dir in
124  .) f=$target
125     flags=""
126     ;;
127  *) f=`echo $target-$dir | sed -e 's%\/%-%g'`
128     flags=`echo $i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`
129     ;;
130  esac
131
132  if test $config -gt 0; then
133    cfg="rtems-config.$f"
134    test $verbose -gt 0 && echo "Generating: $cfg"
135
136cat << EOF > $cfg
137#!/bin/sh
138
139${rtems_srcdir}/configure --target=$target \\
140'--enable-bare-cpu-cflags=$flags' \\
141--enable-rtemsbsp="bare" \\
142--enable-bare-cpu-model=NONE \\
143--disable-networking \\
144--disable-tests \\
145--enable-maintainer-mode
146EOF
147    chmod +x $cfg
148  fi
149
150  if test $custom -gt 0; then
151    cfg=${rtems_srcdir}/make/custom/bare-$f.cfg
152    test $verbose -gt 0 && echo "Generating: $cfg"
153cat << EOF > $cfg
154#  Config file for the bare-$f BSP
155
156BARE_CPU_FLAGS=$flags
157BARE_CPU_MODEL=NONE
158
159include \$(RTEMS_ROOT)/make/custom/bare.cfg
160EOF
161
162  fi
163done
164
165exit 0
Note: See TracBrowser for help on using the repository browser.