Changeset df49c60 in rtems for tools


Ignore:
Timestamp:
Jun 12, 2000, 3:00:15 PM (20 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
edeed26
Parents:
0ab65474
Message:

Merged from 4.5.0-beta3a

Location:
tools
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • tools/Makefile.am

    r0ab65474 rdf49c60  
    66
    77include $(top_srcdir)/automake/subdirs.am
    8 include $(top_srcdir)/automake/local.am
     8include $(top_srcdir)/automake/host.am
  • tools/build/Makefile.am

    r0ab65474 rdf49c60  
    66ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal
    77
    8 bin_PROGRAMS = cklength eolstrip packhex unhex 
     8bin_PROGRAMS = cklength eolstrip packhex unhex
    99
    1010noinst_PROGRAMS = binpatch
     
    1212cklength_SOURCES = cklength.c
    1313eolstrip_SOURCES = eolstrip.c
    14 packhex_SOURCES  = packhex.c
    15 unhex_SOURCES    = unhex.c
     14packhex_SOURCES = packhex.c
     15unhex_SOURCES = unhex.c
    1616binpatch_SOURCES = binpatch.c
    1717
    18 bin_SCRIPTS=\
    19 install-if-change \
    20 lock-directory \
    21 unlock-directory
     18bin_SCRIPTS = install-if-change lock-directory unlock-directory
    2219
    2320noinst_SCRIPTS = search-id.sh
    2421
    25 include $(top_srcdir)/../../automake/local.am
     22include $(top_srcdir)/../../automake/host.am
  • tools/cpu/Makefile.am

    r0ab65474 rdf49c60  
    1111
    1212include $(top_srcdir)/../../automake/subdirs.am
    13 include $(top_srcdir)/../../automake/local.am
     13include $(top_srcdir)/../../automake/host.am
  • tools/cpu/generic/Makefile.am

    r0ab65474 rdf49c60  
    66ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal
    77
    8 noinst_SCRIPTS=size_rtems
    9 include $(top_srcdir)/../../../automake/local.am
     8noinst_SCRIPTS = size_rtems
     9include $(top_srcdir)/../../../automake/host.am
  • tools/cpu/generic/size_rtems.in

    r0ab65474 rdf49c60  
    4747      exit 0
    4848      ;;
    49   i[3456]86-pc-linux-gnu)
     49  i[34567]86-pc-linux-gnu)
    5050      echo linux
    5151      rtems_cpu=unix
     
    5454      exit 0
    5555      ;;
    56   i[3456]86-unknown-freebsd2.[12]*)
     56  i[34567]86-unknown-freebsd2.[12]*)
    5757      echo freebsd
    5858      rtems_cpu=unix
  • tools/cpu/hppa1.1/Makefile.am

    r0ab65474 rdf49c60  
    66ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal
    77
    8 noinst_PROGRAMS=genoffsets
     8noinst_PROGRAMS = genoffsets
    99
    10 genoffsets_SOURCES = \
    11 genoffsets.c
     10genoffsets_SOURCES = genoffsets.c
    1211
    1312## We use files that have not been installed yet.
    1413
    15 CPU_DIR=../../cpu/$(RTEMS_CPU)
     14CPU_DIR = ../../cpu/$(RTEMS_CPU)
    1615
    17 INCLUDES = \
    18 -I$(PROJECT_INCLUDE) \
    19 -I$(CPU_DIR)
     16AM_CPPFLAGS = -I$(PROJECT_INCLUDE) -I$(CPU_DIR)
    2017
    21 include $(top_srcdir)/../../../automake/local.am
     18include $(top_srcdir)/../../../automake/host.am
  • tools/cpu/sh/Makefile.am

    r0ab65474 rdf49c60  
    33##
    44
    5 AUTOMAKE_OPTIONS = foreign 1.4
     5AUTOMAKE_OPTIONS = foreign 1.4 no-installman
    66ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal
    77
    8 noinst_PROGRAMS=shgen
     8noinst_PROGRAMS = shgen
    99
    10 shgen_SOURCES = \
    11 sci.h \
    12 sci.c \
    13 shgen.c
     10shgen_SOURCES = sci.h sci.c shgen.c
    1411
    15 include $(top_srcdir)/../../../automake/local.am
     12if HELP2MAN
     13man_MANS = shgen.1
     14
     15shgen.1: $(srcdir)/shgen.c
     16        $(HELP2MAN) -N shgen >$@
     17endif
     18
     19include $(top_srcdir)/../../../automake/host.am
  • tools/cpu/sh/configure.in

    r0ab65474 rdf49c60  
    99RTEMS_CANONICAL_TARGET_CPU
    1010
    11 AM_INIT_AUTOMAKE(rtems-tools-cpu-sh,$RTEMS_VERSION,no)
     11AM_INIT_AUTOMAKE(rtems-tools-cpu-sh,0.4)
    1212AM_MAINTAINER_MODE
    1313AC_EXEEXT
     
    1515AC_PROG_CC
    1616AC_CHECK_LIB(m,fabs)
     17AC_CHECK_FUNCS(getopt_long)
     18AC_CHECK_PROGS(HELP2MAN,help2man)
     19AM_CONDITIONAL(HELP2MAN,test -n "$HELP2MAN" )
    1720
    1821RTEMS_TOOLPATHS
  • tools/cpu/sh/shgen.c

    r0ab65474 rdf49c60  
    11/*
    2  * Copyright (c) 1998-1999 Ralf Corsepius (corsepiu@faw.uni-ulm.de)
     2 * Copyright (c) 1998,1999,2000 Ralf Corsepius (corsepiu@faw.uni-ulm.de)
    33 *
    44 * See the file COPYING for copyright notice.
     
    1212#include "sci.h"
    1313
    14 static void usage( char *prog )
     14static void usage( FILE* ofile, char *prog )
    1515{
    16   fprintf( stderr, "usage: %s [options] driver\n", prog );
    17   fprintf( stderr, "options:\n" );
    18   fprintf( stderr, "\t-M Phi      .. processor frequency [MHz]\n" );
    19   fprintf( stderr, "\t-K Phi      .. processor frequency [KHz]\n" );
    20   fprintf( stderr, "\t-H Phi      .. processor frequency [Hz]\n" );
    21   fprintf( stderr, "\t\t..default 20MHz" );
    22   fprintf( stderr, "driver:\n" );
    23   fprintf( stderr, "\tsci .. bitrate table for sci\n" );
    24   exit ( 1 );
     16  fprintf( ofile, "Usage: %s [options] driver\n", prog );
     17  fprintf( ofile, "\nOptions:\n" );
     18  fprintf( ofile, "Processor frequency (default 20MHz):\n") ;
     19  fprintf( ofile, "\t-M Phi      .. processor frequency [MHz]\n" );
     20  fprintf( ofile, "\t-K Phi      .. processor frequency [KHz]\n" );
     21  fprintf( ofile, "\t-H Phi      .. processor frequency [Hz]\n" );
     22  fprintf( ofile, "Driver:\n" );
     23  fprintf( ofile, "\tsci         .. bitrate table for sci\n" );
     24
     25  fprintf( ofile, "\nWritten by Ralf Corsepius <corsepiu@faw.uni-ulm.de>\n" );
     26  fprintf( ofile, "\nCopyright (c) 1998,1999,2000\tRalf Corsepius\n" );
    2527}
     28
     29#if HAVE_GETOPT_LONG
     30#define NOARG   0
     31#define HASARG  1
     32#define OPTARG  2
     33
     34static struct option long_options[] =
     35{
     36  { "version",          NOARG,  NULL, 'v' },
     37  { "help",             NOARG,  NULL, 'h' },
     38  { "mega-hertz",       HASARG, NULL, 'M' },
     39  { "kilo-hertz",       HASARG, NULL, 'K' },
     40  { "hertz",            HASARG, NULL, 'H' },
     41  { 0, 0, 0, 0 }
     42};
     43#endif
    2644
    2745static void shgen_header( FILE *file )
    2846{
    2947  fprintf( file,
    30     "/*\n * DO NOT EDIT - this file is automatically generated by shgen 0.3\n" );
     48    "/*\n * DO NOT EDIT - this file is automatically generated by shgen %s\n",
     49    VERSION );
    3150  fprintf( file,
    32     " * Copyright (c) 1998-1999, Ralf Corsepius (corsepiu@faw.uni-ulm.de)\n */\n" );
     51    " * Copyright (c) 1998,1999,2000 Ralf Corsepius (corsepiu@faw.uni-ulm.de)\n */\n" );
    3352  fprintf( file,
    3453    "\n/* This file is not copyrighted */\n\n" );
     
    3857{
    3958  double        Phi = 20.0 ;
    40  
    41   while ( ( optopt = getopt( argc, argv, "M:K:H:" ) ) > 0 )
     59
     60#if HAVE_GETOPT_LONG 
     61  int option_index = 0 ;
     62  while( ( optopt = getopt_long( argc, argv, "M:K:H:hv",
     63      long_options, &option_index ) ) > 0 )
     64#else
     65  while ( ( optopt = getopt( argc, argv, "M:K:H:hv" ) ) > 0 )
     66#endif
    4267  {
    4368    switch ( optopt )
     
    5277      break ;
    5378    case 'H' :
    54       sscanf( optarg, "%lf", &Phi ); 
     79      sscanf( optarg, "%lf", &Phi );
    5580      break ;
     81    case 'h' :
     82      usage( stdout, argv[0] );
     83      exit(0);
     84    case 'v' :
     85      fprintf( stdout, "%s version %s\n", argv[0], VERSION );
     86      exit(0);
    5687    default  :
    57       usage( argv[0] );
     88      usage( stderr, argv[0] );
     89      exit(1);
    5890      break ;
    5991    }
     
    6193
    6294  if ( argc - optind != 1 )
    63     usage( argv[0] );
    64 
     95  {
     96    fprintf( stderr, "%s: Missing argument: driver\n", argv[0] );
     97    exit(1);
     98  }
     99 
    65100  shgen_header( stdout );
    66101     
     
    70105  }
    71106  else
    72     usage( argv[0] );
     107  {
     108    fprintf( stderr, "%s: Invalid argument: driver\n", argv[0] );
     109    exit(1);
     110  }
    73111     
    74112  return 0 ;
  • tools/cpu/unix/Makefile.am

    r0ab65474 rdf49c60  
    66ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal
    77
    8 noinst_PROGRAMS=gensize
     8noinst_PROGRAMS = gensize
    99
    10 gensize_SOURCES=gensize.c
     10gensize_SOURCES = gensize.c
    1111
    12 include $(top_srcdir)/../../../automake/local.am
     12include $(top_srcdir)/../../../automake/host.am
  • tools/cpu/unix/gensize.c

    r0ab65474 rdf49c60  
    3737  jmp_buf     regs;
    3838  int         isr_level;
     39  int         pad[4]; /* just in case */
    3940} Context_Control;
    4041
  • tools/update/Makefile.am

    r0ab65474 rdf49c60  
    55AUTOMAKE_OPTIONS = foreign 1.4
    66ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal
     7
    78## NOTE: It doesn't make much sense to install these files
    89
     
    1314# Do not handle them if perl is missing.
    1415
    15 noinst_SCRIPTS = \
    16 acpolish \
    17 ampolish \
    18 cipolish \
    19 rtems-polish.sh \
    20 word-replace \
    21 update
     16noinst_SCRIPTS = acpolish ampolish cipolish rtems-polish.sh word-replace \
     17    update
    2218
    23 noinst_DATA = \
    24 310_to_320_list
     19noinst_DATA = 310_to_320_list
    2520
    2621update: $(srcdir)/update.in $(top_builddir)/config.status
     
    3631endif
    3732
    38 EXTRA_DIST = \
    39 310_to_320_list \
    40 update.in \
    41 word-replace.in \
    42 acpolish \
    43 ampolish \
    44 cipolish \
    45 rtems-polish.sh
     33EXTRA_DIST = 310_to_320_list update.in word-replace.in acpolish ampolish \
     34    cipolish rtems-polish.sh
    4635
    47 include $(top_srcdir)/../../automake/local.am
     36include $(top_srcdir)/../../automake/host.am
  • tools/update/acpolish

    r0ab65474 rdf49c60  
    11#!/usr/bin/perl
    22
    3 # use strict 'subs' ;
    4 # use strict 'vars' ;
    5 # use strict 'refs' ;
    6 
    7 # use strict ;
     3use strict ;
     4
     5sub print_macro($$);
    86
    97#
     
    4139my @vars = () ;
    4240
    43 sub print_macro($$)
    44 {
    45   my $line = $_[0] ;
    46   my $input  = $_[1] ;
    47   $input =~ s/\\\\/ /g;
    48   my @l = split(' ',$input);
    49 
    50   foreach (@l) {
    51     if ( ( length($line) + length($_) ) < 76 )
    52     {
    53           $line .= " $_";
    54     }
    55     else
    56     {
    57            print "$line \\\n";
    58            $line = "    $_" ;
    59     }
    60   }
    61   print "$line\n" ;
    62 }
    63 
    6441# Strip off duplicate entries from a list
    6542sub purge($)
     
    181158     my $files =`ls *.h 2>/dev/null`;
    182159     print STDERR "WARNING: Replacing \"\(wildcard... in $_\n" ;
    183      $line = "H_FILES =";
    184      @l = split(' ',$files) ;
     160     my $line = "H_FILES =";
     161     my @l = split(' ',$files) ;
    185162     foreach(@l) { $line .= " \$\(srcdir\)/$_"; }
    186163     $line .= "\n" ;
     
    215192  my $line = "" ;
    216193
    217   while ( <> )
     194  while ( <STDIN> )
    218195  {
    219196    &subst_line ;
     
    619596        print "mkinstalldirs = \$(SHELL) \$(top_srcdir)/\@RTEMS_TOPdir\@/mkinstalldirs\n\n" ;
    620597        my $line = join( ' ',@installdirs );
    621         print_macro "INSTALLDIRS =", $line ;
     598        &print_macro( "INSTALLDIRS =", $line );
    622599        print "\n\$(INSTALLDIRS):\n\t\@\$(mkinstalldirs) \$(INSTALLDIRS)\n\n" ;
    623600        $nl_seen = 1 ;
     
    634611    elsif ( /^\§4(.*)$/o  )
    635612    { # pretty print a make variable
    636       print_macro "$1 =", ${"var_$1"} ;
     613      &print_macro( "$1 =", ${"var_$1"} );
    637614      $nl_seen = 0 ;
    638615    }
    639616    elsif ( /^\§5(.*)$/o  )
    640617    { # pretty print an addition to a make variable
    641       print_macro "$1 +=", ${"var_$1+"} ;
     618      &print_macro( "$1 +=", ${"var_$1+"}) ;
    642619      $nl_seen = 0 ;
    643620    }
     
    679656}
    680657
    681 ;1
     658exit 0 ;
     659
     660sub print_macro($$)
     661{
     662  my ($line,$input) = @_ ;
     663  $input =~ s/\\\\/ /g;
     664  my @l = split(' ',$input);
     665
     666  foreach (@l) {
     667    if ( ( length($line) + length($_) ) < 76 )
     668    {
     669          $line .= " $_";
     670    }
     671    else
     672    {
     673           print "$line \\\n";
     674           $line = "    $_" ;
     675    }
     676  }
     677  print "$line\n" ;
     678}
     679
  • tools/update/ampolish

    r0ab65474 rdf49c60  
    11#!/usr/bin/perl
     2
     3package main ;
     4
     5use strict ;
    26
    37#
     
    1014# mv Makefile.am~ Makefile.am
    1115#
    12 # ATTENTION: This file contains embedded tabs
    13 
    14 my $subdirs_seen = "" ;
     16
     17my @vars ;
     18my @conditions = ( "" ) ;
     19my @buffer = ();
     20my %var_ ;
     21
     22define_variable( "\$(AUTOMAKE_OPTIONS)", ( "foreign",  "1.4" ) );
     23define_variable( "\$(VPATH)", ( "\@srcdir\@" ) );
     24
     25# find relative up-path to configure.in
     26my $rtems_cfg = find_file(".","configure.in");
     27
     28# find relative up-path from configure.in to VERSION
     29my $rtems_top = find_file("$rtems_cfg","VERSION");
     30
     31if ( "$rtems_top" eq "." ) { $rtems_top = "" ; }
     32else { $rtems_top .= "/" ; } 
     33
     34{
     35# PASS1:
     36# read input file and concatenate multiple lines into single lines.
     37
     38  my @ibuf = () ;
     39
     40  while( <STDIN> )
     41  { # consume header
     42    last if ( /^[^#].*$/ ) ;
     43    push @ibuf, "$_" ;
     44  }
     45
     46  push @ibuf, "§header\n" ;
     47
     48  do
     49  {
     50    if ( /^(#.*)$/o )
     51    { # preserve comments
     52        push @ibuf, "$_" ;
     53    }
     54    elsif ( /^(\t.*)\\[\s]*$/o )
     55      { # multilines for scripts
     56        my $line = "$1§" ;
     57        while( <STDIN> )
     58        {
     59          if ( /^(.*)\\[\s]*$/o )
     60          {
     61            $line .= "$1§" ;
     62          }
     63          else
     64          {
     65            $line .= "$_" ;
     66            push @ibuf, $line ;
     67            last ;
     68          }
     69        }
     70      }
     71    elsif ( /^(.*)\\[\s]*$/o )
     72      { # multilines
     73        my $line = "$1" ;
     74        while( <STDIN> )
     75        {
     76          if ( /^(.*)\\[\s]*$/o )
     77          {
     78            $line .= "$1" ;
     79          }
     80          else
     81          {
     82            $line .= "$_" ;
     83            $line =~ s%[\s]+% %g ;
     84            push @ibuf, "$line\n" ;
     85            last ;
     86          }
     87        }
     88      }
     89    else
     90      {
     91        push @ibuf, "$_" ;
     92      }
     93  } while ( <STDIN> ) ;
     94  @buffer = @ibuf ;
     95}
     96
     97{
     98# PASS2:
     99# fix obsolete constructs
     100  my @ibuf = () ;
     101
     102  foreach ( @buffer )
     103  {
     104#    tr /\{\}/\(\)/ ;
     105
     106    if ( /^(TMP|PRE)INSTALL_FILES[\s]*=(.*)$/o )
     107    { # force "+="
     108      push @ibuf, "$1INSTALL_FILES +=$2\n" ;
     109    }
     110    elsif ( /^(VPATH|EXTRA_DIST)[\s]*\+=(.*)$/o )
     111    { # force "="
     112      push @ibuf, "$1 = $2\n" ;
     113    }
     114    elsif ( /^[\s]*ACLOCAL[\s]*=[\s]*\@ACLOCAL\@.*$/o )
     115    { # remove the line
     116    }
     117    elsif ( /^[\s]*(ACLOCAL_AMFLAGS)[\s\t]*[\+]*=[\s]*(.*)[\s]*$/o )
     118    { # remove the line
     119    }
     120    elsif ( /^[\s]*(AM_CFLAGS)[\s\t]*[\+]*=[\s]*\$\(CFLAGS_OS_V\)[\s]*$/o )
     121    { # remove the line
     122    }
     123    elsif ( /^[\s]*debug-am:.*$/o )
     124    { # remove the line
     125    }
     126    elsif ( /^[\s]*all(\-am):(.*)$/o )
     127    { # replace the line
     128      push @ibuf, "all-local:$2\n" ;
     129    }
     130    elsif ( /^[\s]*profile-am:.*$/o )
     131    { # remove the line
     132    }
     133    elsif ( /^[\s]*include[\s\t]*\$\(RTEMS_ROOT\)\/make\/lib.cfg[\s]*$/o )
     134    {
     135      push @ibuf, "include \$(top_srcdir)/${rtems_top}automake/lib.am\n" ;
     136    }
     137    elsif ( /^(.*[^\s])[\s]*$/o )
     138    { # remove trailing spaces
     139      push @ibuf, "$1\n" ;
     140    }
     141    else
     142    {
     143      push @ibuf, "$_" ;
     144    }
     145  }
     146  @buffer = @ibuf ;
     147}
     148
     149# print STDERR "<tmp>\n", @buffer, "</tmp>\n" ;
     150
     151{
     152  my @ibuf = () ;
     153  foreach ( @buffer )
     154  {
     155    if ( /^#(.*)$/o )
     156    {
     157      push @ibuf, "#$1\n" ;
     158    }
     159    elsif ( /^[\s]*if[\s\t]+([a-zA-Z0-9_]+)[\s\t]*$/o )
     160    {
     161      push @conditions, "\@" . $1 . "_TRUE\@" ;
     162      push @ibuf, "if $1\n" ;
     163    }
     164    elsif ( /^[\s]*else[\s\t]*$/o )
     165    {
     166      @conditions[$#conditions] =~ s/_TRUE\@$/_FALSE\@/;
     167      push @ibuf, "else\n" ;
     168    }
     169    elsif ( /^[\s]*endif[\s\t]*$/o )
     170    {
     171      pop @conditions ;
     172      push @ibuf, "endif\n" ;
     173    }
     174    elsif ( /^§.*$/o )
     175    {
     176      push @ibuf, "$_" ;
     177    }
     178    elsif ( /^[\s]*(VPATH)[\s\t]*([\+]*)=[\s]*(.*)[\s]*$/o )
     179    {
     180      my $lh = "\$($1)" ;
     181      my @rh = split( /:/,"$3");
     182      if ( $#conditions  > 0 )
     183      {
     184        print STDERR "WARNING: $1 must not be set inside of conditionals!\n"
     185      }
     186      define_variable( "$lh", @rh );
     187
     188    }
     189    elsif ( /^[\s]*(AUTOMAKE_OPTIONS)[\s\t]*([\+]*)=[\s]*(.*)$/o )
     190    {
     191      my $lh = "\$($1)" ;
     192      my @rh = &split_vars("$3");
     193
     194      if ( $#conditions > 0 )
     195      {
     196        print STDERR "WARNING: $1 must not be set inside of conditionals!\n"
     197      }
     198
     199      define_variable( "$lh", @rh );
     200    }
     201    elsif ( /^[\s]*([a-zA-Z0-9_]+)[\s\t]*([\+]*)=[\s]*(.*)$/o )
     202    {
     203      my $lh = join ('',@conditions) . "\$($1)" ;
     204      my @rh = &split_vars("$3");
     205      my $seen = variable_seen( "$lh" ) ;
     206
     207      if ( $#conditions > 0 )
     208      {
     209        define_variable( "\$($1)", () );
     210      }
     211
     212      define_variable( "$lh", @rh );
     213
     214      if ( not $seen )
     215      {
     216        push @ibuf, "§$2var_$lh\n" ;
     217      }
     218    }
     219    elsif ( /^[\s]*include[\s\t]*\$\(top_srcdir\)[\.\/]*automake\/(.*)\.am$/o )
     220    {
     221      if ( "$1" eq "lib" )
     222      {
     223        push @ibuf, "include \$(top_srcdir)/${rtems_top}automake/$1.am\n" ;
     224      }
     225      elsif ( "$1" eq "local" )
     226      {
     227        $main::seen_local = 1 ;
     228      }
     229      elsif ( "$1" eq "host" )
     230      {
     231        $main::seen_host = 1 ;
     232      }
     233    }
     234    elsif ( /^[\s]*include[\s\t]*(.*)$/o )
     235    {
     236      push @ibuf, "include $1\n" ;
     237    }
     238    elsif ( /^\t(.*)$/o )
     239    {
     240      push @ibuf, "\t$1\n" ;
     241    }
     242    elsif ( /^(.*)\:(.*)$/o )
     243    {
     244      push @ibuf, "$1:$2\n" ;
     245    }
     246    elsif ( /^[\s]*$/o )
     247    {
     248      push @ibuf, "\n" ;
     249    }
     250    else
     251    {
     252      die "ERROR: Don't know how to handle <$_>" ;
     253    }
     254  } # for
     255  @buffer = @ibuf ;
     256} # while
     257
     258die "Conditional stack corrupted" if ( $#conditions != 0 );
     259
     260foreach( @vars )
     261{
     262  purge( \@{$var_{"$_"}} );
     263}
     264
     265# print STDERR "<tmp>\n", @buffer, "</tmp>\n" ;
     266
     267
     268{
     269  my @ibuf = () ;
     270  foreach( @buffer )
     271  {
     272    if ( /^#.*$/o )
     273    {
     274      push @ibuf, "$_" ;
     275    }
     276    elsif( /^§header$/o )
     277    {
     278      my $l = $var_{"\$(AUTOMAKE_OPTIONS)"} ;
     279      push @ibuf, "\nAUTOMAKE_OPTIONS = @{$l}\n" ;
     280      if ( "$rtems_cfg" eq "." )
     281      {
     282        push @ibuf, "ACLOCAL_AMFLAGS = -I \$(RTEMS_TOPdir)/aclocal\n" ;
     283      }
     284      if ( defined( @{$var_{"\$(VPATH)"}} ) )
     285      {
     286        if ( $#{$var_{"\$(VPATH)"}} > 0 )
     287        {
     288          my $l = join (':',@{$var_{"\$(VPATH)"}}) ;
     289          push @ibuf, "\nVPATH = $l\n" ;
     290        }
     291      }
     292      push @ibuf, "\n" ;
     293    }
     294    elsif ( /^§(\+|)var_(.*)\$\((.*)\)$/o )
     295    {
     296      print_var(\@ibuf, "$3 $1=", $var_{"$2\$($3)"}) ;
     297    }
     298    elsif ( /^\t.*$/o )
     299    {
     300      &print_script(\@ibuf, "$_");
     301    }
     302    elsif ( /^[\s]*if[\s]+([a-zA-Z0-9_]+)[\s\t]*$/o )
     303    {
     304      push @conditions, "\@$1_TRUE\@" ;
     305      push @ibuf, "if $1\n" ;
     306    }
     307    elsif ( /^[\s]*else[\s]*$/o )
     308    {
     309      @conditions[$#conditions] =~ s/_TRUE\@$/_FALSE\@/;
     310      push @ibuf, "else\n" ;
     311    }
     312    elsif ( /^[\s]*endif[\s]*$/o )
     313    {
     314      pop @conditions ;
     315      push @ibuf, "endif\n" ;
     316    }
     317    else
     318    {
     319      print_line(\@ibuf,$_);
     320    }
     321  }
     322
     323  if ( variable_seen("\$(SUBDIRS)") )
     324  {
     325    push @ibuf, "include \$(top_srcdir)/${rtems_top}automake/subdirs.am\n" ;
     326  }
     327
     328  if ( defined( $main::seen_host ) )
     329  {
     330    push @ibuf, "include \$(top_srcdir)/${rtems_top}automake/host.am\n" ;
     331  }
     332  else
     333  {
     334    push @ibuf, "include \$(top_srcdir)/${rtems_top}automake/local.am\n" ;
     335  }
     336
     337  @buffer = @ibuf ;
     338}
     339
     340#print STDERR "<tmp>\n", @buffer, "</tmp>\n" ;
     341
     342{ ## pretty print
     343  my $out = join ('',@buffer) ;
     344  $out =~ s/\s\#\n(\#\n)+/\n/g ;
     345  $out =~ s/\n\n\#\n\n/\n/g ;
     346  $out =~ s/\n\n[\n]*/\n\n/g ;
     347  print $out ;
     348}
     349
     350exit 0;
    15351
    16352# find a relative up-path to a file $file, starting at directory $pre
     
    23359  if (not "$pre") { $pre = "." ; }
    24360
    25   for ( $str = "$pre" . "/" . "$top" ;
     361  for ( my $str = "$pre" . "/" . "$top" ;
    26362    ( -d "$str" ) ;
    27363    $str = "$pre" . "/" . "$top" )
     
    43379}
    44380
    45 # find relative up-path to configure.in
    46 my $rtems_cfg = find_file(".","configure.in");
    47 
    48 # find relative up-path from configure.in to VERSION
    49 my $rtems_top = find_file("$rtems_cfg","VERSION");
    50 
    51 if ( "$rtems_top" eq "." )
    52 { $rtems_top = "" ; }
    53 else { $rtems_top .= "/" ; } 
    54 
    55 my $nl_seen = 0 ;
    56 
    57 while( <> )
    58 { # consume header
    59   last if ( /^[^#].*$/ ) ;
    60   print "$_" ;
    61 }
    62 
    63 print "\nAUTOMAKE_OPTIONS = foreign 1.4\n";
    64 if ( "$rtems_cfg" eq "." )
    65 {
    66   print "ACLOCAL_AMFLAGS = -I \$(RTEMS_TOPdir)/aclocal\n"
    67 }
    68 
    69 while( <> )
    70 {
    71   if ( /^[\s\t]*$/o )
    72   {
    73     $nl_seen = $nl_seen+1;
    74   }
    75 
    76   if ( /^[\s\t]*AUTOMAKE_OPTIONS.*$/o )
    77   { # remove the line
    78   }
    79   elsif ( /^[\s\t]*ACLOCAL[\s\t]*=[\s\t]*\@ACLOCAL\@.*$/o )
    80   { # remove the line
    81   }
    82   elsif ( /^[\s\t]*ACLOCAL_AMFLAGS[\s\t]*=[\s\t]*.*$/o )
    83   { # remove the line
    84   }
    85   elsif ( /^[\s\t]*include[\s\t]*\$\(top_srcdir\)[\.\/]*automake\/(.*)\.am$/o )
    86   {
    87     if ( "$1" eq "lib" )
    88     {
    89       print "include \$(top_srcdir)/${rtems_top}automake/$1.am\n" ;
    90     }
    91   }
    92   elsif ( /^[\s\t]*include[\s\t]*\$\(RTEMS_ROOT\)\/make\/lib.cfg$/o )
    93   {
    94     print "include \$(top_srcdir)/${rtems_top}automake/lib.am\n" ;
    95   }
    96   elsif ( /^[\s\t]*SUBDIRS.*$/o )
    97   {
    98     $subdirs_seen = "yes" ;
    99     print "$_" ;
    100     $nl_seen = 0 ;
    101   }
    102   elsif ( /^[   ]*$/o )
    103   {
    104     print "$_" if $nl_seen < 2 ;
    105   }
    106   else
    107   {
    108     print "$_" ;
    109     $nl_seen = 0;
    110   }
    111 } # while
    112 
    113 if ( "$subdirs_seen" )
    114 {
    115   print "include \$(top_srcdir)/${rtems_top}automake/subdirs.am\n" ;
    116 }
    117 print "include \$(top_srcdir)/${rtems_top}automake/local.am\n" ;
    118 
    119 ;1
     381sub variable_seen($)
     382{
     383  my $label = "$_[0]" ;
     384  my $res = defined $var_{"$label"};
     385#print STDERR "SEEN: $label ->$res<\n" ;
     386  return $res ;
     387}
     388
     389sub define_variable($$)
     390{
     391  my ($label,@value) = @_ ;
     392
     393  if ( not variable_seen("$label") )
     394  {
     395#print STDERR "DEFINING: $label\n" ;
     396    push @vars, "$label" ;
     397  }
     398
     399  foreach my $i ( @{value} )
     400  {
     401    push @{$var_{"$label"}}, $i ;
     402  }
     403}
     404
     405# Strip off duplicate entries from a list
     406sub purge($)
     407{
     408  my $list = $_[0] ; # Reference to list !
     409  my (@tmp) = () ;
     410
     411  foreach my $l ( @{$list} )
     412  {
     413    my $i = 1 ;
     414    foreach my $t (@tmp)
     415    {
     416      if ( $t eq $l )
     417      {
     418        $i = 0 ;
     419        last ;
     420      }
     421    }
     422    push @tmp,$l if ($i) ;
     423  }
     424
     425  @{$list} = @tmp ;
     426}
     427
     428#
     429# Break the right hand side of a variable assignment into separate chunks
     430#
     431sub split_vars($)
     432{
     433  my $line = $_[0] ;
     434  my (@buf) = split(//,"$line") ;
     435
     436  my $begin = 0 ;
     437  my @res = () ;
     438
     439  my $depth = 0 ;
     440  my $state = 0 ;
     441
     442  my $len = $#buf + 1 ;
     443  for ( my $i = 0 ; $i < $len ; $i++ )
     444  {
     445    my $c = @buf[$i] ;
     446    if ( $state == 0 )
     447    {
     448      if ( "$c" ne " " )
     449      { # token
     450        $begin = $i ;
     451        $state++ ;
     452      }
     453      if ( "$c" eq "\$" )
     454      { # variable
     455        $depth++ ;
     456      }
     457    }
     458    elsif ( $state == 1 )
     459    {
     460      if ( ( "$c" eq "\)" ) or ( "$c" eq "\}" ) )
     461      { # variable
     462        $depth-- ;
     463      }
     464      elsif ( ("$c" eq " " ) and ( $depth == 0 ) )
     465      {
     466        push @res, substr($line,$begin,$i-$begin);
     467        $state-- ;
     468      }
     469      elsif ( "$c" eq "\$" )
     470      { # variable
     471        $depth++ ;
     472      }
     473    }
     474    else
     475    {
     476      die "split_vars: unknown mode\n" ;
     477    }
     478  }
     479
     480  if ( $state > 0 )
     481  {
     482    push @res, substr($line,$begin,$len-$begin);
     483    $state = 0
     484  }
     485  return @res ;
     486}
     487
     488sub print_var($$$)
     489{
     490  my ($ibuf,$line,$l) = @_ ; # $l .. reference to list
     491
     492  foreach (@{$l}) {
     493    if ( ( length($line) + length($_) ) < 76 )
     494    {
     495          $line .= " $_";
     496    }
     497    else
     498    {
     499           push @{$ibuf}, "$line \\\n";
     500           $line = "    $_" ;
     501    }
     502  }
     503  push @{$ibuf}, "$line\n" ;
     504}
     505
     506sub print_line($$)
     507{
     508  my ($ibuf,$input) = @_ ;
     509  my @l = split( / /, $input );
     510  my $line = shift @l ;
     511
     512  foreach my $i (@l) {
     513    if ( ( length($line) + length($i) ) < 76 )
     514    {
     515          $line .= " $i";
     516    }
     517    else
     518    {
     519           push @{$ibuf}, "$line \\\n";
     520           $line = "    $i" ;
     521    }
     522  }
     523  push @{$ibuf}, "$line" ;
     524}
     525
     526sub print_script($$)
     527{
     528  my ($ibuf,$input) = @_ ;
     529  $input =~ s%§%\\\n%g ;
     530  push @{$ibuf}, $input ;
     531}
  • tools/update/cipolish

    r0ab65474 rdf49c60  
    1313# $Id$
    1414
    15 # find relative up-path to configure.in
     15use strict ;
     16
     17my @vars = () ;
     18my @buffer = () ;
     19
     20# find relative up-path to VERSION
    1621my $rtems_cfg = &find_file(".","VERSION");
    1722my $rtems_root = &find_root() ;
     
    2025$rtems_name .=  "-" . "$rtems_root" if (length($rtems_root) > 0 ) ;
    2126
    22 my @buffer = () ;
    23 
    2427while ( <> )
    2528{
     
    127130    if ( /^[\s]*(RTEMS_ENABLE_LIBCDIR).*$/o )
    128131    {
    129       if (  ( not defined $var_RTEMS_PROG_CC_FOR_TARGET )
    130         and ( not defined $var_RTEMS_PROG_CXX_FOR_TARGET )
     132      if (  ( not defined $main::var_RTEMS_PROG_CC_FOR_TARGET )
     133        and ( not defined $main::var_RTEMS_PROG_CXX_FOR_TARGET )
    131134      )
    132135      {
     
    166169  if (not "$pre") { $pre = "." ; }
    167170
    168   for ( $str = "$pre" . "/" . "$top" ;
     171  for ( my $str = "$pre" . "/" . "$top" ;
    169172    ( -d "$str" ) ;
    170173    $str = "$pre" . "/" . "$top" )
  • tools/update/rtems-polish.sh

    r0ab65474 rdf49c60  
    3838}
    3939
    40 # Check for auxillary files
     40# Check for auxiliary files
    4141aux_files="../../VERSION ampolish acpolish cipolish"
    4242for i in ${aux_files}; do
Note: See TracChangeset for help on using the changeset viewer.