summaryrefslogtreecommitdiffstats
path: root/tools/update/rtems-polish.sh
blob: df0cc8a0e7080368dadd27889f5cf3db0e90e96b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/bin/sh

# $Id$

#
# Search RTEMS source tree for autoconf Makefile.ins and automake
# Makefile.ams and run c/update-tools/acpolish rsp. c/update-tool/ampolish
# on them.
#
# To be run from the toplevel directory of the source-tree
#

progname=`basename $0`
rootdir=`dirname $0`

# Get the absolute path to the perltools
pwd=`pwd`
cd $rootdir
perltools=`pwd`
cd $pwd

ac_do=""
am_do=""
ci_do=""

usage()
{
  echo
  echo "usage: ./${perltools}/${progname} [-h][-ac|-am|-ci]";
  echo
  echo "options:"
  echo "	-h .. display this message and exit";
  echo "	-ac .. run acpolish on all autoconf Makefile.ins"
  echo "	-am .. run ampolish on all automake Makefile.ams"
  echo "	-ci .. run cipolish on all configure.in scripts"
  echo
  exit 1;
}

# Check for auxiliary files
aux_files="../../VERSION ampolish acpolish cipolish"
for i in ${aux_files}; do
  if test ! -f ${perltools}/$i; then
    echo "${progname}:"
    echo "        Missing $perltools/$i"
    exit 1;
  fi
done

while test $# -gt 0; do
case $1 in
-h|--he|--hel|--help)
  usage ;;
-ac)
  ac_do="yes";
  shift ;;
-am)
  am_do="yes";
  shift ;;
-ci)
  ci_do="yes";
  shift ;;
-*) echo "unknown option $1" ;
  usage ;;
*) echo "invalid parameter $1" ;
  usage ;;
esac
done

if test -z "$ac_do" && test -z "$am_do" && test -z "$ci_do"; then
  usage
fi

pwd=`pwd`;

if test -n "$ac_do"; then
ac_files=`find . -name 'Makefile.in' -print`;
for f in $ac_files; do
  i=`dirname $f`
  dest="$i"
  if test ! -f $dest/Makefile.am; then
    echo "polishing : $dest/Makefile.in"
    ( cd $dest; 
      mv Makefile.in Makefile.in~;
      ${perltools}/acpolish <Makefile.in~ >Makefile.in
      rm Makefile.in~
    )
  fi
done
fi

if test -n "$am_do"; then
am_files=`find . -name 'Makefile.am' -print`;
for f in $am_files; do
  i=`dirname $f`
  dest="$i"
    echo "polishing : $dest/Makefile.am"
    ( cd $dest; 
      mv Makefile.am Makefile.am~;
      ${perltools}/ampolish <Makefile.am~ >Makefile.am
      rm Makefile.am~
    )
done
fi

if test -n "$ci_do"; then
ci_files=`find . -name 'configure.in' -print`;
for f in $ci_files; do
  i=`dirname $f`
  dest="$i"
    echo "polishing : $dest/configure.in"
    ( cd $dest; 
      mv configure.in configure.in~;
      ${perltools}/cipolish <configure.in~ >configure.in
      rm configure.in~
    )
done
fi