source: rtems/c/update-tools/ampolish @ 9b8baa1

4.104.114.84.95
Last change on this file since 9b8baa1 was 9b8baa1, checked in by Joel Sherrill <joel.sherrill@…>, on 03/23/99 at 18:02:17

Automake II patch from Ralf Corsepius <corsepiu@…>. Email
description follows:

Description:

  • automake for *all* tool subdirectories (Makefile.am, configure.in etc.)
  • autogen now also considers CONFIG_HEADER (generates stamp-h.ins and config.h.ins)
  • c/src/tests/tools/generic/difftest and c/src/tests/tools/generic/sorttimes generated by configure scripts
  • c/update-tools/ampolish, beautifier for Makefile.ams, similar to acpolish
  • rtems-polish.sh added to c/update-tools/ + ampolish support
  • New subdirectory ./automake, contains automake -Makefile fragments to support RTEMS make "debug, debug_install, profile, profile_install" for native Makefile.ams (== ignore these make targets).
  • aclocal/rtems-top.m4's RTEMS_TOP now reads the automake makefile variable VERSION from RTEMS ./VERSION file.
  • ./configure.in uses the macros from aclocal + support for the tools' configure scripts

Remarks:

  • To run rtems-polish.sh, "cd <rtems-source-tree>; ./c/update-tools/rtems-polish.sh"
  • AFAIS, now all native subdirectories are converted to automake (Please drop me a note, if I forgot something).
  • Unless you notice something fatal, IMO the time has come for a public try (== snapshot). I do not intend to send more automake related patches within, say 2 weeks, to give these patches time to settle and to give me some time to think on how to continue.
  • The patch assumes installation to the new main installation directory [$(prefix)].
  • Property mode set to 100644
File size: 1.9 KB
Line 
1#!/usr/bin/perl
2
3#
4# Perl script to beautify and enhance RTEMS automake Makefile.ams
5#
6# Reads from stdin and writes to stdout
7#
8# usage:
9# <path-to>/ampolish <Makefile.am >Makefile.am~
10# mv Makefile.am~ Makefile.am
11#
12# ATTENTION: This file contains embedded tabs
13
14my $subdirs_seen = "" ;
15
16# find a relative up-path to a file $file, starting at directory $pre
17sub find_file
18{
19  my $pre = $_[0] ;
20  my $file= $_[1] ;
21
22  my $top = "." ;
23  if (not "$pre") { $pre = "." ; }
24
25  for ( $str = "$pre" . "/" . "$top" ;
26    ( -d "$str" ) ;
27    $str = "$pre" . "/" . "$top" )
28  {
29    if ( -f "${str}/${file}" ) 
30    {
31      return $top ;
32    }
33    if ( "$top" eq "." )
34    {
35      $top = ".." ;
36    }
37    else
38    {
39      $top .= "/.." ;
40    }
41  } ;
42  die "Can't find file ${file}\n" ;
43}
44
45# find relative up-path to configure.in
46my $rtems_cfg = find_file(".","configure.in");
47
48# find relative up-path from configure.in to VERSION
49my $rtems_top = find_file("$rtems_cfg","VERSION");
50
51my $nl_seen = 0 ;
52
53while( <> )
54{ # consume header
55  last if ( /^[^#].*$/ ) ;
56  print "$_" ;
57}
58
59print "\nAUTOMAKE_OPTIONS = foreign\n";
60if ( "$rtems_cfg" eq "." )
61{
62  print "ACLOCAL = \@ACLOCAL\@ -I \$(RTEMS_TOPdir)/aclocal\n"
63}
64
65while( <> )
66{
67  if ( /^[      ]*$/o )
68  {
69    $nl_seen = $nl_seen+1;
70  }
71
72  if ( /^[      ]*AUTOMAKE_OPTIONS.*$/o )
73  { # remove the line
74  }
75  elsif ( /^[   ]*ACLOCAL[      ]*=[    ]*\@ACLOCAL\@.*$/o )
76  { # remove the line
77  }
78  elsif ( /^[   ]*include[      ]*\$\(top_srcdir\)[\.\/]*automake\/(.*)\.am$/o )
79  {
80    # remove the line
81  }
82  elsif ( /^[   ]*SUBDIRS.*$/o )
83  {
84    $subdirs_seen = "yes" ;
85    print "$_" ;
86    $nl_seen = 0 ;
87  }
88  elsif ( /^[   ]*$/o )
89  {
90    print "$_" if $nl_seen < 2 ;
91  }
92  else
93  {
94    print "$_" ;
95    $nl_seen = 0;
96  }
97} # while
98
99if ( "$subdirs_seen" )
100{
101  print "include \$(top_srcdir)/${rtems_top}/automake/subdirs.am\n" ;
102}
103print "include \$(top_srcdir)/${rtems_top}/automake/local.am\n" ;
104
105;1
Note: See TracBrowser for help on using the repository browser.