Files
rtems/tools/update/cipolish
Joel Sherrill 99eb5852f5 Patches rtems-rc-4.5.0-1.diff from Ralf Corsepius <corsepiu@faw.uni-ulm.de>
that fixes numerous miscellaneous issues most related to the debug and
profile build stanzas:

  Fix for the "make debug" (1) issue and an analogous issue with "make
  profile" (untested).
    * Fixes to mcp750.cfg (make debug, directories) (2)
    * Updates/minor fixes for shgen (3)
    * Updates some custom/*.cfgs to use $(LINK.c) instead of  $(CC)
    * Leftovers from rtems-rc-4.5.0-[0|1].diff which somehow did not make it
      into cvs.
    * Cleanups to the perlscripts below tools/update/
    * Some unsorted minor fixes.

 Footnotes/Remarks:
    (1) Tested for all m68k, sh, sparc, unix and selected i386, ppc BSPs.

    Known problems: I can't build the debug variant for the m68k/mvme162 and
    m68k/mvme162lx (segmentation fault - signal 11 :)

    (2) Tested by building the BSP, but I doubt the debug-variant is
    functional. The flags used for the debug variant should be checked by
    knowledgeable persons and probably at runtime #:o)

    (3) I have updated shgen to use getopt_long (it should fall back to
    getopt if not available), enhanced the options, cleaned up some minor
    tweaks and added help2man support (rough automatic man-page generation).

  Technical notes:
    * make debug and make profile now work similar in target Makefile.ams as
    they did in old autoconf-Makefile.ins using leaf.cfg. Unlike the rules
    in leaf.cfg these Makefile.am also recurse once on themselves in
    directory Makefiles before or after recursing into subdirectories, not
    only in leaf-directories.
    To implement this behavior, I renamed the former automake/local.am into
    automake/host.am and extended local.am to provide this recursion.
    I.e. host.am implements the non-self-recursive variant, while local.am
    now implements the self-recursive behavior.
    => all Makefile.ams exploiting build-variants are supposed to include
    local.am
    => all Makefile.ams not exploiting build-variants should include host.am

    => Rules of thumb:
        - Only include one of both, either local.am or host.am into a
        Makefile.am.
        -Target-Makefile.ams should include local.am
        -Host-Makefile.ams should include host.am (Probably, you now understand
        the naming)
        - There are exceptions from these rules :)

    * Now, make debug|profile|all are independent of each other. However,
    each of them however triggers preinstall.

    * "make install" still decends into the subdirectories but does not
    trigger "all|profile|debug|preinstall" in target Makefile.am anymore.
    Besides triggering "install"-rules in some selected Makefile.ams, it
    only packs $(PROJECT_ROOT) into a tarballs and unpacks it to $(prefix).
    => "make install" alone is not enough to install RTEMS, now use
    make RTEMS_BSP=<bsps> [all] [debug] [profile]
    make RTEMS_BSP=<bsp> install

    I consider this to be a step back wrt. exploiting automake mechanisms,
    and expect this to be reverted if we abandon building target variants in
    favour of the standard convention of optionally overriding flags from
    the command line (i.e. instead of "make debug", GNU standards favor
    "make CFLAGS=<options> --prefix=<location>")
2000-02-25 15:03:10 +00:00

240 lines
4.7 KiB
Perl
Executable File

#!/usr/bin/perl
#
# Perl script to beautify and enhance RTEMS configure.in
#
# Reads from stdin and writes to stdout
#
# usage:
# acpolish <configure.in >configure.in~
# mv configure.in~ configure.in
#
# $Id$
use strict ;
my @vars = () ;
my @buffer = () ;
# find relative up-path to VERSION
my $rtems_cfg = &find_file(".","VERSION");
my $rtems_root = &find_root() ;
$rtems_root =~ tr/\//\-/ ;
my $rtems_name = "rtems" ;
$rtems_name .= "-" . "$rtems_root" if (length($rtems_root) > 0 ) ;
while ( <> )
{
push @buffer, "$_" ;
}
{
my @tbuf = () ;
foreach ( @buffer )
{
if ( /^#.*list.*Makefile.*$/o ) {}
elsif ( /^dnl[\s]+check.*target.*cc.*$/o ) {}
elsif ( /^[\s]*AC_CONFIG_AUX_DIR\(.*\)[\s]*$/o )
{
push @tbuf, "AC_CONFIG_AUX_DIR($rtems_cfg)\n" ;
}
elsif ( /^[\s]*RTEMS_TOP\(.*\)[\s]*$/o )
{
push @tbuf, "RTEMS_TOP($rtems_cfg)\n" ;
}
elsif ( /^[\s]*AM_INIT_AUTOMAKE\(.*\)[\s]*$/o )
{
push @tbuf, "AM_INIT_AUTOMAKE($rtems_name,\$RTEMS_VERSION,no)\n" ;
}
elsif ( /^[\s]*AC_SUBST\(RTEMS_HAS_POSIX_API\)[\s]*$/o )
{
#remove the line
}
elsif ( /^[\s]*AC_SUBST\(RTEMS_HAS_ITRON_API\)[\s]*$/o )
{
#remove the line
}
elsif ( /^[\s]*AC_SUBST\(RTEMS_HAS_HWAPI\)[\s]*$/o )
{
#remove the line
}
elsif ( /^[\s]*AC_SUBST\(RTEMS_USE_MACROS\)[\s]*$/o )
{
#remove the line
}
elsif ( /^[\s]*AC_SUBST\(RTEMS_HAS_MULTIPROCESSING\)[\s]*$/o )
{
#remove the line
}
elsif ( /^[\s]*AC_SUBST\(RTEMS_HAS_RDBG\)[\s]*$/o )
{
#remove the line
}
elsif ( /^[\s\t]*AC_SUBST\(RTEMS_USE_OWN_PDIR\)[\s]*$/o )
{ # obsolete option
#remove the line
}
elsif ( /^[\s\t]*RTEMS_ENABLE_GMAKE_PRINT[ ]*$/o )
{ # obsolete macro
#remove the line
}
elsif ( /^[\s]*AC_SUBST\(RTEMS_HAS_NETWORKING\)[\s]*$/o )
{
#remove the line
}
elsif ( /^[\s]*AC_SUBST\(RTEMS_LIBC_DIR\)[\s]*$/o )
{
#remove the line
}
elsif ( /^[\s]*AC_SUBST\(PROJECT_ROOT\)[\s]*$/o )
{
#remove the line
}
elsif ( /^[\s]*AC_SUBST\(RTEMS_GAS_CODE16\)[\s]*$/o )
{
#remove the line
}
elsif ( /^[\s]*PROJECT_ROOT[\s]*=.*$/o )
{
#remove the line
}
elsif ( /^[\s]*(RTEMS_ENABLE_LIBCDIR).*$/o )
{ #remove the line
&define_variable("$1","");
push @tbuf, "$_" ;
}
elsif ( /^[\s]*(RTEMS_PROG_CC_FOR_TARGET).*$/o )
{
&define_variable("$1","");
push @tbuf, "$_" ;
}
elsif ( /^[\s]*(RTEMS_PROG_CXX_FOR_TARGET).*$/o )
{
&define_variable("$1","");
push @tbuf, "$_" ;
}
else
{
push @tbuf, "$_" ;
}
} # foreach
@buffer = @tbuf ;
}
{
my @tbuf = () ;
foreach ( @buffer )
{
if ( /^[\s]*(RTEMS_ENABLE_LIBCDIR).*$/o )
{
if ( ( not defined $main::var_RTEMS_PROG_CC_FOR_TARGET )
and ( not defined $main::var_RTEMS_PROG_CXX_FOR_TARGET )
)
{
push @tbuf, "$_" ;
}
}
elsif ( /^AC_OUTPUT.*$/o )
{
push @tbuf, "# Explicitly list all Makefiles here\n" ;
push @tbuf, "$_" ;
}
else
{
push @tbuf, "$_" ;
}
}
@buffer = @tbuf ;
}
{ ## pretty print
my $out = join ('',@buffer) ;
$out =~ s/\s\#\n(\#\n)+/\n/g ;
$out =~ s/\n\n\#\n\n/\n/g ;
$out =~ s/\n\n[\n]*/\n\n/g ;
print $out ;
}
exit 1 ;
# find a relative up-path to a file $file, starting at directory $pre
sub find_file($$)
{
my $pre = $_[0] ;
my $file= $_[1] ;
my $top = "." ;
if (not "$pre") { $pre = "." ; }
for ( my $str = "$pre" . "/" . "$top" ;
( -d "$str" ) ;
$str = "$pre" . "/" . "$top" )
{
if ( -f "${str}/${file}" )
{
return $top ;
}
if ( "$top" eq "." )
{
$top = ".." ;
}
else
{
$top .= "/.." ;
}
} ;
die "Can't find file ${file}\n" ;
}
sub find_root()
{
my $top_builddir = "." ;
my $subdir="";
my $pwd = `pwd`; chomp $pwd;
$pwd .= "/" ;
my $len ;
if ( -f "VERSION" ) { return $subdir ; }
my $i = rindex($pwd,'/');
$len = $i;
$pwd = substr($pwd,0,$len);
$i = rindex($pwd,'/');
$subdir = substr($pwd,$i+1,$len - 1);
$top_builddir = ".." ;
while( -d "$top_builddir" )
{
if ( -f "${top_builddir}/VERSION" )
{
return $subdir ;
}
$len=$i;
$pwd = substr($pwd,0,$len);
$i = rindex($pwd,'/');
$subdir = substr($pwd,$i+1,$len - 1) . "/$subdir";
$top_builddir .= "/.." ;
} ;
die "Can't find VERSION\n" ;
}
sub define_variable
{
my ($name,$value) = @_ ;
if ( not defined ${"var_$name"} )
{
# print STDERR "DEFINING $name = $value\n" ;
push @vars, "$name" ;
${"var_$name"} = "$value" ;
}
else
{
# print STDERR "APPENDING <$name> <- <$value>\n" ;
${"var_$name"} .= " $value" ;
}
}