diff options
Diffstat (limited to 'tools/update')
-rw-r--r-- | tools/update/Makefile.am | 2 | ||||
-rw-r--r-- | tools/update/Makefile.in | 17 | ||||
-rw-r--r-- | tools/update/aclocal.m4 | 85 | ||||
-rwxr-xr-x | tools/update/acpolish | 567 | ||||
-rwxr-xr-x | tools/update/ampolish | 25 | ||||
-rw-r--r-- | tools/update/configure | 92 | ||||
-rw-r--r-- | tools/update/configure.in | 1 | ||||
-rwxr-xr-x | tools/update/rtems-polish.sh | 2 |
8 files changed, 669 insertions, 122 deletions
diff --git a/tools/update/Makefile.am b/tools/update/Makefile.am index 256cf69c78..af77500d1c 100644 --- a/tools/update/Makefile.am +++ b/tools/update/Makefile.am @@ -3,7 +3,7 @@ # AUTOMAKE_OPTIONS = foreign 1.4 -ACLOCAL = @ACLOCAL@ -I $(RTEMS_TOPdir)/aclocal +ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal # NOTE: It doesn't make much sense to install these files CLEANFILES = update word-replace diff --git a/tools/update/Makefile.in b/tools/update/Makefile.in index 529a1bafed..0a774c2163 100644 --- a/tools/update/Makefile.in +++ b/tools/update/Makefile.in @@ -44,6 +44,8 @@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . + +ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ @@ -62,9 +64,12 @@ PRE_UNINSTALL = : POST_UNINSTALL = : host_alias = @host_alias@ host_triplet = @host@ +INSTALL_CHANGE = @INSTALL_CHANGE@ KSH = @KSH@ +MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ PACKAGE = @PACKAGE@ +PACKHEX = @PACKHEX@ PERL = @PERL@ PROJECT_ROOT = @PROJECT_ROOT@ RTEMS_ROOT = @RTEMS_ROOT@ @@ -73,10 +78,12 @@ VERSION = @VERSION@ project_bindir = @project_bindir@ project_includedir = @project_includedir@ project_libdir = @project_libdir@ +rtems_bspdir = @rtems_bspdir@ +rtems_makedir = @rtems_makedir@ tooldir = @tooldir@ AUTOMAKE_OPTIONS = foreign 1.4 -ACLOCAL = @ACLOCAL@ -I $(RTEMS_TOPdir)/aclocal +ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal # NOTE: It doesn't make much sense to install these files CLEANFILES = update word-replace @@ -107,19 +114,19 @@ TAR = tar GZIP_ENV = --best all: all-redirect .SUFFIXES: -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/../../automake/local.am +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/../../automake/local.am cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) cd $(top_builddir) \ && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status -$(ACLOCAL_M4): configure.in - cd $(srcdir) && $(ACLOCAL) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck -$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) +$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) cd $(srcdir) && $(AUTOCONF) tags: TAGS TAGS: diff --git a/tools/update/aclocal.m4 b/tools/update/aclocal.m4 index c3a3c776a8..079a0bfcc1 100644 --- a/tools/update/aclocal.m4 +++ b/tools/update/aclocal.m4 @@ -27,10 +27,6 @@ TARGET_SUBDIR=".") RTEMS_TOPdir="$1"; AC_SUBST(RTEMS_TOPdir) -PROJECT_ROOT=`pwd`/$RTEMS_TOPdir; -test "$TARGET_SUBDIR" = "." || PROJECT_ROOT="$PROJECT_ROOT/.." -AC_SUBST(PROJECT_ROOT) - dnl Determine RTEMS Version string from the VERSION file dnl Hopefully, Joel never changes its format ;- AC_MSG_CHECKING([for RTEMS Version]) @@ -46,9 +42,6 @@ if test -z "$RTEMS_VERSION"; then AC_MSG_ERROR(Unable to determine version) fi AC_MSG_RESULT($RTEMS_VERSION) - -RTEMS_ROOT='$(top_srcdir)'/$RTEMS_TOPdir; -AC_SUBST(RTEMS_ROOT) ])dnl # Do all the work for Automake. This macro actually does too much -- @@ -143,6 +136,39 @@ else fi AC_SUBST($1)]) +# Add --enable-maintainer-mode option to configure. +# From Jim Meyering + +# serial 1 + +AC_DEFUN(AM_MAINTAINER_MODE, +[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode is disabled by default + AC_ARG_ENABLE(maintainer-mode, +[ --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + USE_MAINTAINER_MODE=$enableval, + USE_MAINTAINER_MODE=no) + AC_MSG_RESULT($USE_MAINTAINER_MODE) + AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST(MAINT)dnl +] +) + +# Define a conditional. + +AC_DEFUN(AM_CONDITIONAL, +[AC_SUBST($1_TRUE) +AC_SUBST($1_FALSE) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi]) + dnl $Id$ AC_DEFUN(RTEMS_PATH_KSH, @@ -171,23 +197,12 @@ AC_MSG_WARN( fi ]) -# Define a conditional. - -AC_DEFUN(AM_CONDITIONAL, -[AC_SUBST($1_TRUE) -AC_SUBST($1_FALSE) -if $2; then - $1_TRUE= - $1_FALSE='#' -else - $1_TRUE='#' - $1_FALSE= -fi]) - AC_DEFUN(RTEMS_TOOLPATHS, [ # tooldir='$(exec_prefix)/'$target_alias # Temporary work-around until building in source tree is supported +AC_REQUIRE([RTEMS_PROJECT_ROOT]) + tooldir='$(PROJECT_ROOT)' AC_SUBST(tooldir) @@ -199,5 +214,35 @@ AC_SUBST(project_libdir) project_bindir='$(tooldir)/bin' AC_SUBST(project_bindir) + +rtems_bspdir='$(prefix)/${RTEMS_BSP}' +AC_SUBST(rtems_bspdir) +rtems_makedir='$(prefix)/make' +AC_SUBST(rtems_makedir) ]) +dnl +dnl $Id$ +dnl + +AC_DEFUN(RTEMS_PROJECT_ROOT, +[dnl +AC_REQUIRE([RTEMS_TOP]) +if test "$TARGET_SUBDIR" = "." ; then +PROJECT_ROOT=$RTEMS_TOPdir/'$(top_builddir)'; +else +PROJECT_ROOT=../$RTEMS_TOPdir/'$(top_builddir)' +fi +AC_SUBST(PROJECT_ROOT) + +RTEMS_ROOT=$RTEMS_TOPdir/'$(top_builddir)'/c/$RTEMS_BSP +AC_SUBST(RTEMS_ROOT) + +INSTALL_CHANGE="\$(KSH) \$(PROJECT_ROOT)/tools/build/install-if-change" +AC_SUBST(INSTALL_CHANGE) + +PACKHEX="\$(PROJECT_ROOT)/tools/build/packhex" +AC_SUBST(PACKHEX) +]) + + diff --git a/tools/update/acpolish b/tools/update/acpolish index d348bf9ae6..6c3fc7a4b9 100755 --- a/tools/update/acpolish +++ b/tools/update/acpolish @@ -1,5 +1,11 @@ #!/usr/bin/perl +# use strict 'subs' ; +# use strict 'vars' ; +# use strict 'refs' ; + +# use strict ; + # # Perl script to beautify and enhance RTEMS autoconf Makefile.ins # @@ -9,20 +15,74 @@ # acpolish <Makefile.in >Makefile.in~ # mv Makefile.in~ Makefile.in # -# ATTENTION: This file contains embedded tabs +# Note: This tool is not indented to be exported from the source-tree +# if ( -f "Makefile.am" ) { - # Refuse to work on autoconfiscated Makefile.ins; + # Refuse to work on Makefile.ins generated from automake; # redirecting STDOUT to Makefile.in will trash the Makefile.in ;- - die "acpolish must not be run in autoconfiscated directories" ; + die "acpolish must not be run in automake directories" ; } - +my $experimental = 0 ; # enable experimental/unsafe features +my $verbose = 0 ; my $build_pgms_seen = "" ; +my $make_exe_seen = 0 ; +my $install_seen = 0 ; my $top_builddir = ""; my $subdir = ""; +my @installdirs = () ; + +my @pieces = () ; +my @files = () ; +my @variants = () ; +my @vars = () ; + +sub print_macro($$) +{ + my $line = $_[0] ; + my $input = $_[1] ; + $input =~ s/\\\\/ /g; + my @l = split(' ',$input); + + foreach (@l) { + if ( ( length($line) + length($_) ) < 76 ) + { + $line .= " $_"; + } + else + { + print "$line \\\n"; + $line = " $_" ; + } + } + print "$line\n" ; +} + +# Strip off duplicate entries from a list +sub purge($) +{ + my $list = $_[0] ; # Reference to list ! + my (@tmp) = () ; + + foreach my $l ( @{$list} ) + { + my $i = 1 ; + foreach my $t (@tmp) + { + if ( $t eq $l ) + { + $i = 0 ; + last ; + } + } + push @tmp,$l if ($i) ; + } + + @{$list} = @tmp ; +} sub find_root { @@ -58,100 +118,477 @@ sub find_root find_root(); -my $nl_seen = 0 ; +my @buffer = () ; -while( <> ) -{ - if ( /^[ ]*$/o ) - { - $nl_seen = $nl_seen+1; +sub subst_line +{ +# substitute obsolete variables + if ( /^([^\s]*)[\s]+$/o ) + { # strip trailing spaces + $_ = "$1\n"; } - - if ( /^(.*)\$\(RTEMS_BSP\)(.*)$/o ) + if ( /^(.*)MKLIB(.*)$/o ) { - $_ = "$1\$\{RTEMS_BSP\}$2\n" ; + s/MKLIB/RANLIB/g ; } - - if ( /^(.*)\$\(PROJECT_ROOT\)\/\$\{RTEMS_BSP\}\/lib\/include(.*)$/o ) + if ( /^(.*)\$\(INSTINCFLAGS\)(.*)$/o ) { - $_ = "$1\$\(PROJECT_INCLUDE\)$2\n" ; + s/\$\(INSTINCFLAGS\)/-m 644/g ; } - - if ( /^(.*)\$\{PROJECT_RELEASE\}(.*)$/o ) + if ( /^(.*)ASM(_FILES|_PIECES|_O_FILES)(.*)$/o ) { - $_ = "$1\$\{PROJECT_RELEASE\}$2\n" ; + s/ASM_FILES/S_FILES/g ; + s/ASM_PIECES/S_PIECES/g ; + s/ASM_O_FILES/S_O_FILES/g ; + print STDERR "ASM: $_" if ( $verbose > 0) ; } - - if ( /^[ ]*srcdir[ ]*=.*$/o ) - { - print "\@SET_MAKE\@\n" ; - print "$_" ; - print "top_srcdir = \@top_srcdir\@\n" ; - print "top_builddir = $top_builddir\n" ; - print "subdir = $subdir\n" if "$subdir" ; - print "\nINSTALL = \@INSTALL\@\n\n"; - print "RTEMS_ROOT = \$(top_srcdir)/\@RTEMS_TOPdir\@\n" ; - print "PROJECT_ROOT = \@PROJECT_ROOT\@\n\n" ; - $nl_seen=1; + if ( /^(.*)MP_PIECES(.*)$/o ) + { # HACK: this is not always correct + s/MP_PIECES/MP_C_PIECES/g ; + print STDERR "MP_PIECES: $_" if ( $verbose > 0 ); } - elsif ( /^[ ]*top_srcdir[ ]*=.*$/o ) + if ( /^(.*)\$\(RTEMS_BSP\)(.*)$/o ) { - # remove the line + s/\$\(RTEMS_BSP\)/\@RTEMS_BSP\@/g ; } - elsif ( /^[ ]*top_builddir[ ]*=.*$/o ) + if ( /^(.*)\$\(RTEMS_ROOT\)\/mkinstalldirs(.*)$/o ) { - # remove the line + $_ = "$1\$\(mkinstalldirs\)$2\n" ; } - elsif ( /^[ ]*Makefile:.*/o ) - { # consume the block - while( <> ) { last if /^[ ]*$/o ; } + if ( /^(.*)\$\{(.*)_FILES\}(.*)$/o ) + { + $_ = "$1\$\($2_FILES\)$3\n" ; } - elsif ( /^[ ]*%:[ ]\$\(srcdir\)\/%\.in.*$/o ) - { # consume the block - while( <> ) { last if /^[ ]*$/o ; } + if ( /^(.*)\$\{(.*)_PIECES\}(.*)$/o ) + { + $_ = "$1\$\($2_PIECES\)$3\n" ; } - elsif ( /^[ ]*RTEMS_ROOT[ ]*=.*$/o ) + if ( /^(.*)\$\(PROJECT_ROOT\)\/\@RTEMS_BSP\@\/lib\/include(.*)$/o ) { - # remove the line + $_ = "$1\$\(PROJECT_INCLUDE\)$2\n" ; } - elsif ( /^[ ]*PROJECT_ROOT[ ]*=.*$/o ) + if ( /^(.*)\$\{PROJECT_RELEASE\}(.*)$/o ) { - # remove the line + $_ = "$1\$\(PROJECT_RELEASE\)$2\n" ; } - elsif ( /^[ ]*INSTALL[ ]*=[ ]*\@INSTALL\@.*$/o ) + if ( /^(.*\$\(INSTALL_[A-Z]+\))[\s]+-m[\s]+([54])([0-9][0-9].*)$/o ) { - # remove the line + my $v = $2 + 2 ; + $_ = "$1 -m $v$3\n" ; } - elsif ( /^[ ]*subdir[ ]*=.*$/o ) + if ( /^H_FILES[\s]*=[\s]*\$\(wildcard[\s]+\$\(srcdir\)\/\*\.h\)[\s]*$/o ) { - # remove the line + my $files =`ls *.h 2>/dev/null`; + print STDERR "WARNING: Replacing \"\(wildcard... in $_\n" ; + $line = "H_FILES ="; + @l = split(' ',$files) ; + foreach(@l) { $line .= " \$\(srcdir\)/$_"; } + $line .= "\n" ; + $_ = "$line" ; } - elsif ( /^[ ]*\@SET_MAKE\@.*$/o ) + if ( /^.*\$\(make\-exe\).*$/o ) { - # remove the line + $make_exe_seen = 1 ; } - elsif ( /^include[ ]*.*rtems\.cfg.*$/o ) + if ( /^.*\$\(INSTALL_(DATA|SCRIPT|PROGRAM)\)(.*)$/o ) { - # remove the line + $install_seen = 1 ; } - elsif ( /^[ ]*BUILD_PGMS.*=.*$/o ) +} + +{ +# 1st PASS: +# * Read input file +# * concatenate multiple lines +# * Remove obsolete variables + + my @ibuf = () ; + my $line = "" ; + + while ( <> ) { - $build_pgms_seen = "true" ; - print "$_" ; - $nl_seen=0; + &subst_line ; + if ( /^(#.*)$/o ) + { # preserve comments + $line = "$_" ; + push @ibuf, $line ; + $line = "" ; + } + elsif ( /^.*\\$/o ) + { # multilines + chop ; + $line .= "$_\\" ; + } + else + { + $line .= "$_" ; + push @ibuf, $line ; + $line = "" ; + } } - elsif ( /^[ ]*$/o ) + @buffer = @ibuf; +} + +{ +# 2nd PASS: +# * remove automatically generated lines +# * process some selected make rules + my $line = "" ; + my @tbuf = () ; + foreach (@buffer) { - print "$_" if $nl_seen < 2 ; + if ( /^[\t](.*)$/o ) + { # make rule production + my $line = $1 ; + tr/\\/ / ; + my @l = split(/;/,$_); + foreach (@l) + { # try to get installation directories + if ( /^.*\$\(mkinstalldirs\).*\s\$\(INSTALLDIRS\)$/o ) + { + } + elsif ( /^.*\$\(mkinstalldirs\).*\s([^\s]+)$/o ) + { + push @installdirs, "$1" ; + } + elsif ( /^.*\$\(INSTALL_CHANGE\).*\s([^\s]+)$/o ) + { + push @installdirs, "$1" ; + } + } + push @tbuf, "§3$line" + } + elsif ( /^[\s]*\#.*$/o ) + { # comment + push @tbuf, "$_" ; + } + elsif ( /^[\s]*([A-Z_]*)_FILES[\s]*\=[\s]*(.*)$/o ) + { # *_FILES = ... Macros + if ( /^[\s]*([A-Z_]*_|)(CC|C|EQ|H|I|O|S|X)_FILES[\s]*\=[\s]*(.*)$/o ) + { +# print STDERR "FILES: <$1>--<$2>--<$3>\n" ; + my $f = "$1$2_FILES" ; + ${"var_$f"}="$3" ; + if ( ( $experimental > 0 ) + and ( ( "$2" eq "C" ) or ( "$2" eq "CC" ) or ( "$2" eq "S" ) + or ( "$2" eq "I" ) or ( "$2" eq "H" ) ) ) + { + my $p = "$1$2_PIECES" ; + if ( not defined ${"var_$p"} ) + { + print STDERR "ADDING $p\n" ; + ${"var_$p"} = "" ; + push @tbuf, "§4$p\n" ; + push @pieces, "$p" ; + } + } + # place a marker + push @tbuf, "§4$f\n" ; + push @files, "$f" ; + } + else + { # found a bug + print STDERR "UNKNOWN _FILES: $_\n" ; + my $f = "$1_FILES" ; + ${"var_$f"}="$2" ; + # place a marker + push @tbuf, "§4$f\n" ; + push @files, "$f" ; + } + } + elsif ( /^[\s]*([A-Z_]*)_PIECES[\s]*\=[\s]*(.*)$/o ) + { # *_PIECES = ... Macros + if ( /^[\s]*([A-Z][A-Z0-9_]*_|)(CC|C|EQ|H|I|O|S|X|REL)_PIECES[\s]*\=[\s]*(.*)$/o ) + { + my $p = "$1$2_PIECES" ; + + if ( not defined ${"var_$p"} ) + { + ${"var_$p"} = "$3" ; + push @tbuf, "§4$p\n" ; + push @pieces, "$p" ; + } + else + { + ${"var_$p"} .= " $3" ; + } + } + elsif ( /^[\s]*(BSP|CPU|GENERIC)_PIECES[\s]*\=[\s]*(.*)$/o ) + { # Explicit exceptions from the *_PIECES naming conventions + # They should better be replaced in future + my $p = "$1_PIECES" ; + ${"var_$p"}="$2" ; + # place a marker + push @tbuf, "§4$p\n" ; + push @pieces, "$p" ; + } + else + { # found a bug + print STDERR "UNKNOWN _PIECES: $_\n" ; + my $p = "$1_PIECES" ; + ${"var_$p"}="$2" ; + # place a marker + push @tbuf, "§4$p\n" ; + push @pieces, "$p" ; + } + } + elsif ( /^[\s]*([A-Z_]+)_PIECES_([^\s]+)_V[\s]*\=[\s]*(.*)$/o ) + { # *_PIECES_.._V = ... Macros + if ( /^[\s]*([A-Z][A-Z0-9_]*_|)(CC|C|EQ|H|I|O|S|X|REL)_PIECES_([^\s]+)_V[\s]*\=[\s]*(.*)$/o ) + { + my @l = split(/_/,$3); + my $v = "$1$2-$#l" ; + if ( not defined @{"variants_$v"} ) { push @variants, "$v" ; } + + my $p = "$1$2_PIECES_$3_V" ; + push @{"variants_${v}"}, "$p" ; + + ${"var_$p"}="$4" ; + # place a marker + push @tbuf, "§4$p\n" ; + push @pieces, "$p" ; + } + else + { # found a bug + print STDERR "UNKNOWN _PIECES: $_\n" ; + my $p = "$1_PIECES" ; + ${"var_$p"}="$2" ; + # place a marker + push @tbuf, "§4$p\n" ; + push @pieces, "$p" ; + } + } + elsif ( /^[\s]*([^\s+=]+)[\s]*\=[\s]*(.*)$/o ) + { # makefile variable + if ( ( "$1" eq "subdir" ) + or ( "$1" eq "top_srcdir" ) + or ( "$1" eq "top_builddir" ) + or ( "$1" eq "RTEMS_ROOT" ) + or ( "$1" eq "PROJECT_ROOT" ) + or ( "$1" eq "INSTALL" ) + or ( "$1" eq "PACKHEX" ) + or ( "$1" eq "INSTALL_CHANGE" ) + or ( "$1" eq "mkinstalldirs" ) + ) + { + print STDERR "REMOVE: $1\n" if $verbose ; + } + elsif ( "$1" eq "srcdir" ) + { # place marker + push @tbuf, "§0\n"; + } + elsif ( "$1" eq "INSTALLDIRS" ) + { # process the block + my $input = $2 ; + $input =~ s/\\\\/ /g ; + my @l = split(' ',$input); + foreach (@l) + { + if ( /[\s]*([^\s]+)[\s]*$/o ) + { + push @installdirs, "$1" ; + } + } + } + else + { +# print STDERR "MACRO: <$1> = <$2>\n"; + my $p = "$1" ; + ${"var_$p"}="$2" ; + # place a marker + push @tbuf, "§4$p\n" ; + push @vars, "$p" ; + } + } + elsif ( /^[\s]*([^\s+=]+)[\s]*\+\=[\s]*(.*)$/o ) + { # makefile variable addition +# print STDERR "MACRO: <$1> += <$2>\n"; + my $p = "$1" ; + ${"var_$p+"}="$2" ; + # place a marker + push @tbuf, "§5$p\n" ; + push @vars, "$p+" ; + } + elsif ( /^[\s]*(\@[^\s]+\@)$/o ) + { # autoconf variable + if ( "$1" eq "\@SET_MAKE\@" ) + { + } + else + { + push @tbuf, "$1\n" ; + } + } + elsif ( /^[\s]*include[\s]+(.*)$/o ) + { # include line + push @tbuf, "$_" ; + if ( /^include[\s\t]*.*(directory|leaf|lib)\.cfg.*$/o ) + { + push @tbuf, "§1\n" ; + push @tbuf, "PACKHEX = \@PACKHEX\@\n" if ( $make_exe_seen == 1 ) ; + push @tbuf, "§2\n" ; + } + } + elsif ( /^[\s]*(ifeq|ifneq|else|endif)[\s]+(.*)$/o ) + { # gmake conditionals + # Most of them are removed, but we still have some :- + push @tbuf, "$1 $2\n" ; + } + elsif ( /^[\s]*([^:]+)[\s]*(:[:]*)[\s]*(.*)$/o ) + { + if ( "$2" eq "::" ) + { + # Warn about "::"-rules + # Will be silently removed below. + print STDERR "WARNING: Removing \"::\" in RULE $_\n" ; + } + + if ( ( "$1" eq "Makefile" ) + or ( "$1" eq "\$\(INSTALLDIRS\)" ) ) + { # delete entry + shift @buffer ; + } + elsif ( ( "$1" eq "all" ) + or ( "$1" eq "preinstall" ) ) + { + # Note the dependencies + # Not yet exploited, but could be useful for dependency + # tracking in future + if ( defined ${"var_$1"} ) + { ${"var_$1"} .= " $3" ; } + else + { ${"var_$1"} = "$3" ; } + push @tbuf, "$1: $3\n" ; + } + else + { # make rule + push @tbuf, "$1: $3\n" ; + } + } + elsif ( /^[\s]*$/o ) + { # empty line + push @tbuf, "\n" ; + } + else + { + die "PASS 2: Unhandled $_" ; + } } - else + @buffer = @tbuf ; + purge \@installdirs ; + purge \@pieces ; +} + +# A fragment to debug conditionals +#foreach( @variants ) +#{ +# my $v = $_ ; +# print STDERR "VARIANT: $v\n"; +# foreach (@{"variants_${v}"}) +# { +# print STDERR "* $_\n;" ; +# } +#} + +# sanity check on *_FILES macros +# too fragile for the time being, +# therefore disabled by default +if ( $experimental > 1 ) +{ + foreach( @files ) { - print "$_" ; - $nl_seen = 0; + my $file = "$_" ; + my $line = ${"var_$_"} ; + $line =~ tr /\\/ /; + my @l = split(' ',$line); + my @o = () ; + foreach (@l) + { + if ( /^([^\.]+)\.([a-z]+)$/o ) + { + print STDERR "$file: *.$2 in $_\n" ; + } + elsif ( /^\$\(.*\)$/o ) + { + print STDERR "$file: REF: $_\n" ; + } + else + { + print STDERR "$file: UNHANDLED: $_\n" ; + } + } } -} # while +} + +# print STDERR "PASS 2: @buffer" ; -print "\n" if $nl_seen < 1 ; +{ +# PASS 3: +# * output to new Makefile +# * prettyprint newlines + + my $nl_seen = 0 ; + foreach ( @buffer ) + { + if ( /^$/o ) + { + $nl_seen++ ; + print "\n" if ( $nl_seen < 2 ); + } + elsif ( /^\§0$/o ) + { + print "\@SET_MAKE\@\n" ; + print "srcdir = \@srcdir\@\n" ; + print "top_srcdir = \@top_srcdir\@\n" ; + print "top_builddir = $top_builddir\n" ; + print "subdir = $subdir\n" if "$subdir" ; + print "\nRTEMS_ROOT = \@RTEMS_ROOT\@\n" ; + print "PROJECT_ROOT = \@PROJECT_ROOT\@\n\n" ; + $nl_seen = 1 ; + } + elsif ( /^\§1$/o ) + { + print "\n" ; + print "INSTALL = \@INSTALL\@\n" if ( $install_seen > 0 ); + print "INSTALL_CHANGE = \@INSTALL_CHANGE\@\n" ; + $nl_seen = 0 ; + } + elsif ( /^\§2$/o ) + { # Handle installdirs related items + if ( $#installdirs >= 0 ) + { + print "mkinstalldirs = \$(SHELL) \$(top_srcdir)/\@RTEMS_TOPdir\@/mkinstalldirs\n\n" ; + my $line = join( ' ',@installdirs ); + print_macro "INSTALLDIRS =", $line ; + print "\n\$(INSTALLDIRS):\n\t\@\$(mkinstalldirs) \$(INSTALLDIRS)\n\n" ; + $nl_seen = 1 ; + } + } + elsif ( /^\§3(.*)$/o ) + { # pretty print a shell script fragment/make production + my @l = split(/\\\\/,$1); + if ( $#l >= 0 ) { my $i = shift @l ; print "\t$i"; } + foreach( @l ) { print "\\\n$_"; } + print "\n" ; + $nl_seen = 0 ; + } + elsif ( /^\§4(.*)$/o ) + { # pretty print a make variable + print_macro "$1 =", ${"var_$1"} ; + $nl_seen = 0 ; + } + elsif ( /^\§5(.*)$/o ) + { # pretty print an addition to a make variable + print_macro "$1 +=", ${"var_$1+"} ; + $nl_seen = 0 ; + } + else + { + $nl_seen = 0 ; + print "$_" ; + } + } +} # Add rules for config.status generated files if ( "$build_pgms_seen" ) @@ -164,7 +601,7 @@ print "\$@ CONFIG_HEADERS= \$(SHELL) ./config.status\n"; } else { -print "Makefile: \$(srcdir)/Makefile.in \$(top_builddir)/config.status\n" ; +print "Makefile: \@MAINTAINER_MODE_TRUE\@ \$(srcdir)/Makefile.in \$(top_builddir)/config.status\n" ; print " cd \$(top_builddir) \\\n" ; print " && CONFIG_FILES=" ; print "\$(subdir)/" if ( "$subdir" ); diff --git a/tools/update/ampolish b/tools/update/ampolish index c105f9e7b5..1fb5c3341f 100755 --- a/tools/update/ampolish +++ b/tools/update/ampolish @@ -48,6 +48,10 @@ my $rtems_cfg = find_file(".","configure.in"); # find relative up-path from configure.in to VERSION my $rtems_top = find_file("$rtems_cfg","VERSION"); +if ( "$rtems_top" eq "." ) +{ $rtems_top = "" ; } +else { $rtems_top .= "/" ; } + my $nl_seen = 0 ; while( <> ) @@ -56,30 +60,33 @@ while( <> ) print "$_" ; } -print "\nAUTOMAKE_OPTIONS = foreign\n"; +print "\nAUTOMAKE_OPTIONS = foreign 1.4\n"; if ( "$rtems_cfg" eq "." ) { - print "ACLOCAL = \@ACLOCAL\@ -I \$(RTEMS_TOPdir)/aclocal\n" + print "ACLOCAL_AMFLAGS = -I \$(RTEMS_TOPdir)/aclocal\n" } while( <> ) { - if ( /^[ ]*$/o ) + if ( /^[\s\t]*$/o ) { $nl_seen = $nl_seen+1; } - if ( /^[ ]*AUTOMAKE_OPTIONS.*$/o ) + if ( /^[\s\t]*AUTOMAKE_OPTIONS.*$/o ) + { # remove the line + } + elsif ( /^[\s\t]*ACLOCAL[\s\t]*=[\s\t]*\@ACLOCAL\@.*$/o ) { # remove the line } - elsif ( /^[ ]*ACLOCAL[ ]*=[ ]*\@ACLOCAL\@.*$/o ) + elsif ( /^[\s\t]*ACLOCAL_AMFLAGS[\s\t]*=[\s\t]*.*$/o ) { # remove the line } - elsif ( /^[ ]*include[ ]*\$\(top_srcdir\)[\.\/]*automake\/(.*)\.am$/o ) + elsif ( /^[\s\t]*include[\s\t]*\$\(top_srcdir\)[\.\/]*automake\/(.*)\.am$/o ) { # remove the line } - elsif ( /^[ ]*SUBDIRS.*$/o ) + elsif ( /^[\s\t]*SUBDIRS.*$/o ) { $subdirs_seen = "yes" ; print "$_" ; @@ -98,8 +105,8 @@ while( <> ) if ( "$subdirs_seen" ) { - print "include \$(top_srcdir)/${rtems_top}/automake/subdirs.am\n" ; + print "include \$(top_srcdir)/${rtems_top}automake/subdirs.am\n" ; } -print "include \$(top_srcdir)/${rtems_top}/automake/local.am\n" ; +print "include \$(top_srcdir)/${rtems_top}automake/local.am\n" ; ;1 diff --git a/tools/update/configure b/tools/update/configure index a90a59a561..b2cb7845f5 100644 --- a/tools/update/configure +++ b/tools/update/configure @@ -13,6 +13,9 @@ ac_default_prefix=/usr/local # Any additions from configure.in: ac_help="$ac_help --with-target-subdir=DIR" +ac_help="$ac_help + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -554,12 +557,8 @@ fi RTEMS_TOPdir="../.."; -PROJECT_ROOT=`pwd`/$RTEMS_TOPdir; -test "$TARGET_SUBDIR" = "." || PROJECT_ROOT="$PROJECT_ROOT/.." - - echo $ac_n "checking for RTEMS Version""... $ac_c" 1>&6 -echo "configure:563: checking for RTEMS Version" >&5 +echo "configure:562: checking for RTEMS Version" >&5 if test -r "${srcdir}/${RTEMS_TOPdir}/VERSION"; then RTEMS_VERSION=`grep Version ${srcdir}/${RTEMS_TOPdir}/VERSION | \ sed -e 's%RTEMS[ ]*Version[ ]*\(.*\)[ ]*%\1%g'` @@ -571,9 +570,6 @@ if test -z "$RTEMS_VERSION"; then fi echo "$ac_t""$RTEMS_VERSION" 1>&6 -RTEMS_ROOT='$(top_srcdir)'/$RTEMS_TOPdir; - - # Make sure we can run config.sub. @@ -582,7 +578,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:586: checking host system type" >&5 +echo "configure:582: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -615,7 +611,7 @@ echo "$ac_t""$host" 1>&6 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:619: checking for a BSD compatible install" >&5 +echo "configure:615: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -668,7 +664,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:672: checking whether build environment is sane" >&5 +echo "configure:668: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile @@ -725,7 +721,7 @@ test "$program_suffix" != NONE && test "$program_transform_name" = "" && program_transform_name="s,x,x," echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:729: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:725: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -764,7 +760,7 @@ fi missing_dir=`cd $ac_aux_dir && pwd` echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 -echo "configure:768: checking for working aclocal" >&5 +echo "configure:764: checking for working aclocal" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -777,7 +773,7 @@ else fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:781: checking for working autoconf" >&5 +echo "configure:777: checking for working autoconf" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -790,7 +786,7 @@ else fi echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:794: checking for working automake" >&5 +echo "configure:790: checking for working automake" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -803,7 +799,7 @@ else fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:807: checking for working autoheader" >&5 +echo "configure:803: checking for working autoheader" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -816,7 +812,7 @@ else fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:820: checking for working makeinfo" >&5 +echo "configure:816: checking for working makeinfo" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -829,6 +825,29 @@ else fi +echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 +echo "configure:830: checking whether to enable maintainer-specific portions of Makefiles" >&5 + # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval="$enable_maintainer_mode" + USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi + + echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6 + + +if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + MAINT=$MAINTAINER_MODE_TRUE + + for ac_prog in bash ksh sh @@ -836,7 +855,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:840: checking for $ac_word" >&5 +echo "configure:859: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_KSH'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -881,7 +900,7 @@ fi # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:885: checking for $ac_word" >&5 +echo "configure:904: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -931,8 +950,27 @@ else fi +if test "$TARGET_SUBDIR" = "." ; then +PROJECT_ROOT=$RTEMS_TOPdir/'$(top_builddir)'; +else +PROJECT_ROOT=../$RTEMS_TOPdir/'$(top_builddir)' +fi + + +RTEMS_ROOT=$RTEMS_TOPdir/'$(top_builddir)'/c/$RTEMS_BSP + + +INSTALL_CHANGE="\$(KSH) \$(PROJECT_ROOT)/tools/build/install-if-change" + + +PACKHEX="\$(PROJECT_ROOT)/tools/build/packhex" + + + # tooldir='$(exec_prefix)/'$target_alias # Temporary work-around until building in source tree is supported + + tooldir='$(PROJECT_ROOT)' @@ -945,6 +983,11 @@ project_libdir='$(tooldir)/lib$(MULTISUBDIR)' project_bindir='$(tooldir)/bin' +rtems_bspdir='$(prefix)/${RTEMS_BSP}' + +rtems_makedir='$(prefix)/make' + + trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure @@ -1092,8 +1135,6 @@ s%@oldincludedir@%$oldincludedir%g s%@infodir@%$infodir%g s%@mandir@%$mandir%g s%@RTEMS_TOPdir@%$RTEMS_TOPdir%g -s%@PROJECT_ROOT@%$PROJECT_ROOT%g -s%@RTEMS_ROOT@%$RTEMS_ROOT%g s%@host@%$host%g s%@host_alias@%$host_alias%g s%@host_cpu@%$host_cpu%g @@ -1110,14 +1151,23 @@ s%@AUTOMAKE@%$AUTOMAKE%g s%@AUTOHEADER@%$AUTOHEADER%g s%@MAKEINFO@%$MAKEINFO%g s%@SET_MAKE@%$SET_MAKE%g +s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g +s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g +s%@MAINT@%$MAINT%g s%@KSH@%$KSH%g s%@PERL@%$PERL%g s%@PERL_TRUE@%$PERL_TRUE%g s%@PERL_FALSE@%$PERL_FALSE%g +s%@PROJECT_ROOT@%$PROJECT_ROOT%g +s%@RTEMS_ROOT@%$RTEMS_ROOT%g +s%@INSTALL_CHANGE@%$INSTALL_CHANGE%g +s%@PACKHEX@%$PACKHEX%g s%@tooldir@%$tooldir%g s%@project_includedir@%$project_includedir%g s%@project_libdir@%$project_libdir%g s%@project_bindir@%$project_bindir%g +s%@rtems_bspdir@%$rtems_bspdir%g +s%@rtems_makedir@%$rtems_makedir%g CEOF EOF diff --git a/tools/update/configure.in b/tools/update/configure.in index b270d7fef2..23a86f8b7e 100644 --- a/tools/update/configure.in +++ b/tools/update/configure.in @@ -10,6 +10,7 @@ RTEMS_TOP(../..) AC_CANONICAL_HOST AM_INIT_AUTOMAKE(rtems-update-tools,$RTEMS_VERSION,no) +AM_MAINTAINER_MODE RTEMS_PATH_KSH RTEMS_PATH_PERL diff --git a/tools/update/rtems-polish.sh b/tools/update/rtems-polish.sh index 7a693928d9..46c63b5aab 100755 --- a/tools/update/rtems-polish.sh +++ b/tools/update/rtems-polish.sh @@ -12,7 +12,7 @@ progname=`basename $0` -perltools=c/update-tools +perltools=tools/update ac_do="" am_do="" ci_do="" |