| 1 | #!/usr/bin/env python |
| 2 | |
| 3 | import sys |
| 4 | import os |
| 5 | import getopt |
| 6 | |
| 7 | soclib_path = os.popen("soclib-cc --getpath").read().strip() |
| 8 | sys.path.append(os.path.join(soclib_path, 'utils/lib/python')) |
| 9 | |
| 10 | from soclib_cc.config import config |
| 11 | |
| 12 | from soclib_desc import components |
| 13 | components.getDescs(config.desc_paths) |
| 14 | |
| 15 | def doCFlags(args): |
| 16 | paths = set() |
| 17 | from soclib_desc import module |
| 18 | for moduleName in args: |
| 19 | module = module.Module.getRegistered(moduleName) |
| 20 | for path in module['abs_interface_files']: |
| 21 | paths.add(os.path.dirname(path)) |
| 22 | |
| 23 | print ' '.join(map(lambda x: '-I'+x, paths)) |
| 24 | |
| 25 | opts, args = getopt.getopt(sys.argv[1:], "", ["cflags"]) |
| 26 | didOne = False |
| 27 | for o, a in opts: |
| 28 | if o == '--cflags': |
| 29 | doCFlags(args) |
| 30 | didOne = True |
| 31 | |
| 32 | if not didOne: |
| 33 | print "usage: " + sys.argv[0] + " --cflags <modules>" |