source: rtems/bootstrap @ f004b2b8

5
Last change on this file since f004b2b8 was 7b1a711, checked in by Joel Sherrill <joel@…>, on 08/29/18 at 23:02:09

bootstrap: Correct help message

closes #3509.

  • Property mode set to 100755
File size: 7.3 KB
Line 
1#!/bin/sh
2#
3# helps bootstrapping, when checked out from CVS
4# requires GNU autoconf and GNU automake
5#
6# this is not meant to be exported outside the source tree
7#
8# NOTE: Inspired by libtool's autogen script
9#
10# to be run from the toplevel directory of RTEMS'
11# source tree
12
13progname=`basename $0`
14top_srcdir=`dirname $0`
15
16LC_ALL=C
17export LC_ALL
18
19verbose=""
20quiet="false"
21mode="autoreconf"
22force=0
23
24usage()
25{
26  echo
27  echo "usage: ${progname} [-c|-h|-H] [-q][-v]"
28  echo
29  echo "options:"
30  echo "        -c .. clean, remove all aclocal/autoconf/automake generated files"
31  echo "        -h .. display this message and exit"
32  echo "        -H .. regenerate headers.am files"
33  echo "        -q .. quiet, don't display directories"
34  echo "        -v .. verbose, pass -v to autotools"
35  echo
36  exit 1
37}
38
39if test ! -f $top_srcdir/aclocal/version.m4; then
40  echo "${progname}:"
41  echo "        Installation problem: Can't find file aclocal/version.m4"
42  exit 1
43fi
44
45while test $# -gt 0; do
46case $1 in
47-h|--he|--hel|--help)
48  usage ;;
49-q|--qu|--qui|--quie|--quiet)
50  quiet="true"
51  shift;;
52-v|--ve|--ver|--verb|--verbo|--verbos|--verbose)
53  verbose="-v"
54  shift;;
55-c|--cl|--cle|--clea|--clean)
56  mode="clean"
57  shift;;
58-f|--fo|--for|--forc|--force)
59  force=`expr $force + 1`
60  shift;;
61-H|--headers)
62  mode="headers"
63  shift;;
64-r|--re|--rec|--reco|--recon|--reconf)
65  mode="autoreconf"
66  shift;;
67-g|--ge|--gen|--gene|--gener|--genera|--generat|--generate)
68  mode="generate"
69  shift;;
70-*) echo "unknown option $1"
71  usage ;;
72*) echo "invalid parameter $1"
73  usage ;;
74esac
75done
76
77case $mode in
78headers)
79  if test "." != "$top_srcdir"; then
80    echo "To generate the headers.am you must call the script via \"./$progname -H\""
81    exit 1
82  fi
83  base="$PWD"
84  tmp="$base/headers.am.new"
85  for i in cpukit/include cpukit/score/cpu/*/include bsps/include bsps/*/include bsps/*/*/include ; do
86    dir=""
87    am_dir=""
88    echo '## This file was generated by "./boostrap -H".' > "$tmp"
89    case $i in
90      cpukit/include)
91        hdr="../"
92        inc="include/"
93        ;;
94      cpukit/score/cpu/*/include)
95        hdr="../"
96        inc=`echo $i | cut -d'/' -f5-`
97        inc="$inc/"
98        ;;
99      bsps/*/*/include)
100        hdr="../"
101        inc="../../../../../../$i/"
102        ;;
103      bsps/*/include)
104        hdr="../"
105        inc="../../../../../$i/"
106        ;;
107      bsps/include)
108        hdr="../"
109        inc="../../$i/"
110        ;;
111      *)
112        hdr=""
113        inc=""
114        ;;
115    esac
116    cd $i
117    for b in `find -type d | sort` ; do
118      for j in `find $b -mindepth 1 -maxdepth 1 -name '*.h' -or -name '*.inc' | sed 's%^\.%%' | sed 's%^/%%' | sort` ; do
119        d=`dirname $j`
120        if test x$d != x$dir ; then
121          dir=$d
122          if test x$d != x. ; then
123            am_dir=`echo $dir | sed 's%[/-]%_%g'`
124            am_dir="_$am_dir"
125            printf "\ninclude%sdir = \$(includedir)/$dir\n" "$am_dir" >> "$tmp"
126          else
127            am_dir=""
128            echo "" >> "$tmp"
129          fi
130          echo "include${am_dir}_HEADERS =" >> "$tmp"
131        fi
132        echo "include${am_dir}_HEADERS += $inc$j" >> "$tmp"
133        if test $j = bsp.h ; then
134          echo "include_HEADERS += include/bspopts.h" >> "$tmp"
135        fi
136      done
137    done
138    cd "$base"
139    diff -q "$tmp" "$i/${hdr}headers.am" || mv "$tmp" "$i/${hdr}headers.am"
140  done
141  rm -f "$tmp"
142  ;;
143
144generate)
145  AUTOCONF=${AUTOCONF-autoconf}
146  if test -z "$AUTOCONF"; then
147    echo "You must have autoconf installed to run $program"
148    exit 1
149  fi
150
151  AUTOHEADER=${AUTOHEADER-autoheader}
152  if test -z "$AUTOHEADER"; then
153    echo "You must have autoconf installed to run $program"
154    exit 1
155  fi
156
157  AUTOMAKE=${AUTOMAKE-automake}
158  if test -z "$AUTOMAKE"; then
159    echo "You must have automake installed to run $program"
160    exit 1
161  fi
162
163  ACLOCAL=${ACLOCAL-aclocal}
164  if test -z "$ACLOCAL"; then
165    echo "You must have automake installed to run $program"
166    exit 1
167  fi
168
169  case $top_srcdir in
170  /* ) aclocal_dir=$top_srcdir
171    ;;
172  *) aclocal_dir=`pwd`/$top_srcdir
173    ;;
174  esac
175
176  confs=`find . \( -name 'configure.in' -o -name 'configure.ac' \) -print`
177  for i in $confs; do
178  dir=`dirname $i`
179  configure=`basename $i`
180  ( test "$quiet" = "true" || echo "$dir"
181    cd $dir
182    pat="s,\$(RTEMS_TOPdir),${aclocal_dir},g"
183    aclocal_args=`grep '^[ ]*ACLOCAL_AMFLAGS' Makefile.am | \
184      sed -e 's%.*ACLOCAL_AMFLAGS.*\=[ ]*%%g' -e $pat `
185    test "$verbose" = "-v" && echo "${ACLOCAL} $aclocal_args"
186    ${ACLOCAL} $aclocal_args
187    test -n "`grep CONFIG_HEADER ${configure}`" && ${AUTOHEADER} \
188      && test "$verbose" = "-v" && echo "${AUTOHEADER}"
189    test -n "`grep RTEMS_BSP_CONFIGURE ${configure}`" && ${AUTOHEADER} \
190      && test "$verbose" = "-v" && echo "${AUTOHEADER}"
191    test -f Makefile.am && ${AUTOMAKE} -a -c $verbose
192    ${AUTOCONF}
193    test -f Makefile.am && test -n "`grep 'stamp-h\.in' Makefile.in`" \
194      && echo timestamp > stamp-h.in
195  )
196  done
197  ;;
198
199autoreconf)
200  AUTORECONF=${AUTORECONF-autoreconf}
201  if test -z "$AUTORECONF"; then
202    echo "You must have autoreconf installed to run $program"
203    exit 1
204  fi
205
206  confs=`find . -name 'configure.ac' -print`
207  for i in $confs; do
208  dir=`dirname $i`
209  configure=`basename $i`
210  ( test "$quiet" = "true" || echo "$dir"
211    cd $dir
212    ${AUTORECONF} -i --no-recursive $verbose
213    test -f Makefile.am && test -n "`grep 'stamp-h\.in' Makefile.in`" \
214      && echo timestamp > stamp-h.in
215  )
216  done
217  ;;
218
219clean)
220  test "$quiet" = "true" || echo "removing automake generated Makefile.in files"
221  files=`find . -name 'Makefile.am' -print | sed -e 's%\.am%\.in%g'`
222  for i in $files; do
223    if test -f $i; then
224      rm -f $i
225      test "$verbose" = "-v" && echo "$i"
226    fi
227  done
228
229  test "$quiet" = "true" || echo "removing configure files"
230  files=`find . -name 'configure' -print`
231  for i in $files; do
232    if test -f $i; then
233      rm -f $i
234      test "$verbose" = "-v" && echo "$i"
235    fi
236  done
237
238  if test $force -gt 0; then
239    needles=""
240    if test $force -gt 1; then
241      # Manually maintained
242      needles="$needles config.sub"
243      needles="$needles config.guess"
244    fi
245    if test $force -gt 0; then
246      # Inherited from automake
247      needles="$needles compile"
248      needles="$needles depcomp"
249      needles="$needles install-sh"
250      needles="$needles missing"
251      needles="$needles mdate-sh"
252    fi
253    for j in $needles; do
254      files=`find . -name "$j" -print`
255      for i in $files; do
256        if test -f $i; then
257          rm -f $i
258          test "$verbose" = "-v" && echo "$i"
259        fi
260      done
261    done
262  fi
263
264  test "$quiet" = "true" || echo "removing aclocal.m4 files"
265  files=`find . -name 'aclocal.m4' -print`
266  test "$verbose" = "-v" && test -n "$files" && echo "$files"
267  for i in $files; do
268    if test -f $i; then
269      rm -f $i
270      test "$verbose" = "-v" && echo "$i"
271    fi
272  done
273
274  find . -name '*~' -print | xargs rm -f
275  find . -name 'bspopts.h.in' -print | xargs rm -f
276  find . -name '*.orig' -print | xargs rm -f
277  find . -name '*.rej' -print | xargs rm -f
278  find . -name 'config.status' -print | xargs rm -f
279  find . -name 'config.log' -print | xargs rm -f
280  find . -name 'config.cache' -print | xargs rm -f
281  find . -name 'Makefile' -print | xargs rm -f
282  find . -name '.deps' -print | xargs rm -rf
283  find . -name '.libs' -print | xargs rm -rf
284  find . -name 'stamp-h.in' | xargs rm -rf
285  find . -name 'autom4te*.cache' | xargs rm -rf
286  ;;
287esac
288
289exit 0
Note: See TracBrowser for help on using the repository browser.