From 1ff1ba637ebe4c51f237ba880c3466f5224bf102 Mon Sep 17 00:00:00 2001 From: "Janet B. Anderson" Date: Mon, 24 Mar 2008 22:17:06 +0000 Subject: [PATCH] Moved configure/tools files to src/tools directory. --- src/tools/Makefile | 67 +++++++++++++ {configure => src}/tools/convertRelease.pl | 83 +++------------- {configure => src}/tools/cp.pl | 0 {configure => src}/tools/cvsclean.pl | 0 {configure => src}/tools/dos2unix.pl | 0 src/tools/expandVars.pl@ | 94 +++++++++++++++++++ {configure => src}/tools/filterWarnings.pl | 0 {configure => src}/tools/fullPathName.pl | 0 {configure => src}/tools/installEpics.pl | 0 {configure => src}/tools/makeDbDepends.pl | 0 {configure => src}/tools/makeIncludeDbd.pl | 0 {configure => src}/tools/makeMakefile.pl | 0 .../tools/makeMakefileInclude.pl | 0 {configure => src}/tools/mkdir.pl | 0 {configure => src}/tools/mkmf.pl | 0 {configure => src}/tools/munch.pl | 0 {configure => src}/tools/mv.pl | 0 {configure => src}/tools/replaceVAR.pl | 0 {configure => src}/tools/rm.pl | 0 {configure => src}/tools/useManifestTool.pl | 0 20 files changed, 174 insertions(+), 70 deletions(-) create mode 100644 src/tools/Makefile rename {configure => src}/tools/convertRelease.pl (78%) rename {configure => src}/tools/cp.pl (100%) mode change 100755 => 100644 rename {configure => src}/tools/cvsclean.pl (100%) rename {configure => src}/tools/dos2unix.pl (100%) create mode 100644 src/tools/expandVars.pl@ rename {configure => src}/tools/filterWarnings.pl (100%) rename {configure => src}/tools/fullPathName.pl (100%) rename {configure => src}/tools/installEpics.pl (100%) mode change 100755 => 100644 rename {configure => src}/tools/makeDbDepends.pl (100%) rename {configure => src}/tools/makeIncludeDbd.pl (100%) rename {configure => src}/tools/makeMakefile.pl (100%) mode change 100755 => 100644 rename {configure => src}/tools/makeMakefileInclude.pl (100%) rename {configure => src}/tools/mkdir.pl (100%) mode change 100755 => 100644 rename {configure => src}/tools/mkmf.pl (100%) rename {configure => src}/tools/munch.pl (100%) rename {configure => src}/tools/mv.pl (100%) mode change 100755 => 100644 rename {configure => src}/tools/replaceVAR.pl (100%) rename {configure => src}/tools/rm.pl (100%) mode change 100755 => 100644 rename {configure => src}/tools/useManifestTool.pl (100%) diff --git a/src/tools/Makefile b/src/tools/Makefile new file mode 100644 index 000000000..e445aaa4c --- /dev/null +++ b/src/tools/Makefile @@ -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)" + diff --git a/configure/tools/convertRelease.pl b/src/tools/convertRelease.pl similarity index 78% rename from configure/tools/convertRelease.pl rename to src/tools/convertRelease.pl index 53c072fe8..6a23e0b05 100755 --- a/configure/tools/convertRelease.pl +++ b/src/tools/convertRelease.pl @@ -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; diff --git a/configure/tools/cp.pl b/src/tools/cp.pl old mode 100755 new mode 100644 similarity index 100% rename from configure/tools/cp.pl rename to src/tools/cp.pl diff --git a/configure/tools/cvsclean.pl b/src/tools/cvsclean.pl similarity index 100% rename from configure/tools/cvsclean.pl rename to src/tools/cvsclean.pl diff --git a/configure/tools/dos2unix.pl b/src/tools/dos2unix.pl similarity index 100% rename from configure/tools/dos2unix.pl rename to src/tools/dos2unix.pl diff --git a/src/tools/expandVars.pl@ b/src/tools/expandVars.pl@ new file mode 100644 index 000000000..c7a7ed5b2 --- /dev/null +++ b/src/tools/expandVars.pl@ @@ -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 +# 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. directories. If +# the TOP variable has not been expanded, we look in our own +# parent directory for ctlsysUtils.pl instead of /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 <