[e619c28] | 1 | #!/bin/sh |
---|
[9b8baa1] | 2 | # |
---|
[e619c28] | 3 | # helps bootstrapping, when checked out from CVS |
---|
| 4 | # requires GNU autoconf and GNU automake |
---|
[9b8baa1] | 5 | # |
---|
| 6 | # $Id$ |
---|
[e619c28] | 7 | |
---|
| 8 | # this is not meant to be exported outside the source tree |
---|
| 9 | |
---|
| 10 | # NOTE: Inspired by libtool's autogen script |
---|
| 11 | |
---|
| 12 | # to be run from the toplevel directory of RTEMS' |
---|
| 13 | # source tree |
---|
| 14 | |
---|
| 15 | progname=`basename $0` |
---|
[df49c60] | 16 | top_srcdir=`dirname $0` |
---|
| 17 | |
---|
[8cdb582] | 18 | verbose=""; |
---|
[e619c28] | 19 | quiet="false" |
---|
[8cdb582] | 20 | mode="generate" |
---|
[e619c28] | 21 | |
---|
| 22 | usage() |
---|
| 23 | { |
---|
[7e03d10] | 24 | echo |
---|
| 25 | echo "usage: ${progname} [-h|-q|-v]" |
---|
| 26 | echo |
---|
| 27 | echo "options:" |
---|
| 28 | echo " -h .. display this message and exit"; |
---|
| 29 | echo " -q .. quiet, don't display directories"; |
---|
| 30 | echo " -v .. verbose, pass -v to automake when invoking automake" |
---|
[8cdb582] | 31 | echo " -c .. clean, remove all aclocal/autoconf/automake generated files" |
---|
[7e03d10] | 32 | echo |
---|
[e619c28] | 33 | exit 1; |
---|
| 34 | } |
---|
| 35 | |
---|
[df49c60] | 36 | if test ! -f $top_srcdir/VERSION; then |
---|
[7e03d10] | 37 | echo "${progname}:" |
---|
[df49c60] | 38 | echo " Installation problem: Can't find file VERSION" |
---|
[7e03d10] | 39 | exit 1; |
---|
| 40 | fi |
---|
| 41 | |
---|
[e619c28] | 42 | while test $# -gt 0; do |
---|
| 43 | case $1 in |
---|
[7e03d10] | 44 | -h|--he|--hel|--help) |
---|
| 45 | usage ;; |
---|
[e619c28] | 46 | -q|--qu|--qui|--quie|--quiet) |
---|
| 47 | quiet="true"; |
---|
| 48 | shift;; |
---|
| 49 | -v|--ve|--ver|--verb|--verbo|--verbos|--verbose) |
---|
| 50 | verbose="-v"; |
---|
| 51 | shift;; |
---|
[8cdb582] | 52 | -c|--cl|--cle|--clea|--clean) |
---|
| 53 | mode="clean"; |
---|
| 54 | shift;; |
---|
[e619c28] | 55 | -*) echo "unknown option $1" ; |
---|
| 56 | usage ;; |
---|
| 57 | *) echo "invalid parameter $1" ; |
---|
| 58 | usage ;; |
---|
| 59 | esac |
---|
| 60 | done |
---|
| 61 | |
---|
[8cdb582] | 62 | case $mode in |
---|
| 63 | generate) |
---|
[df49c60] | 64 | |
---|
| 65 | case $top_srcdir in |
---|
[ec6968b] | 66 | /* ) aclocal_dir=$top_srcdir |
---|
[df49c60] | 67 | ;; |
---|
[ec6968b] | 68 | *) aclocal_dir=`pwd`/$top_srcdir |
---|
[df49c60] | 69 | ;; |
---|
| 70 | esac |
---|
| 71 | |
---|
| 72 | confs=`find . -name 'configure.in' -print` |
---|
[8cdb582] | 73 | for i in $confs; do |
---|
| 74 | dir=`dirname $i`; |
---|
| 75 | ( test "$quiet" = "true" || echo "$dir"; |
---|
| 76 | cd $dir; |
---|
[ec6968b] | 77 | pat="s,\$(RTEMS_TOPdir),${aclocal_dir},g" |
---|
| 78 | aclocal_args=`grep '^[ ]*ACLOCAL_AMFLAGS' Makefile.am | \ |
---|
| 79 | sed -e 's%.*ACLOCAL_AMFLAGS.*\=[ ]*%%g' -e $pat ` ; |
---|
| 80 | test "$verbose" = "-v" && echo "aclocal $aclocal_args" |
---|
| 81 | aclocal $aclocal_args; |
---|
[8cdb582] | 82 | autoconf; |
---|
[76ee648c] | 83 | test -n "`grep CONFIG_HEADER configure.in`" && autoheader ; |
---|
[df49c60] | 84 | test -f Makefile.am && automake $verbose ; |
---|
[76ee648c] | 85 | test -f Makefile.am && test -n "`grep 'stamp-h\.in' Makefile.in`" \ |
---|
| 86 | && echo timestamp > stamp-h.in |
---|
[8cdb582] | 87 | ) |
---|
| 88 | done |
---|
| 89 | ;; |
---|
[df49c60] | 90 | |
---|
[8cdb582] | 91 | clean) |
---|
| 92 | test "$quiet" = "true" || echo "removing automake generated Makefile.in files" |
---|
| 93 | files=`find . -name 'Makefile.am' -print | sed -e 's%\.am%\.in%g'` ; |
---|
| 94 | for i in $files; do if test -f $i; then |
---|
| 95 | rm -f $i |
---|
| 96 | test "$verbose" = "-v" && echo "$i" |
---|
| 97 | fi; done |
---|
| 98 | |
---|
| 99 | test "$quiet" = "true" || echo "removing configure files" |
---|
| 100 | files=`find . -name 'configure' -print` ; |
---|
| 101 | test "$verbose" = "-v" && test -n "$files" && echo "$files" ; |
---|
| 102 | for i in $files; do if test -f $i; then |
---|
| 103 | rm -f $i |
---|
| 104 | test "$verbose" = "-v" && echo "$i" |
---|
| 105 | fi; done |
---|
| 106 | |
---|
| 107 | test "$quiet" = "true" || echo "removing aclocal.m4 files" |
---|
| 108 | files=`find . -name 'aclocal.m4' -print` ; |
---|
| 109 | test "$verbose" = "-v" && test -n "$files" && echo "$files" ; |
---|
| 110 | for i in $files; do if test -f $i; then |
---|
| 111 | rm -f $i |
---|
| 112 | test "$verbose" = "-v" && echo "$i" |
---|
| 113 | fi; done |
---|
| 114 | |
---|
| 115 | find . -name '*~' -print | xargs rm -f |
---|
| 116 | find . -name '*.orig' -print | xargs rm -f |
---|
| 117 | find . -name '*.rej' -print | xargs rm -f |
---|
| 118 | find . -name 'config.status' -print | xargs rm -f |
---|
| 119 | find . -name 'config.log' -print | xargs rm -f |
---|
[76ee648c] | 120 | find . -name 'config.cache' -print | xargs rm -f |
---|
[6693a68] | 121 | find . -name 'Makefile' -print | xargs rm -f |
---|
[8cdb582] | 122 | find . -name '.deps' -print | xargs rm -rf |
---|
[76ee648c] | 123 | find . -name '.libs' -print | xargs rm -rf |
---|
| 124 | find . -name 'stamp-h.in' | xargs rm -rf |
---|
[8cdb582] | 125 | ;; |
---|
| 126 | esac |
---|