def CreateSourceFiles(self): makefile = self.makefile_src ioc = self.ioc_name if self.cross_build or configure.TargetOS() == 'WIN32': prod_ioc = 'PROD_IOC_%s' % configure.TargetOS() else: prod_ioc = 'PROD_IOC' makefile.AddLine('%s = %s' % (prod_ioc, ioc)) makefile.AddLine('DBD += %s.dbd' % ioc) for dbd_part in Hardware.GetDbdList(): makefile.AddLine('%s_DBD += %s.dbd' % (ioc, dbd_part)) makefile.AddLine('%s_SRCS += %s_registerRecordDeviceDriver.cpp' % (ioc, ioc)) # Library dependencies need to be expressed in reverse dependency # order so that each library pulls in the required symbols from the # next library loaded. for lib in reversed(Hardware.GetLibList()): makefile.AddLine('%s_LIBS += %s' % (ioc, lib)) # Add the system libraries for lib in reversed(Hardware.GetSysLibList()): makefile.AddLine('%s_SYS_LIBS += %s' % (ioc, lib)) # Add makefile variables for text in reversed(Hardware.GetMakefileStringList()): makefile.AddLine(text % self.__dict__) makefile.AddLine('%s_LIBS += $(EPICS_BASE_IOC_LIBS)' % ioc) # Finally add the target specific files. configure.Call_TargetOS(self, 'CreateSourceFiles')
def CreateBootFiles(self): extension = self.substitute_boot and 'src' or 'cmd' self.WriteFile( (self.iocBootDir, 'st%s.%s' % (self.ioc_name, extension)), self.PrintIoc, '../..', maxLineLength=self.IOCmaxLineLength) if self.cross_build: scripts = 'SCRIPTS_%s' % configure.TargetOS() else: scripts = 'SCRIPTS' configure.Call_TargetOS(self, 'CreateBootFiles', scripts) self.makefile_boot.AddLine('%s += st%s.boot' % (scripts, self.ioc_name)) if self.substitute_boot: if paths.msiPath: self.makefile_boot.AddLine('PATH := $(PATH):%s' % paths.msiPath) else: self.makefile_boot.AddRule( 'envPaths cdCommands:\n' '\t$(PERL) $(TOOLS)/convertRelease.pl -a $(T_A) $@') self.makefile_boot.AddRule('%.boot: ../%.cmd\n\t$(CP) $< $@')
def __init__(self, path, ioc_name, check_release=True, substitute_boot=False, edm_screen=False, keep_files=[], makefile_name='Makefile'): # Remember parameters IocWriter.__init__(self, path) # Sets up iocRoot self.CreateBootFiles_win32 = self.CreateBootFiles_linux self.check_release = check_release self.substitute_boot = substitute_boot self.keep_files = keep_files self.edm_screen = edm_screen # We have to fudge the win32 build as although we run the builder on # Linux the IOC will have to be build on Windows. This is a sign that # something's not quite right here... self.cross_build = \ configure.Architecture() != paths.EPICS_HOST_ARCH and \ configure.TargetOS() != 'WIN32' # Create the working skeleton self.CreateIocNames(ioc_name) self.StartMakefiles(makefile_name) self.CreateSkeleton(makefile_name) # Actually generate the IOC self.GenerateIoc()
def CreateConfigureFiles(self): # Create the configure directory by copying files over from EPICS # base. We don't copy RELEASE because we need to rewrite it # completely anyway. template_dir = os.path.join(paths.EPICS_BASE, 'templates/makeBaseApp/top/configure') template_files = os.listdir(template_dir) for file in template_files: if file not in ['RELEASE']: shutil.copyfile(os.path.join(template_dir, file), os.path.join(self.iocRoot, 'configure', file)) self.WriteConfigFile('CONFIG_SITE' in template_files) used_macros, modules = canonicalise_macros( self.macros, libversion.ModuleBase.ListModules()) # Convert macros into text. releases = \ ['# Common prefixes'] + \ dict_to_lines(used_macros, self.macros) + \ ['# Module definitions'] + \ dict_to_lines(modules.keys(), modules) + \ ['# EPICS Base appears last', 'EPICS_BASE = %s' % paths.EPICS_BASE] # Write out configure/RELEASE self.WriteFile('configure/RELEASE', '\n'.join(releases)) if configure.TargetOS() == 'WIN32': paths_dict = dict((k, v.replace('/dls_sw/', r'W:\\')) \ for k,v in self.macros.items()) self.WriteFile( 'configure/RELEASE.%s.Common' % configure.Architecture(), self.WINDOWS_RELEASE_COMMON % paths_dict)
def CreateConfigureFiles(self): # Create the configure directory by copying files over from EPICS # base. We don't copy RELEASE because we need to rewrite it # completely anyway. template_dir = os.path.join(paths.EPICS_BASE, 'templates/makeBaseApp/top/configure') template_files = os.listdir(template_dir) for file in template_files: if file != 'RELEASE': shutil.copy(os.path.join(template_dir, file), os.path.join(self.iocRoot, 'configure')) self.WriteConfigFile('CONFIG_SITE' in template_files) # Write out configure/RELEASE releases = ['# DLS specific macros for the work and prod areas'] releases.append('SUPPORT = %s' % paths.module_path) releases.append('WORK = %s' % paths.module_work_path) releases.append('# Module paths') for module in sorted(libversion.ModuleBase.ListModules()): ## \todo Do something sensible on check_release # Something like this might be a good idea -- # if self.check_release: # module.CheckDependencies() if module.MacroName() != 'EPICS_BASE': path = module.LibPath() path = path.replace(paths.module_path, '$(SUPPORT)') path = path.replace(paths.module_work_path, '$(WORK)') releases.append('%s = %s' % (module.MacroName(), path)) releases.append('# EPICS Base appears last') releases.append('EPICS_BASE = %s' % paths.EPICS_BASE) self.WriteFile('configure/RELEASE', '\n'.join(releases)) if configure.TargetOS() == 'WIN32': lines = ['# Windows specific prefixes'] lines.append('SUPPORT = %s' % paths.module_path.replace('/dls_sw/', r'W:\\')) lines.append('WORK = %s' % paths.module_work_path.replace('/dls_sw/', r'W:\\')) lines.append('EPICS_BASE = %s' % paths.EPICS_BASE.replace('/dls_sw/', r'W:\\')) self.WriteFile( 'configure/RELEASE.%s.Common' % configure.Architecture(), '\n'.join(lines))