source: rtems/bootstrap @ 629faf9

5
Last change on this file since 629faf9 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
RevLine 
[22fb90e4]1#!/bin/sh
[9b8baa1]2#
[e619c28]3# helps bootstrapping, when checked out from CVS
4# requires GNU autoconf and GNU automake
[9b8baa1]5#
[e619c28]6# this is not meant to be exported outside the source tree
[65c6425]7#
[e619c28]8# NOTE: Inspired by libtool's autogen script
[65c6425]9#
[e619c28]10# to be run from the toplevel directory of RTEMS'
11# source tree
12
13progname=`basename $0`
[df49c60]14top_srcdir=`dirname $0`
15
[2afb22b]16LC_ALL=C
17export LC_ALL
18
[22fb90e4]19verbose=""
[e619c28]20quiet="false"
[fba17c9e]21mode="autoreconf"
[aa96f47]22force=0
[e619c28]23
24usage()
25{
[7e03d10]26  echo
[7b1a711]27  echo "usage: ${progname} [-c|-h|-H] [-q][-v]"
[7e03d10]28  echo
29  echo "options:"
[8cdb582]30  echo "        -c .. clean, remove all aclocal/autoconf/automake generated files"
[77fff592]31  echo "        -h .. display this message and exit"
[2afb22b]32  echo "        -H .. regenerate headers.am files"
[77fff592]33  echo "        -q .. quiet, don't display directories"
34  echo "        -v .. verbose, pass -v to autotools"
[7e03d10]35  echo
[22fb90e4]36  exit 1
[e619c28]37}
38
[76d527ec]39if test ! -f $top_srcdir/aclocal/version.m4; then
[7e03d10]40  echo "${progname}:"
[76d527ec]41  echo "        Installation problem: Can't find file aclocal/version.m4"
[22fb90e4]42  exit 1
[7e03d10]43fi
44
[e619c28]45while test $# -gt 0; do
46case $1 in
[7e03d10]47-h|--he|--hel|--help)
48  usage ;;
[e619c28]49-q|--qu|--qui|--quie|--quiet)
[22fb90e4]50  quiet="true"
[e619c28]51  shift;;
52-v|--ve|--ver|--verb|--verbo|--verbos|--verbose)
[22fb90e4]53  verbose="-v"
[e619c28]54  shift;;
[8cdb582]55-c|--cl|--cle|--clea|--clean)
[22fb90e4]56  mode="clean"
[8cdb582]57  shift;;
[aa96f47]58-f|--fo|--for|--forc|--force)
59  force=`expr $force + 1`
60  shift;;
[2afb22b]61-H|--headers)
62  mode="headers"
[77fff592]63  shift;;
[3031e6c]64-r|--re|--rec|--reco|--recon|--reconf)
[22fb90e4]65  mode="autoreconf"
[3031e6c]66  shift;;
[fba17c9e]67-g|--ge|--gen|--gene|--gener|--genera|--generat|--generate)
[22fb90e4]68  mode="generate"
[fba17c9e]69  shift;;
[22fb90e4]70-*) echo "unknown option $1"
[e619c28]71  usage ;;
[22fb90e4]72*) echo "invalid parameter $1"
[e619c28]73  usage ;;
74esac
75done
76
[8cdb582]77case $mode in
[2afb22b]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"
[4dfeba3]125            printf "\ninclude%sdir = \$(includedir)/$dir\n" "$am_dir" >> "$tmp"
[2afb22b]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
[4dfeba3]134          echo "include_HEADERS += include/bspopts.h" >> "$tmp"
[2afb22b]135        fi
136      done
137    done
138    cd "$base"
139    diff -q "$tmp" "$i/${hdr}headers.am" || mv "$tmp" "$i/${hdr}headers.am"
[77fff592]140  done
[2afb22b]141  rm -f "$tmp"
[77fff592]142  ;;
143
[8cdb582]144generate)
[d854517]145  AUTOCONF=${AUTOCONF-autoconf}
[58fd5ab]146  if test -z "$AUTOCONF"; then
147    echo "You must have autoconf installed to run $program"
[0b22af6]148    exit 1
[58fd5ab]149  fi
[22fb90e4]150
[0b22af6]151  AUTOHEADER=${AUTOHEADER-autoheader}
152  if test -z "$AUTOHEADER"; then
153    echo "You must have autoconf installed to run $program"
154    exit 1
[58fd5ab]155  fi
[22fb90e4]156
[d854517]157  AUTOMAKE=${AUTOMAKE-automake}
[58fd5ab]158  if test -z "$AUTOMAKE"; then
159    echo "You must have automake installed to run $program"
[0b22af6]160    exit 1
[58fd5ab]161  fi
[22fb90e4]162
[0b22af6]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
[df49c60]169  case $top_srcdir in
[ec6968b]170  /* ) aclocal_dir=$top_srcdir
[df49c60]171    ;;
[ec6968b]172  *) aclocal_dir=`pwd`/$top_srcdir
[df49c60]173    ;;
174  esac
175
[e712997]176  confs=`find . \( -name 'configure.in' -o -name 'configure.ac' \) -print`
[8cdb582]177  for i in $confs; do
[22fb90e4]178  dir=`dirname $i`
179  configure=`basename $i`
180  ( test "$quiet" = "true" || echo "$dir"
181    cd $dir
[ec6968b]182    pat="s,\$(RTEMS_TOPdir),${aclocal_dir},g"
183    aclocal_args=`grep '^[ ]*ACLOCAL_AMFLAGS' Makefile.am | \
[22fb90e4]184      sed -e 's%.*ACLOCAL_AMFLAGS.*\=[ ]*%%g' -e $pat `
[0b22af6]185    test "$verbose" = "-v" && echo "${ACLOCAL} $aclocal_args"
[22fb90e4]186    ${ACLOCAL} $aclocal_args
[0b22af6]187    test -n "`grep CONFIG_HEADER ${configure}`" && ${AUTOHEADER} \
[22fb90e4]188      && test "$verbose" = "-v" && echo "${AUTOHEADER}"
[0b22af6]189    test -n "`grep RTEMS_BSP_CONFIGURE ${configure}`" && ${AUTOHEADER} \
[22fb90e4]190      && test "$verbose" = "-v" && echo "${AUTOHEADER}"
191    test -f Makefile.am && ${AUTOMAKE} -a -c $verbose
192    ${AUTOCONF}
[76ee648c]193    test -f Makefile.am && test -n "`grep 'stamp-h\.in' Makefile.in`" \
194      && echo timestamp > stamp-h.in
[8cdb582]195  )
196  done
197  ;;
[df49c60]198
[3031e6c]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
[22fb90e4]208  dir=`dirname $i`
209  configure=`basename $i`
210  ( test "$quiet" = "true" || echo "$dir"
211    cd $dir
212    ${AUTORECONF} -i --no-recursive $verbose
[3031e6c]213    test -f Makefile.am && test -n "`grep 'stamp-h\.in' Makefile.in`" \
214      && echo timestamp > stamp-h.in
215  )
216  done
217  ;;
218
[8cdb582]219clean)
220  test "$quiet" = "true" || echo "removing automake generated Makefile.in files"
[22fb90e4]221  files=`find . -name 'Makefile.am' -print | sed -e 's%\.am%\.in%g'`
222  for i in $files; do
[aa96f47]223    if test -f $i; then
224      rm -f $i
[22fb90e4]225      test "$verbose" = "-v" && echo "$i"
226    fi
[aa96f47]227  done
[8cdb582]228
229  test "$quiet" = "true" || echo "removing configure files"
[22fb90e4]230  files=`find . -name 'configure' -print`
231  for i in $files; do
[aa96f47]232    if test -f $i; then
233      rm -f $i
234      test "$verbose" = "-v" && echo "$i"
[22fb90e4]235    fi
[aa96f47]236  done
[22fb90e4]237
[aa96f47]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`
[22fb90e4]255      for i in $files; do
[aa96f47]256        if test -f $i; then
257          rm -f $i
258          test "$verbose" = "-v" && echo "$i"
[22fb90e4]259        fi
[aa96f47]260      done
261    done
262  fi
263
[8cdb582]264  test "$quiet" = "true" || echo "removing aclocal.m4 files"
[22fb90e4]265  files=`find . -name 'aclocal.m4' -print`
266  test "$verbose" = "-v" && test -n "$files" && echo "$files"
267  for i in $files; do
[aa96f47]268    if test -f $i; then
269      rm -f $i
[22fb90e4]270      test "$verbose" = "-v" && echo "$i"
271    fi
[aa96f47]272  done
[8cdb582]273
274  find . -name '*~' -print | xargs rm -f
[a5a0db4]275  find . -name 'bspopts.h.in' -print | xargs rm -f
[8cdb582]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
[76ee648c]280  find . -name 'config.cache' -print | xargs rm -f
[6693a68]281  find . -name 'Makefile' -print | xargs rm -f
[8cdb582]282  find . -name '.deps' -print | xargs rm -rf
[76ee648c]283  find . -name '.libs' -print | xargs rm -rf
284  find . -name 'stamp-h.in' | xargs rm -rf
[282cb9c]285  find . -name 'autom4te*.cache' | xargs rm -rf
[8cdb582]286  ;;
287esac
[cf0ed46]288
289exit 0
Note: See TracBrowser for help on using the repository browser.