From b9fb6caffb30d0c3ae76b9ca0f706caac27b8a1c Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 23 Jul 2003 22:08:50 +0000 Subject: [PATCH] Added envPaths functionality, and using these variables in st.cmd files --- configure/RULES.ioc | 2 +- configure/tools/convertRelease.pl | 24 ++++++++++++++++++- .../top/exampleBoot/ioc/Makefile@Common | 3 ++- .../top/exampleBoot/ioc/st.cmd@Common | 17 ++++++++----- .../top/exampleBoot/ioc/st.cmd@RTEMS | 2 ++ .../top/iocBoot/ioc/Makefile@Common | 3 ++- src/makeBaseApp/top/iocBoot/ioc/st.cmd@Common | 9 +++++-- src/makeBaseApp/top/iocBoot/ioc/st.cmd@RTEMS | 2 ++ 8 files changed, 50 insertions(+), 12 deletions(-) diff --git a/configure/RULES.ioc b/configure/RULES.ioc index 55d0e8775..5f8b8fa8e 100644 --- a/configure/RULES.ioc +++ b/configure/RULES.ioc @@ -15,7 +15,7 @@ install: buildInstall buildInstall: $(TARGETS) -cdCommands: $(wildcard $(TOP)/configure/RELEASE*) \ +envPaths cdCommands: $(wildcard $(TOP)/configure/RELEASE*) \ $(TOP)/configure/CONFIG $(TOP)/bin @$(RM) $@ ifeq ($(IOCS_APPL_TOP),) diff --git a/configure/tools/convertRelease.pl b/configure/tools/convertRelease.pl index 560251768..a66072715 100755 --- a/configure/tools/convertRelease.pl +++ b/configure/tools/convertRelease.pl @@ -59,7 +59,8 @@ unless (@ARGV == 1) { print "Usage: convertRelease.pl [-a arch] [-h hostarch] [-t ioctop] outfile\n"; print " where outfile is be one of:\n"; print "\tcheckRelease - checks consistency with support apps\n"; - print "\tcdCommands - generate cd path strings for IOC use\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"; exit 2; @@ -87,6 +88,7 @@ for ($outfile) { /CONFIG_APP_INCLUDE/ and do { &configAppInclude; last; }; /RULES_INCLUDE/ and do { &rulesInclude; last; }; /cdCommands/ and do { &cdCommands; last; }; + /envPaths/ and do { &envPaths; last; }; /checkRelease/ and do { &checkRelease; last; }; die "Output file type \'$outfile\' not supported"; } @@ -237,6 +239,26 @@ sub cdCommands { } close OUT; } +sub envPaths { + die "Architecture not set (use -a option)" unless ($arch); + @includes = grep !/^TEMPLATE_TOP$/, @apps; + + unlink($outfile); + open(OUT,">$outfile") or die "$! creating $outfile"; + + $ioc = $cwd; + $ioc =~ s/^.*\///; + + print OUT "epicsEnvSet(ARCH,\"$arch\")\n"; + print OUT "epicsEnvSet(IOC,\"$ioc\")\n"; + + foreach $app (@includes) { + $iocpath = $path = $macros{$app}; + $iocpath =~ s/^$root/$iocroot/ if ($opt_t); + print OUT "epicsEnvSet($app,\"$iocpath\")\n" if (-d $path); + } + close OUT; +} sub checkRelease { $status = 0; delete $macros{TOP}; diff --git a/src/makeBaseApp/top/exampleBoot/ioc/Makefile@Common b/src/makeBaseApp/top/exampleBoot/ioc/Makefile@Common index ec5982d63..64a3e8bf7 100644 --- a/src/makeBaseApp/top/exampleBoot/ioc/Makefile@Common +++ b/src/makeBaseApp/top/exampleBoot/ioc/Makefile@Common @@ -1,4 +1,5 @@ TOP = ../.. include $(TOP)/configure/CONFIG -#nothing to do +ARCH = _ARCH_ +TARGETS = envPaths include $(TOP)/configure/RULES.ioc diff --git a/src/makeBaseApp/top/exampleBoot/ioc/st.cmd@Common b/src/makeBaseApp/top/exampleBoot/ioc/st.cmd@Common index 8ab524ded..9aa44d4e0 100644 --- a/src/makeBaseApp/top/exampleBoot/ioc/st.cmd@Common +++ b/src/makeBaseApp/top/exampleBoot/ioc/st.cmd@Common @@ -3,20 +3,25 @@ ## You may have to change _APPNAME_ to something else ## everywhere it appears in this file +< envPaths + +cd ${TOP} + ## Register all support components -dbLoadDatabase("../../dbd/_APPNAME_.dbd",0,0) +dbLoadDatabase("dbd/_APPNAME_.dbd",0,0) _APPNAME__registerRecordDeviceDriver(pdbbase) ## Load record instances -dbLoadRecords("../../db/dbExample1.db","user=_USER_Host") -dbLoadRecords("../../db/dbExample2.db","user=_USER_Host,no=1,scan=1 second") -dbLoadRecords("../../db/dbExample2.db","user=_USER_Host,no=2,scan=2 second") -dbLoadRecords("../../db/dbExample2.db","user=_USER_Host,no=3,scan=5 second") -dbLoadRecords("../../db/dbSubExample.db","user=_USER_Host") +dbLoadRecords("db/dbExample1.db","user=_USER_Host") +dbLoadRecords("db/dbExample2.db","user=_USER_Host,no=1,scan=1 second") +dbLoadRecords("db/dbExample2.db","user=_USER_Host,no=2,scan=2 second") +dbLoadRecords("db/dbExample2.db","user=_USER_Host,no=3,scan=5 second") +dbLoadRecords("db/dbSubExample.db","user=_USER_Host") ## Set this to see messages from mySub #var mySubDebug 1 +cd ${TOP}/iocBoot/${IOC} iocInit() ## Start any sequence programs diff --git a/src/makeBaseApp/top/exampleBoot/ioc/st.cmd@RTEMS b/src/makeBaseApp/top/exampleBoot/ioc/st.cmd@RTEMS index 4eb832fed..8725ec389 100644 --- a/src/makeBaseApp/top/exampleBoot/ioc/st.cmd@RTEMS +++ b/src/makeBaseApp/top/exampleBoot/ioc/st.cmd@RTEMS @@ -3,6 +3,8 @@ ## You may have to change _APPNAME_ to something else ## everywhere it appears in this file +#< envPaths + ## Register all support components dbLoadDatabase("dbd/_APPNAME_.dbd",0,0) _APPNAME__registerRecordDeviceDriver(pdbbase) diff --git a/src/makeBaseApp/top/iocBoot/ioc/Makefile@Common b/src/makeBaseApp/top/iocBoot/ioc/Makefile@Common index 59ebf7605..64a3e8bf7 100644 --- a/src/makeBaseApp/top/iocBoot/ioc/Makefile@Common +++ b/src/makeBaseApp/top/iocBoot/ioc/Makefile@Common @@ -1,4 +1,5 @@ TOP = ../.. include $(TOP)/configure/CONFIG -# nothing to do +ARCH = _ARCH_ +TARGETS = envPaths include $(TOP)/configure/RULES.ioc diff --git a/src/makeBaseApp/top/iocBoot/ioc/st.cmd@Common b/src/makeBaseApp/top/iocBoot/ioc/st.cmd@Common index 7b4deae9a..52dd2df1a 100644 --- a/src/makeBaseApp/top/iocBoot/ioc/st.cmd@Common +++ b/src/makeBaseApp/top/iocBoot/ioc/st.cmd@Common @@ -3,13 +3,18 @@ ## You may have to change _APPNAME_ to something else ## everywhere it appears in this file +< envPaths + +cd ${TOP} + ## Register all support components -dbLoadDatabase("../../dbd/_APPNAME_.dbd",0,0) +dbLoadDatabase("dbd/_APPNAME_.dbd",0,0) _APPNAME__registerRecordDeviceDriver(pdbbase) ## Load record instances -#dbLoadRecords("../../db/xxx.db","user=_USER_Host") +#dbLoadRecords("db/xxx.db","user=_USER_Host") +cd ${TOP}/iocBoot/${IOC} iocInit() ## Start any sequence programs diff --git a/src/makeBaseApp/top/iocBoot/ioc/st.cmd@RTEMS b/src/makeBaseApp/top/iocBoot/ioc/st.cmd@RTEMS index f0b1d01ae..7483f0b88 100644 --- a/src/makeBaseApp/top/iocBoot/ioc/st.cmd@RTEMS +++ b/src/makeBaseApp/top/iocBoot/ioc/st.cmd@RTEMS @@ -3,6 +3,8 @@ ## You may have to change _APPNAME_ to something else ## everywhere it appears in this file +#< envPaths + ## Register all support components dbLoadDatabase("dbd/_APPNAME_.dbd",0,0) _APPNAME__registerRecordDeviceDriver(pdbbase)