[rtems-libbsd commit] Allow source file set specific compiler flags
Sebastian Huber
sebh at rtems.org
Mon Dec 16 14:29:34 UTC 2013
Module: rtems-libbsd
Branch: master
Commit: 9956d77cc726c4a0fc6b710607a5938102798cb5
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=9956d77cc726c4a0fc6b710607a5938102798cb5
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Thu Dec 12 10:39:56 2013 +0100
Allow source file set specific compiler flags
---
freebsd-to-rtems.py | 33 ++++++++++++++++++++-------------
1 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/freebsd-to-rtems.py b/freebsd-to-rtems.py
index 18b1c19..2fb4519 100755
--- a/freebsd-to-rtems.py
+++ b/freebsd-to-rtems.py
@@ -309,8 +309,15 @@ class MakefileFragmentComposer(object):
return ''
class SourceFileMakefileFragmentComposer(MakefileFragmentComposer):
+ def __init__(self, cflags = None):
+ self.cflags = cflags
+
def compose(self, path):
- return 'LIB_C_FILES += ' + path + '\n'
+ fragment = 'LIB_C_FILES += ' + path + '\n'
+ if self.cflags != None:
+ fragment = fragment + path[:-1] + 'o: ' + path + '\n' \
+ + '\t$(CC) $(CPPFLAGS) $(CFLAGS) ' + self.cflags + ' -c $< -o $@\n'
+ return fragment
class TestMakefileFragementComposer(MakefileFragmentComposer):
def __init__(self, testName, fileFragments, runTest, netTest):
@@ -602,26 +609,26 @@ class Module:
for cpu in targetCPUs:
self.files = self.addFiles(self.files, files, TargetSourceCPUDependentPathComposer(cpu, sourceCPU), FromFreeBSDToRTEMSHeaderConverter(), NoConverter(), assertHeaderFile)
- def addSourceFiles(self, files):
- self.files = self.addFiles(self.files, files, PathComposer(), NoConverter(), NoConverter(), assertSourceFile, SourceFileMakefileFragmentComposer())
+ def addSourceFiles(self, files, cflags = None):
+ self.files = self.addFiles(self.files, files, PathComposer(), NoConverter(), NoConverter(), assertSourceFile, SourceFileMakefileFragmentComposer(cflags))
- def addKernelSpaceSourceFiles(self, files):
- self.files = self.addFiles(self.files, files, FreeBSDPathComposer(), FromFreeBSDToRTEMSSourceConverter(), FromRTEMSToFreeBSDSourceConverter(), assertSourceFile, SourceFileMakefileFragmentComposer())
+ def addKernelSpaceSourceFiles(self, files, cflags = None):
+ self.files = self.addFiles(self.files, files, FreeBSDPathComposer(), FromFreeBSDToRTEMSSourceConverter(), FromRTEMSToFreeBSDSourceConverter(), assertSourceFile, SourceFileMakefileFragmentComposer(cflags))
- def addUserSpaceSourceFiles(self, files):
- self.files = self.addFiles(self.files, files, FreeBSDPathComposer(), FromFreeBSDToRTEMSUserSpaceSourceConverter(), FromRTEMSToFreeBSDSourceConverter(), assertSourceFile, SourceFileMakefileFragmentComposer())
+ def addUserSpaceSourceFiles(self, files, cflags = None):
+ self.files = self.addFiles(self.files, files, FreeBSDPathComposer(), FromFreeBSDToRTEMSUserSpaceSourceConverter(), FromRTEMSToFreeBSDSourceConverter(), assertSourceFile, SourceFileMakefileFragmentComposer(cflags))
- def addRTEMSSourceFiles(self, files):
- self.files = self.addFiles(self.files, files, RTEMSPathComposer(), NoConverter(), NoConverter(), assertSourceFile, SourceFileMakefileFragmentComposer())
+ def addRTEMSSourceFiles(self, files, cflags = None):
+ self.files = self.addFiles(self.files, files, RTEMSPathComposer(), NoConverter(), NoConverter(), assertSourceFile, SourceFileMakefileFragmentComposer(cflags))
- def addCPUDependentSourceFiles(self, cpu, files):
+ def addCPUDependentSourceFiles(self, cpu, files, cflags = None):
self.initCPUDependencies(cpu)
- self.cpuDependentSourceFiles [cpu] = self.addFiles(self.cpuDependentSourceFiles [cpu], files, CPUDependentPathComposer(), FromFreeBSDToRTEMSSourceConverter(), FromRTEMSToFreeBSDSourceConverter(), assertSourceFile, SourceFileMakefileFragmentComposer())
+ self.cpuDependentSourceFiles [cpu] = self.addFiles(self.cpuDependentSourceFiles [cpu], files, CPUDependentPathComposer(), FromFreeBSDToRTEMSSourceConverter(), FromRTEMSToFreeBSDSourceConverter(), assertSourceFile, SourceFileMakefileFragmentComposer(cflags))
- def addTargetSourceCPUDependentSourceFiles(self, targetCPUs, sourceCPU, files):
+ def addTargetSourceCPUDependentSourceFiles(self, targetCPUs, sourceCPU, files, cflags = None):
for cpu in targetCPUs:
self.initCPUDependencies(cpu)
- self.cpuDependentSourceFiles [cpu] = self.addFiles(self.cpuDependentSourceFiles [cpu], files, TargetSourceCPUDependentPathComposer(cpu, sourceCPU), FromFreeBSDToRTEMSSourceConverter(), NoConverter(), assertSourceFile, SourceFileMakefileFragmentComposer())
+ self.cpuDependentSourceFiles [cpu] = self.addFiles(self.cpuDependentSourceFiles [cpu], files, TargetSourceCPUDependentPathComposer(cpu, sourceCPU), FromFreeBSDToRTEMSSourceConverter(), NoConverter(), assertSourceFile, SourceFileMakefileFragmentComposer(cflags))
def addTest(self, testName, fileFragments, runTest = True, netTest = False):
self.files.append(File(testName, PathComposer(), NoConverter(), NoConverter(), TestMakefileFragementComposer(testName, fileFragments, runTest, netTest)))
More information about the vc
mailing list