andrej@1511: #!/usr/bin/env python
andrej@1511: # -*- coding: utf-8 -*-
andrej@1511: 
andrej@1511: # This file is part of Beremiz, a Integrated Development Environment for
andrej@1511: # programming IEC 61131-3 automates supporting plcopen standard and CanFestival.
andrej@1511: #
andrej@1511: # Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
andrej@1511: #
andrej@1511: # See COPYING file for copyrights details.
andrej@1511: #
andrej@1511: # This program is free software; you can redistribute it and/or
andrej@1511: # modify it under the terms of the GNU General Public License
andrej@1511: # as published by the Free Software Foundation; either version 2
andrej@1511: # of the License, or (at your option) any later version.
andrej@1511: #
andrej@1511: # This program is distributed in the hope that it will be useful,
andrej@1511: # but WITHOUT ANY WARRANTY; without even the implied warranty of
andrej@1511: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
andrej@1511: # GNU General Public License for more details.
andrej@1511: #
andrej@1511: # You should have received a copy of the GNU General Public License
andrej@1511: # along with this program; if not, write to the Free Software
andrej@1511: # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
andrej@1511: 
andrej@1881: 
kinsamanka@3750: 
Edouard@642: from ..toolchain_gcc import toolchain_gcc
lbessard@321: 
andrej@1736: 
lbessard@321: class Xenomai_target(toolchain_gcc):
Edouard@1279:     dlopen_prefix = "./"
lbessard@321:     extension = ".so"
andrej@1751: 
Edouard@633:     def getXenoConfig(self, flagsname):
lbessard@321:         """ Get xeno-config from target parameters """
andrej@1742:         xeno_config = self.CTRInstance.GetTarget().getcontent().getXenoConfig()
Edouard@633:         if xeno_config:
Edouard@726:             from util.ProcessLogger import ProcessLogger
andrej@1847:             status, result, _err_result = ProcessLogger(self.CTRInstance.logger,
edouard@3294:                                                         xeno_config + " --skin=posix --skin=alchemy "+flagsname,
andrej@1847:                                                         no_stdout=True).spin()
Edouard@633:             if status:
andrej@1734:                 self.CTRInstance.logger.write_error(_("Unable to get Xenomai's %s \n") % flagsname)
Edouard@633:             return [result.strip()]
Edouard@633:         return []
andrej@1735: 
lbessard@321:     def getBuilderLDFLAGS(self):
edouard@3294:         xeno_ldflags = self.getXenoConfig("--no-auto-init --ldflags")
Edouard@634:         return toolchain_gcc.getBuilderLDFLAGS(self) + xeno_ldflags + ["-shared"]
lbessard@321: 
lbessard@321:     def getBuilderCFLAGS(self):
edouard@3294:         xeno_cflags = self.getXenoConfig("--cflags")
Edouard@635:         return toolchain_gcc.getBuilderCFLAGS(self) + xeno_cflags + ["-fPIC"]