diff --git a/configure/tools/makeConfigAppInclude.pl b/configure/tools/makeConfigAppInclude.pl new file mode 100644 index 000000000..eb94b7c97 --- /dev/null +++ b/configure/tools/makeConfigAppInclude.pl @@ -0,0 +1,63 @@ +# $Id$ + +eval 'exec perl -S $0 ${1+"$@"}' # -*- Mode: perl -*- + if $running_under_some_shell; # makeConfigAppInclude.pl + +use Cwd; + +$arch = $ARGV[0]; +$outfile = $ARGV[1]; +$top = $ARGV[2]; + +unlink("${outfile}"); +open(OUT,">${outfile}") or die "$! opening ${outfile}"; +print OUT "#Do not modify this file.\n"; +print OUT "#This file is created during the build.\n"; + +@files =(); +push(@files,"$top/configure/RELEASE"); +push(@files,"$top/configure/RELEASE.${arch}"); +foreach $file (@files) { + if (-r "$file") { + open(IN, "$file") or die "Cannot open $file\n"; + while ($line = ) { + next if ( $line =~ /\s*#/ ); + chomp($line); + $_ = $line; + #the following looks for + # prefix = $(macro)post + ($prefix,$macro,$post) = /(.*)\s*=\s*\$\((.*)\)(.*)/; + if ($macro eq "") { # true if no macro is present + # the following looks for + # prefix = post + ($prefix,$post) = /(.*)\s*=\s*(.*)/; + } else { + $base = $applications{$macro}; + if ($base eq "") { + #print "error: $macro was not previously defined\n"; + } else { + $post = $base . $post; + } + } + $applications{$prefix} = $post; + if ( -d "$post") { #check that directory exists + print OUT "\n"; + if ( -d "$post/bin/$arch") { #check that directory exists + print OUT "${prefix}_BIN = $post/bin/${arch}\n"; + } + if ( -d "$post/lib/$arch") { #check that directory exists + print OUT "${prefix}_LIB = $post/lib/${arch}\n"; + } + if ( -d "$post/include") { #check that directory exists + print OUT "INSTALL_INCLUDES += -I$post/include\n"; + } + if ( -d "$post/dbd") { #check that directory exists + print OUT "INSTALL_DBDFLAGS += -I $post/dbd\n"; + } + } + } + close IN; + } +} +close OUT; + diff --git a/configure/tools/makeDbDepends.pl b/configure/tools/makeDbDepends.pl new file mode 100644 index 000000000..bb8042bb8 --- /dev/null +++ b/configure/tools/makeDbDepends.pl @@ -0,0 +1,23 @@ +eval 'exec perl -S $0 ${1+"$@"}' # -*- Mode: perl -*- + if $running_under_some_shell; # makeDbDepends.pl + +# Called from within the object directory. +# Searches the .substitutions files (from the command line) for +# "file xxx {" entries to create a DEPENDS file + +open(OUT, ">DEPENDS") or die "Cannot open DEPENDS: $!"; + +foreach $file (@ARGV) { + open(IN, "<$file") or die "Cannot open $file: $!"; + @substfile = ; + close IN or die "Cannot close $file: $!"; + + @depends = grep { s/^\s*file\s*(.*)\s*\{.*$/\1/ } @substfile; + chomp @depends; + + if (@depends) { + $file =~ s/\.substitutions/\.t.db.raw/; + print OUT "${file}:: @depends\n"; + } +} +close OUT or die "Cannot close $file: $!"; diff --git a/configure/tools/makeIocCdCommands.pl b/configure/tools/makeIocCdCommands.pl new file mode 100644 index 000000000..090aadec9 --- /dev/null +++ b/configure/tools/makeIocCdCommands.pl @@ -0,0 +1,60 @@ +eval 'exec perl -S $0 ${1+"$@"}' # -*- Mode: perl -*- + if $running_under_some_shell; # makeIocCdCommands.pl + +use Cwd; + +$cwd = cwd(); +#hack for sun4 +$cwd =~ s|/tmp_mnt||; +$arch = $ARGV[0]; + +unlink("cdCommands"); +open(OUT,">cdCommands") or die "$! opening cdCommands"; +print OUT "startup = \"$cwd\"\n"; + +#appbin is kept for compatibility with 3.13.1 +$appbin = $cwd; +$appbin =~ s/iocBoot.*//; +$appbin = $appbin . "/bin/${arch}"; +print OUT "appbin = \"$appbin\"\n"; + +$top = $cwd; +$top =~ s/\/iocBoot.*//; +print OUT "top = \"$top\"\n"; +$topbin = "${top}/bin/${arch}"; +#skip check that top/bin/${arch} exists; src may not have been builT +print OUT "topbin = \"$topbin\"\n"; +$release = "$top/configure/RELEASE"; +if (-r "$release") { + open(IN, "$release") or die "Cannot open $release\n"; + while ($line = ) { + next if ( $line =~ /\s*#/ ); + chomp($line); + $_ = $line; + #the following looks for + # prefix = $(macro)post + ($prefix,$macro,$post) = /(.*)\s*=\s*\$\((.*)\)(.*)/; + if ($macro eq "") { # true if no macro is present + # the following looks for + # prefix = post + ($prefix,$post) = /(.*)\s*=\s*(.*)/; + } else { + $base = $applications{$macro}; + if ($base eq "") { + print "error: $macro was not previously defined\n"; + } else { + $post = $base . $post; + } + } + $applications{$prefix} = $post; + $app = lc($prefix); + if ( -d "$post") { #check that directory exists + print OUT "$app = \"$post\"\n"; + } + if ( -d "$post/bin/$arch") { #check that directory exists + print OUT "${app}bin = \"$post/bin/$arch\"\n"; + } + } + close IN; +} +close OUT; diff --git a/configure/tools/makeMakefile.pl b/configure/tools/makeMakefile.pl index 70aa9b922..29f5c919a 100755 --- a/configure/tools/makeMakefile.pl +++ b/configure/tools/makeMakefile.pl @@ -5,23 +5,37 @@ # called from RULES_ARCHS # # -# Usage: perl makeMakefile.pl O.*-dir b_t top +# Usage: perl makeMakefile.pl O.*-dir top Makefile-Type $dir = $ARGV[0]; -$t_a= $ARGV[1]; -$top= $ARGV[2]; -$b_t = $ARGV[3]; +$top= $ARGV[1]; +$type = $ARGV[2]; $makefile="$dir/Makefile"; +$b_t=""; + +if ($type ne "") +{ + $b_t = "B_T=$type"; +} + +if ($dir =~ m'O.(.+)') +{ + $t_a = $1; +} +else +{ + die "Cannot extract T_A from $dir"; +} mkdir ($dir, 0777) unless -d $dir; open OUT, "> $makefile" or die "Cannot create $makefile"; -print OUT "#This Makefile created by makeMakefiles.pl\n\n\n"; +print OUT "#This Makefile created by makeMakefile.pl\n\n\n"; print OUT "all :\n"; -print OUT " \$(MAKE) -f ../Makefile.$b_t TOP=../$top T_A=$t_a B_T=$b_t \$@\n\n"; +print OUT " \$(MAKE) -f ../Makefile$type TOP=$top T_A=$t_a $b_t \$@\n\n"; print OUT ".DEFAULT: force\n"; -print OUT " \$(MAKE) -f ../Makefile.$b_t TOP=../$top T_A=$t_a B_T=$b_t \$@\n\n"; +print OUT " \$(MAKE) -f ../Makefile$type TOP=$top T_A=$t_a $b_t \$@\n\n"; print OUT "force: ;\n"; close OUT; diff --git a/configure/tools/replaceVAR.pl b/configure/tools/replaceVAR.pl new file mode 100755 index 000000000..e87474007 --- /dev/null +++ b/configure/tools/replaceVAR.pl @@ -0,0 +1,12 @@ +eval 'exec perl -S $0 ${1+"$@"}' # -*- Mode: perl -*- + if $running_under_some_shell; # replaceVAR.pl + +# Called from within the object directory +# Replaces VAR(xxx) with $(xxx) +# and VAR_xxx_ with $(xxx) + +while () { + s/VAR\(/\$\(/g; + s/VAR_([^_]*)_/\$\($1\)/g; + print; +}