Moved configure/tools files to src/tools directory.

This commit is contained in:
Janet B. Anderson
2008-03-24 22:17:06 +00:00
parent 678dec4100
commit 1ff1ba637e
20 changed files with 174 additions and 70 deletions
+67
View File
@@ -0,0 +1,67 @@
#*************************************************************************
# Copyright (c) 2002 The University of Chicago, as Operator of Argonne
# National Laboratory.
# Copyright (c) 2002 The Regents of the University of California, as
# Operator of Los Alamos National Laboratory.
# EPICS BASE Versions 3.13.7
# and higher are distributed subject to a Software License Agreement found
# in file LICENSE that is included with this distribution.
#*************************************************************************
TOP=../..
include $(TOP)/configure/CONFIG
############## START TEST
CFGS = RULES1 RULES2 RULES3
JBAJBAJBAS += aa bb cc
############## END TEST
EXPANDFLAGS = -t $(TOP) -D ARCH=$(T_A)
# Bootstrap resolution: tools not installed yet
TOOLS = $(TOP)/src/tools
# Bootstrap resolution: expandVars.pl needs to be run on itself!
EXPAND_VARS = $(PERL) ../expandVars.pl@
EXPAND += expandVars.pl@
PERL_MODULES += Ctlsys/Utils.pm
PERL_MODULES += Ctlsys/Getopts.pm
PERL_SCRIPTS += convertRelease.pl*
PERL_SCRIPTS += cp.pl*
PERL_SCRIPTS += cvsclean.pl*
PERL_SCRIPTS += dos2unix.pl
PERL_SCRIPTS += expandVars.pl
PERL_SCRIPTS += filterWarnings.pl*
PERL_SCRIPTS += fullPathName.pl*
PERL_SCRIPTS += installEpics.pl*
PERL_SCRIPTS += makeDbDepends.pl
PERL_SCRIPTS += makeIncludeDbd.pl
PERL_SCRIPTS += makeMakefile.pl*
PERL_SCRIPTS += makeMakefileInclude.pl*
PERL_SCRIPTS += mkdir.pl*
PERL_SCRIPTS += mkmf.pl*
PERL_SCRIPTS += munch.pl*
PERL_SCRIPTS += mv.pl*
PERL_SCRIPTS += replaceVAR.pl*
PERL_SCRIPTS += rm.pl*
PERL_SCRIPTS += useManifestTool.pl*
include $(TOP)/configure/RULES
xxx:
@echo "CFGS=$(CFGS)"
@echo "DIRECTORY_TARGETS=$(DIRECTORY_TARGETS)"
@echo "INSTALLS_CFG=$(INSTALLS_CFG)"
@echo "JBA_RULES=$(JBA_RULES)"
@echo "JBA=$(JBA)"
@echo "DIRECTORY_TARGETS=$(DIRECTORY_TARGETS)"
@echo "INSTALL_PERL_MODULES=$(INSTALL_PERL_MODULES)"
@echo "INSTALL_PERL_SCRIPTS=$(INSTALL_PERL_SCRIPTS)"
@echo "RELEASE_TOPS=$(RELEASE_TOPS)"
@echo "FILE_TYPE=$(FILE_TYPE)"
@echo "INSTALL_JBAJBAJBA=$(INSTALL_JBAJBAJBA)"
@echo "DIRECTORY_TARGETS=$(DIRECTORY_TARGETS)"
@@ -63,8 +63,7 @@ unless (@ARGV == 1) {
print "\tcheckRelease - checks consistency with support apps\n";
print "\tcdCommands - generate cd path strings for vxWorks IOCs\n";
print "\tenvPaths - generate epicsEnvSet commands for other IOCs\n";
print "\tCONFIG_APP_INCLUDE - additional build variables\n";
print "\tRULES_INCLUDE - supports installable build rules\n";
print "\tSTDOUT - prints modules names defined in RELEASE*s\n";
exit 2;
}
$outfile = $ARGV[0];
@@ -82,14 +81,24 @@ die "Can't find $relfile" unless (-f $relfile);
# This is a perl switch statement:
for ($outfile) {
/CONFIG_APP_INCLUDE/ and do { &configAppInclude; last; };
/RULES_INCLUDE/ and do { &rulesInclude; last; };
/STDOUT/ and do { &releaseTops; last; };
/cdCommands/ and do { &cdCommands; last; };
/envPaths/ and do { &envPaths; last; };
/checkRelease/ and do { &checkRelease; last; };
die "Output file type \'$outfile\' not supported";
}
#
# Print names of the modules defined in RELEASE* files
#
sub releaseTops {
my @includes = grep !/^(TOP|TEMPLATE_TOP)$/, @apps;
foreach my $app (@includes) {
print "$app ";
}
print "\n";
}
#
# Parse all relevent configure/RELEASE* files and includes
#
@@ -167,72 +176,6 @@ sub expandRelease {
}
}
sub configAppInclude {
# We can't include TOP in these output lists:
# 1. Our target directories probably don't exist yet
# 2. We need abolute paths, but $(TOP) is relative
my @includes = grep !/^(TOP|TEMPLATE_TOP)$/, @apps;
unlink($outfile);
open(OUT,">$outfile") or die "$! creating $outfile";
print OUT "# Do not modify this file, changes made here will\n";
print OUT "# be lost when the application is next rebuilt.\n";
if ($arch) {
print OUT "\nexport TOP\n";
}
foreach my $app (@includes) {
my $path = $macros{$app};
print OUT "\nexport ${app}\n";
if (-d "$path/bin/$hostarch") {
print OUT "${app}_HOST_BIN = $path/bin/\$(EPICS_HOST_ARCH)\n";
}
if (-d "$path/lib/$hostarch") {
print OUT "${app}_HOST_LIB = $path/bin/\$(EPICS_HOST_ARCH)\n";
}
if ($arch) {
if (-d "$path/bin/$arch") {
print OUT "${app}_BIN = $path/bin/$arch\n";
}
if (-d "$path/lib/$arch") {
print OUT "${app}_LIB = $path/lib/$arch\n";
print OUT "SHRLIB_SEARCH_DIRS += $path/lib/$arch\n";
}
}
if (-d "$path/include") {
if (-d "$path/include/os") {
print OUT "RELEASE_INCLUDES += -I$path/include/os/\$(OS_CLASS)\n";
}
print OUT "RELEASE_INCLUDES += -I$path/include\n";
}
if (-d "$path/dbd") {
print OUT "RELEASE_DBDFLAGS += -I$path/dbd\n";
}
if (-d "$path/db") {
print OUT "RELEASE_DBFLAGS += -I$path/db\n";
}
}
close OUT;
}
sub rulesInclude {
my @includes = grep !/^(TOP|TEMPLATE_TOP|EPICS_BASE)$/, @apps;
unlink($outfile);
open(OUT,">$outfile") or die "$! creating $outfile";
print OUT "# Do not modify this file, changes made here will\n";
print OUT "# be lost when the application is next rebuilt.\n";
foreach my $app (@includes) {
my $path = $macros{$app};
next unless (-r "$path/configure/RULES_BUILD");
print OUT "\nRULES_TOP := $path\n";
print OUT "-include $path/configure/RULES_BUILD\n";
}
print OUT "\nRULES_TOP :=\n";
close OUT;
}
sub cdCommands {
die "Architecture not set (use -a option)" unless ($arch);
my @includes = grep !/^TEMPLATE_TOP$/, @apps;
View File
+94
View File
@@ -0,0 +1,94 @@
#!/usr/bin/perl
#
# Tool to expand @VAR@ variables while copying a file.
# The file will *not* be copied if it already exists.
#
# Author: Andrew Johnson <anj@aps.anl.gov>
# Date: 10 February 2005
#
# $Id$
#
# This BEGIN allows Perl to find the ctlsysUtils.pl module when
# the program gets run in one of its O.<arch> directories. If
# the TOP variable has not been expanded, we look in our own
# parent directory for ctlsysUtils.pl instead of <top>/lib/perl
# Do not use the code below for other perl tools that use modules,
# makeCtlsysDir.pl@ has the regular Perl code for setting @INC.
BEGIN {
our $libperl = '@TOP@/lib/perl';
$libperl = '..' if ($libperl =~ m/^[@]TOP[@]/);
}
use lib $libperl;
use strict;
use Cwd qw(cwd abs_path);
use Ctlsys::Getopts;
use Ctlsys::Utils;
# Command line options processing
our ($opt_d, @opt_D, $opt_h, $opt_t);
Usage() unless getopts('dD@ht:');
# Handle the -h command
Usage() if $opt_h;
# Check filename arguments
our $infile = shift or die "No input filename argument\n";
our $outfile = shift or die "No output filename argument\n";
# Where are we?
our $top = $opt_t;
print "TOP = $top\n" if $opt_d;
# Read RELEASE file into vars
our ($base, $extensions, $ctlsys);
our %vars = (TOP => abs_path($top));
our @apps = ('TOP');
readRelease("$top/configure/RELEASE", \%vars, \@apps);
expandRelease(\%vars);
# EPICS_BASE and EPICS_EXTENSIONS must exist
$base = abs_path($vars{EPICS_BASE});
print "EPICS_BASE = $base\n" if $opt_d;
die "EPICS_BASE directory '$base' does not exist\n"
unless -d $base;
$extensions = abs_path($vars{EPICS_EXTENSIONS});
print "EPICS_EXTENSIONS = $extensions\n" if $opt_d;
die "EPICS_EXTENSIONS directory '$extensions' does not exist\n"
unless -d $extensions;
# If no CTLSYS entry exists, define it as TOP
if (exists $vars{CTLSYS}) {
$ctlsys = abs_path($vars{CTLSYS});
} else {
$ctlsys = abs_path($top);
$vars{CTLSYS} = $ctlsys;
}
print "CTLSYS = $ctlsys\n" if $opt_d;
die "CTLSYS directory '$ctlsys' does not exist\n"
unless -d $ctlsys;
while ($_ = shift @opt_D) {
my ($var, $val) = split /=/;
$vars{$var} = $val;
print "$var = $val\n" if $opt_d;
}
# Do it!
copyFile($infile, $outfile, \%vars);
##### File contains subroutines only below here
sub Usage {
print <<EOF;
Usage:
expandVars.pl -h
Display this Usage message
expandVars.pl -t /path/to/top -D var=value infile outfile
Expand vars in infile to generate outfile
EOF
exit $opt_h ? 0 : 1;
}
View File
View File
View File
View File
View File