Ticket #16: soclib-cc-cflags.patch

File soclib-cc-cflags.patch, 1.8 KB (added by ludovic.lhours@…, 15 years ago)
  • utils/lib/python/soclib-cc-main.py

    diff --git a/utils/lib/python/soclib-cc-main.py b/utils/lib/python/soclib-cc-main.py
    index 311c133..9d35f35 100644
    a b def main(): 
    130130                                          action='store', nargs = 1,
    131131                                          help="Auto report bug. Methods allowed: openbrowser, *none",
    132132                                          choices = ("openbrowser", "none"))
     133        parser.add_option('--cflags', dest = 'cflags',
     134                                          action='store_true',
     135                                          help="Print software include directories C flags")
    133136        parser.set_defaults(auto_bug_report = "none",
    134137                                                includes = [])
    135138        opts, args = parser.parse_args()
    todo = Platform( 
    275278                        fd.close()
    276279                elif opts.clean:
    277280                        todo.clean()
     281                elif opts.cflags:
     282                        todo.printCflags()
    278283                else:
    279284                        todo.process()
    280285        elif opts.compile:
  • utils/lib/python/soclib_cc/platform.py

    diff --git a/utils/lib/python/soclib_cc/platform.py b/utils/lib/python/soclib_cc/platform.py
    index 4fb6e8a..da4a762 100644
    a b class Platform: 
    6767                component = Specialization(
    6868                        Source(mode, source_file, uses, defines, **params),
    6969                        **params)
     70                self.component = component
    7071                self.todo = ToDo()
    7172                self.objs = set()
    7273#               component.printAllUses()
    class Platform: 
    8788        def genMakefile(self):
    8889                return self.todo.genMakefile()
    8990
     91        def printCflags(self):
     92                paths = set([])
     93                for mod in self.component.getSubTree():
     94                        isAddressable = False
     95                        for ext in mod.getExtensions():
     96                                if ext[0:16] == 'dsx:addressable=':
     97                                        isAddressable = True
     98                                        break
     99                        if isAddressable:
     100                                for file in mod.getHeaderFiles():
     101                                        paths.add(os.path.realpath(os.path.dirname(file)))
     102                print ' '.join(map(lambda x: '-I'+x, paths))
     103
    90104        def __repr__(self):
    91105                import pprint
    92106                return '%s(%r, %r,\n%s, %r, %r)'%(