mirror of
https://github.com/t-crest/rtems.git
synced 2025-11-16 12:34:47 +00:00
2006-10-10 Ralf Corsepius <ralf.corsepius@rtems.org>
* ampolish3.im: Update.
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
2006-10-10 Ralf Corsepius <ralf.corsepius@rtems.org>
|
||||
|
||||
* ampolish3.im: Update.
|
||||
|
||||
2005-10-25 Ralf Corsepius <ralf.corsepius@rtems.org>
|
||||
|
||||
* ampolish3.in: Sync with private bleeding-edge .
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
sub replace($);
|
||||
sub print_dirstamp($$$);
|
||||
|
||||
# Predefined directory mappings
|
||||
# Predefined directory mappings:
|
||||
#
|
||||
# final-installation directory => temp installation directory
|
||||
my %dirmap = (
|
||||
'$(includedir)' => '$(PROJECT_INCLUDE)',
|
||||
@@ -23,9 +24,25 @@ my %dirmap = (
|
||||
'$(project_includedir)' => '$(PROJECT_INCLUDE)'
|
||||
);
|
||||
|
||||
# Conventions on automake primaries:
|
||||
#
|
||||
# *_HEADERS -> preinstall
|
||||
# noinst*_HEADERS -> noinst
|
||||
# noinst_*_LIBRARIES -> noinst
|
||||
# project_*_LIBRARIES -> tmpinstall
|
||||
# *_LIBRARIES -> ignore (no preinstallation)
|
||||
# dist_project_*_DATA -> preinstall (bsp_specs,linkcmds)
|
||||
# project_*_DATA -> tmpinstall (*.o, *.a)
|
||||
# dist_*_DATA -> ignore (no preinstallation)
|
||||
# *SCRIPTS -> ignore (no preinstallation)
|
||||
# noinst_*_PROGRAMS -> noinst
|
||||
# project_*_PROGRAMS -> tmpinstall
|
||||
# *_PROGRAMS -> ignore (no preinstallation)
|
||||
|
||||
## 1st pass: read in file
|
||||
my @buffer1 = () ;
|
||||
my %seen = ();
|
||||
my %predefs = ();
|
||||
|
||||
{
|
||||
my $mode = 0 ;
|
||||
@@ -55,7 +72,7 @@ my %seen = ();
|
||||
}
|
||||
}
|
||||
|
||||
#foreach my $l ( @buffer1 ) { print STDERR "1<$l>"; }
|
||||
#foreach my $l ( @buffer1 ) { print STDERR "1:<$l>"; }
|
||||
|
||||
# Filter out all Makefile code not relevant here
|
||||
my @buffer2 = ();
|
||||
@@ -67,135 +84,124 @@ foreach my $l ( @buffer1 ) {
|
||||
push @buffer2, "$l";
|
||||
$dirmap{"\$\($1\)"} = replace($2);
|
||||
} elsif ( $l =~ /^\s*noinst_(.*)\s*[\+]?\=(.*)$/o )
|
||||
{ #ignore: noinst_* are not relevant here.
|
||||
} elsif ( $l =~ /^\s*(nodist_|dist_|)(project_|)(include|lib)_(HEADERS|LIBRARIES)\s*\=(.*)/o )
|
||||
{
|
||||
#ignore: noinst_* are not relevant here.
|
||||
} elsif ( $l =~ /^\s*(nodist_|dist_|)(project_|)([a-zA-Z0-9_]+)_(HEADERS|LIBRARIES|DATA|SCRIPTS|PROGRAMS)\s*([\+]?\=)\s*(.*)/o )
|
||||
{
|
||||
push @buffer2, "$3dir = \$($3dir)\n";
|
||||
push @buffer2, "$l";
|
||||
} elsif ( $l =~ /^\s*(nodist_|dist_|)(project_|)([a-zA-Z0-9_]+)_(HEADERS)\s*[\+]?\=(.*)/o )
|
||||
{
|
||||
push @buffer2, "$l";
|
||||
} elsif ( $l =~ /^\s*(nodist_|dist_|)(project_[a-zA-Z0-9_]+)_(DATA|SCRIPTS|LIBRARIES|PROGRAMS)\s*[\+]?\=(.*)/o )
|
||||
{
|
||||
push @buffer2, "$l";
|
||||
if ( ( "$5" eq '=' ) ) {
|
||||
my $v = $dirmap{"\$\($3dir\)"};
|
||||
if ( $v =~ /\$\(PROJECT_[^\)]+\)$/ )
|
||||
{
|
||||
$predefs{"$v"} = 1;
|
||||
}
|
||||
}
|
||||
foreach my $f ( split(' ',$6) ) {
|
||||
push @buffer2, "$1$2$3_$4 +=$f\n";
|
||||
}
|
||||
} elsif ( $l =~ /^\s*(if|else|endif)\s*.*$/o )
|
||||
{ # conditionals
|
||||
push @buffer2, "$l";
|
||||
}
|
||||
}
|
||||
|
||||
# foreach my $l ( @buffer2 ) { print STDERR "$l"; }
|
||||
if ( $predefs{"\$(PROJECT_INCLUDE)"} ){
|
||||
unshift @buffer2, "includedir = \$(includedir)\n";
|
||||
}
|
||||
if ( $predefs{"\$(PROJECT_LIB)"} ){
|
||||
unshift @buffer2, "libdir = \$(libdir)\n";
|
||||
}
|
||||
|
||||
# foreach my $l ( @buffer2 ) { print STDERR "2:<$l>"; }
|
||||
|
||||
my @buffer3 = ();
|
||||
|
||||
foreach my $l ( @buffer2 ) {
|
||||
if ( $l =~ /^\s*([a-zA-Z0-9_]*dir)\s*\=\s*(.*)\s*$/o )
|
||||
if ( $l =~ /^\s*([a-zA-Z0-9_]*dir)\s*\=\s*(.*)\s*$/o )
|
||||
{ # dirs
|
||||
my $v = $dirmap{"\$\($1\)"};
|
||||
print_dirstamp(\@buffer3,$v,"PREINSTALL_DIRS");
|
||||
$seen{"PREINSTALL_DIRS"} = 1;
|
||||
} elsif ( $l =~ /^\s*(nodist_|)([a-zA-Z0-9_]*)_HEADERS\s*[\+]?\=(.*)$/o )
|
||||
{
|
||||
my $v = $dirmap{"\$\($2dir\)"};
|
||||
my @instfiles = split(' ',$3);
|
||||
foreach my $f ( @instfiles )
|
||||
{
|
||||
my $x ;
|
||||
my $i = rindex($f,'/');
|
||||
if ($i < 0) {
|
||||
$x="$f";
|
||||
} else {
|
||||
$x = substr($f,$i+1);
|
||||
}
|
||||
push @buffer3,
|
||||
} elsif ( $l =~ /^\s*(nodist_|dist_|)(project_|)([a-zA-Z0-9_]+)_HEADERS\s*\+\=(.*)/o )
|
||||
{ # preinstall
|
||||
my $v = $dirmap{"\$\($3dir\)"};
|
||||
my $f = $4;
|
||||
my $x ; my $i = rindex($f,'/');
|
||||
if ($i < 0) { $x="$f";
|
||||
} else { $x = substr($f,$i+1);
|
||||
}
|
||||
push @buffer3,
|
||||
"$v/$x: $f $v/\$(dirstamp)\n",
|
||||
"\t\$(INSTALL_DATA) \$< $v/$x\n",
|
||||
"PREINSTALL_FILES += $v/$x\n\n";
|
||||
$seen{"PREINSTALL_FILES"} = 1;
|
||||
}
|
||||
} elsif ( $l =~ /^\s*(nodist_|)([a-zA-Z0-9_]*)_SCRIPTS\s*[\+]?\=(.*)$/o )
|
||||
{
|
||||
my $v = $dirmap{"\$\($2dir\)"};
|
||||
my @instfiles = split(' ',$3);
|
||||
foreach my $f ( @instfiles )
|
||||
{
|
||||
my $x ;
|
||||
my $i = rindex($f,'/');
|
||||
if ($i < 0) {
|
||||
$x="$f";
|
||||
} else {
|
||||
$x = substr($f,$i+1);
|
||||
}
|
||||
push @buffer3,
|
||||
$seen{"PREINSTALL_FILES"} = 1;
|
||||
} elsif ( $l =~ /^\s*(nodist_|dist_|)(project_)([a-zA-Z0-9_]+)_LIBRARIES\s*\+\=(.*)/o )
|
||||
{ # tmpinstall
|
||||
my $v = $dirmap{"\$\($3dir\)"};
|
||||
my $f = $4;
|
||||
my $x ; my $i = rindex($f,'/');
|
||||
if ($i < 0) { $x="$f";
|
||||
} else { $x = substr($f,$i+1);
|
||||
}
|
||||
push @buffer3,
|
||||
"$v/$x: $f $v/\$(dirstamp)\n",
|
||||
"\t\$(INSTALL_SCRIPT) \$< $v/$x\n",
|
||||
"\t\$(INSTALL_DATA) \$< $v/$x\n",
|
||||
"TMPINSTALL_FILES += $v/$x\n\n";
|
||||
$seen{"TMPINSTALL_FILES"} = 1;
|
||||
} elsif ( $l =~ /^\s*(nodist_|dist_|)([a-zA-Z0-9_]+)_LIBRARIES\s*\+\=(.*)/o )
|
||||
{ # ignore
|
||||
} elsif ( $l =~ /^\s*(dist_)(project_)([a-zA-Z0-9_]+)_DATA\s*\+\=(.*)/o )
|
||||
{ # preinstall
|
||||
my $v = $dirmap{"\$\($3dir\)"};
|
||||
my $f = $4;
|
||||
my $x ; my $i = rindex($f,'/');
|
||||
if ($i < 0) { $x="$f";
|
||||
} else { $x = substr($f,$i+1);
|
||||
}
|
||||
push @buffer3,
|
||||
"$v/$x: $f $v/\$(dirstamp)\n",
|
||||
"\t\$(INSTALL_DATA) \$< $v/$x\n",
|
||||
"PREINSTALL_FILES += $v/$x\n\n";
|
||||
$seen{"PREINSTALL_FILES"} = 1;
|
||||
}
|
||||
} elsif ( $l =~ /^\s*(nodist_|)([a-zA-Z0-9_]*)_PROGRAMS\s*[\+]?\=(.*)$/o )
|
||||
{
|
||||
my $v = $dirmap{"\$\($2dir\)"};
|
||||
my @instfiles = split(' ',$3);
|
||||
foreach my $f ( @instfiles )
|
||||
{
|
||||
my $x ;
|
||||
my $i = rindex($f,'/');
|
||||
if ($i < 0) {
|
||||
$x="$f";
|
||||
} else {
|
||||
$x = substr($f,$i+1);
|
||||
}
|
||||
push @buffer3,
|
||||
$seen{"PREINSTALL_FILES"} = 1;
|
||||
} elsif ( $l =~ /^\s*(nodist_|)(project_)([a-zA-Z0-9_]+)_DATA\s*\+\=(.*)/o )
|
||||
{ # tmpinstall
|
||||
my $v = $dirmap{"\$\($3dir\)"};
|
||||
my $f = $4;
|
||||
my $x ; my $i = rindex($f,'/');
|
||||
if ($i < 0) { $x="$f";
|
||||
} else { $x = substr($f,$i+1);
|
||||
}
|
||||
push @buffer3,
|
||||
"$v/$x: $f $v/\$(dirstamp)\n",
|
||||
"\t\$(INSTALL_DATA) \$< $v/$x\n",
|
||||
"TMPINSTALL_FILES += $v/$x\n\n";
|
||||
$seen{"TMPINSTALL_FILES"} = 1;
|
||||
} elsif ( $l =~ /^\s*(dist_|)([a-zA-Z0-9_]+)_DATA\s*\+\=(.*)/o )
|
||||
{ # ignore
|
||||
} elsif ( $l =~ /^\s*(nodist_|dist_|)([a-zA-Z0-9_]+)_SCRIPTS\s*\+\=(.*)/o )
|
||||
{ # ignore
|
||||
} elsif ( $l =~ /^\s*(nodist_|dist_|)(project_)([a-zA-Z0-9_]+)_PROGRAMS\s*\+\=(.*)/o )
|
||||
{ # tmpinstall
|
||||
my $v = $dirmap{"\$\($3dir\)"};
|
||||
|
||||
my $f = $4;
|
||||
my $x ; my $i = rindex($f,'/');
|
||||
if ($i < 0) { $x="$f";
|
||||
} else { $x = substr($f,$i+1);
|
||||
}
|
||||
push @buffer3,
|
||||
"$v/$x: $f $v/\$(dirstamp)\n",
|
||||
"\t\$(INSTALL_PROGRAM) \$< $v/$x\n",
|
||||
"TMPINSTALL_FILES += $v/$x\n\n";
|
||||
$seen{"TMPINSTALL_FILES"} = 1;
|
||||
}
|
||||
} elsif ( $l =~ /^\s*(nodist_|)([a-zA-Z0-9_]*)_LIBRARIES\s*[\+]?\=(.*)$/o )
|
||||
{
|
||||
my $v = $dirmap{"\$\($2dir\)"};
|
||||
my @instfiles = split(' ',$3);
|
||||
foreach my $f ( @instfiles )
|
||||
{
|
||||
my $x ;
|
||||
my $i = rindex($f,'/');
|
||||
if ($i < 0) {
|
||||
$x="$f";
|
||||
} else {
|
||||
$x = substr($f,$i+1);
|
||||
}
|
||||
push @buffer3,
|
||||
"$v/$x: $f $v/\$(dirstamp)\n",
|
||||
"\t\$(INSTALL_DATA) \$< $v/$x\n",
|
||||
"TMPINSTALL_FILES += $v/$x\n\n";
|
||||
$seen{"TMPINSTALL_FILES"} = 1;
|
||||
}
|
||||
} elsif ( $l =~ /^\s*(nodist_|)([a-zA-Z0-9_]*)_DATA\s*[\+]?\=(.*)$/o )
|
||||
{
|
||||
my $v = $dirmap{"\$\($2dir\)"};
|
||||
my @instfiles = split(' ',$3);
|
||||
foreach my $f ( @instfiles )
|
||||
{
|
||||
my $x ;
|
||||
my $i = rindex($f,'/');
|
||||
if ($i < 0) {
|
||||
$x="$f";
|
||||
} else {
|
||||
$x = substr($f,$i+1);
|
||||
}
|
||||
push @buffer3,
|
||||
"$v/$x: $f $v/\$(dirstamp)\n",
|
||||
"\t\$(INSTALL_DATA) \$< $v/$x\n",
|
||||
"TMPINSTALL_FILES += $v/$x\n\n";
|
||||
$seen{"TMPINSTALL_FILES"} = 1;
|
||||
}
|
||||
$seen{"TMPINSTALL_FILES"} = 1;
|
||||
} elsif ( $l =~ /^\s*(nodist_|dist_|)([a-zA-Z0-9_]+)_PROGRAMS\s*\+\=(.*)/o )
|
||||
{ # ignore
|
||||
} elsif ( $l =~ /^\s*(if|else|endif)\s*.*$/o )
|
||||
{ # conditionals
|
||||
push @buffer3, "$l";
|
||||
}
|
||||
}
|
||||
|
||||
# foreach my $l ( @buffer3 ) { print STDERR "$l"; }
|
||||
# foreach my $l ( @buffer3 ) { print STDERR "3:<$l>"; }
|
||||
|
||||
my $output;
|
||||
$output .= "## Automatically generated by ampolish3 - Do not edit\n\n";
|
||||
|
||||
Reference in New Issue
Block a user