summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorRalf Corsepius <ralf.corsepius@rtems.org>2006-01-10 17:51:03 +0000
committerRalf Corsepius <ralf.corsepius@rtems.org>2006-01-10 17:51:03 +0000
commit7dd22c32e99cc6ccfc001fe19de302be69ac3715 (patch)
tree5a9ceddb3f721c44349f33718c08659739495999 /tools
parent445b9740dfb042f3183f8b91238eee00534e9621 (diff)
2006-10-10 Ralf Corsepius <ralf.corsepius@rtems.org>
* ampolish3.im: Update.
Diffstat (limited to 'tools')
-rw-r--r--tools/build/ChangeLog4
-rwxr-xr-xtools/build/ampolish3.in206
2 files changed, 110 insertions, 100 deletions
diff --git a/tools/build/ChangeLog b/tools/build/ChangeLog
index 85168924a5..28f0a801b4 100644
--- a/tools/build/ChangeLog
+++ b/tools/build/ChangeLog
@@ -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 .
diff --git a/tools/build/ampolish3.in b/tools/build/ampolish3.in
index 4a5456e53b..b2b19628f6 100755
--- a/tools/build/ampolish3.in
+++ b/tools/build/ampolish3.in
@@ -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,
- "$v/$x: $f $v/\$(dirstamp)\n",
- "\t\$(INSTALL_SCRIPT) \$< $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_|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_PROGRAM) \$< $v/$x\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_]*)_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,
+ $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",
- "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,
+ "PREINSTALL_FILES += $v/$x\n\n";
+ $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;
- }
+ $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_|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";