Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 | 6 |
| 7 # | 7 # |
| 8 # Default macros for various platforms. | 8 # Default macros for various platforms. |
| 9 # | 9 # |
| 10 NEWLIB_DEFAULTS = """ | 10 NEWLIB_DEFAULTS = """ |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 WIN_LDFLAGS=/LIBPATH:$(NACL_SDK_ROOT)/lib/win_x86_32_host | 49 WIN_LDFLAGS=/LIBPATH:$(NACL_SDK_ROOT)/lib/win_x86_32_host |
| 50 """ | 50 """ |
| 51 | 51 |
| 52 # | 52 # |
| 53 # Compile rules for various platforms. | 53 # Compile rules for various platforms. |
| 54 # | 54 # |
| 55 NACL_CC_RULE = """ | 55 NACL_CC_RULE = """ |
| 56 <OBJS>:=$(patsubst %.<ext>, <tc>/%_<ARCH>.o,$(<PROJ>_<EXT>)) | 56 <OBJS>:=$(patsubst %.<ext>, <tc>/%_<ARCH>.o,$(<PROJ>_<EXT>)) |
| 57 DEPFILES+=$(<OBJS>:.o=.d) | 57 DEPFILES+=$(<OBJS>:.o=.d) |
| 58 $(<OBJS>) : <tc>/%_<ARCH>.o : %.<ext> $(THIS_MAKE) | <tc> | 58 $(<OBJS>) : <tc>/%_<ARCH>.o : %.<ext> $(THIS_MAKE) | <tc> |
| 59 <TAB>$(<CC>) -o $@ $< <MACH> $(<PROJ>_<EXT>FLAGS) -DTCNAME=<tc> $(<TC>_CCFLAGS) <DEFLIST> | 59 <TAB>$(<CC>) -o $@ $< <MACH> -DTCNAME=<tc> $(<TC>_CCFLAGS) $(<PROJ>_<EXT>FLAGS) <DEFLIST> <INCLUDELIST> |
| 60 """ | 60 """ |
| 61 | 61 |
| 62 SO_CC_RULE = """ | 62 SO_CC_RULE = """ |
| 63 <OBJS>:=$(patsubst %.<ext>, <tc>/%_<ARCH>.o,$(<PROJ>_<EXT>)) | 63 <OBJS>:=$(patsubst %.<ext>, <tc>/%_<ARCH>.o,$(<PROJ>_<EXT>)) |
| 64 DEPFILES+=$(<OBJS>:.o=.d) | 64 DEPFILES+=$(<OBJS>:.o=.d) |
| 65 $(<OBJS>) : <tc>/%_<ARCH>.o : %.<ext> $(THIS_MAKE) | <tc> | 65 $(<OBJS>) : <tc>/%_<ARCH>.o : %.<ext> $(THIS_MAKE) | <tc> |
| 66 <TAB>$(<CC>) -o $@ $< <MACH> -fPIC $(<PROJ>_<EXT>FLAGS) -DTCNAME=<tc> $(<TC>_CCF LAGS) <DEFLIST> | 66 <TAB>$(<CC>) -o $@ $< <MACH> -fPIC -DTCNAME=<tc> $(<TC>_CCFLAGS) $(<PROJ>_<EXT>F LAGS) <DEFLIST> <INCLUDELIST> |
| 67 """ | 67 """ |
| 68 | 68 |
| 69 WIN_CC_RULE = """ | 69 WIN_CC_RULE = """ |
| 70 <OBJS>:=$(patsubst %.<ext>, <tc>/%.obj,$(<PROJ>_<EXT>)) | 70 <OBJS>:=$(patsubst %.<ext>, <tc>/%.obj,$(<PROJ>_<EXT>)) |
| 71 $(<OBJS>) : <tc>/%.obj : %.<ext> $(THIS_MAKE) | <tc> | 71 $(<OBJS>) : <tc>/%.obj : %.<ext> $(THIS_MAKE) | <tc> |
| 72 <TAB>$(<CC>) /Fo$@ /c $< -DTCNAME=host $(WIN_CCFLAGS) <DEFLIST> | 72 <TAB>$(<CC>) /Fo$@ /c $< -DTCNAME=host $(WIN_CCFLAGS) <DEFLIST> <INCLUDELIST> |
| 73 """ | 73 """ |
| 74 | 74 |
| 75 # | 75 # |
| 76 # Link rules for various platforms. | 76 # Link rules for various platforms. |
| 77 # | 77 # |
| 78 NEXE_LINK_RULE = """ | 78 NEXE_LINK_RULE = """ |
| 79 <tc>/<proj>_<ARCH>.nexe : <OBJS> | 79 <tc>/<proj>_<ARCH>.nexe : <OBJS> |
| 80 <TAB>$(<LINK>) -o $@ $^ <MACH> $(<PROJ>_LDFLAGS) $(<TC>_LDFLAGS) <LIBLIST> | 80 <TAB>$(<LINK>) -o $@ $^ <MACH> $(<PROJ>_LDFLAGS) $(<TC>_LDFLAGS) <LIBLIST> |
| 81 <TC>_NMF+=<tc>/<proj>_<ARCH>.nexe | 81 <TC>_NMF+=<tc>/<proj>_<ARCH>.nexe |
| 82 """ | 82 """ |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 """ | 145 """ |
| 146 | 146 |
| 147 | 147 |
| 148 EXT_MAP = { | 148 EXT_MAP = { |
| 149 'c': 'CC', | 149 'c': 'CC', |
| 150 'cc': 'CXX' | 150 'cc': 'CXX' |
| 151 } | 151 } |
| 152 | 152 |
| 153 WIN_TOOL = { | 153 WIN_TOOL = { |
| 154 'DEFINE': '-D%s', | 154 'DEFINE': '-D%s', |
| 155 'INCLUDE': '/I%s', | |
| 155 'LIBRARY': '%s.lib', | 156 'LIBRARY': '%s.lib', |
| 156 'main': '<tc>/<proj>.dll', | 157 'main': '<tc>/<proj>.dll', |
| 157 'nmf': '<tc>/<proj>.nmf', | 158 'nmf': '<tc>/<proj>.nmf', |
| 158 'so': None, | 159 'so': None, |
| 159 'lib': '$(NACL_SDK_ROOT)/lib/win_<ARCH>_host/<proj>.lib', | 160 'lib': '$(NACL_SDK_ROOT)/lib/win_<ARCH>_host/<proj>.lib', |
| 160 } | 161 } |
| 161 | 162 |
| 162 NACL_TOOL = { | 163 NACL_TOOL = { |
| 163 'DEFINE': '-D%s', | 164 'DEFINE': '-D%s', |
| 165 'INCLUDE': '-I%s', | |
| 164 'LIBRARY': '-l%s', | 166 'LIBRARY': '-l%s', |
| 165 'main': '<tc>/<proj>_<ARCH>.nexe', | 167 'main': '<tc>/<proj>_<ARCH>.nexe', |
| 166 'nmf': '<tc>/<proj>.nmf', | 168 'nmf': '<tc>/<proj>.nmf', |
| 167 'so': '<tc>/<proj>_<ARCH>.so', | 169 'so': '<tc>/<proj>_<ARCH>.so', |
| 168 'lib': '$(NACL_SDK_ROOT)/lib/$(OSNAME)_<ARCH>_<tc>/lib<proj>.a', | 170 'lib': '$(NACL_SDK_ROOT)/lib/$(OSNAME)_<ARCH>_<tc>/lib<proj>.a', |
| 169 } | 171 } |
| 170 | 172 |
| 171 | 173 |
| 172 # | 174 # |
| 173 # Various Architectures | 175 # Various Architectures |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 239 'SO': None, | 241 'SO': None, |
| 240 'TOOL': WIN_TOOL | 242 'TOOL': WIN_TOOL |
| 241 } | 243 } |
| 242 } | 244 } |
| 243 | 245 |
| 244 | 246 |
| 245 def GetBuildRule(tool, ext): | 247 def GetBuildRule(tool, ext): |
| 246 return BUILD_RULES[tool][ext] | 248 return BUILD_RULES[tool][ext] |
| 247 | 249 |
| 248 | 250 |
| 251 def BuildList(tool, key, items): | |
| 252 pattern = BUILD_RULES[tool]['TOOL'][key] | |
| 253 items = [(pattern % name) for name in items] | |
| 254 return ' '.join(items) | |
| 255 | |
|
noelallen1
2012/07/31 20:37:21
Missing LF
| |
| 249 def BuildDefineList(tool, defs): | 256 def BuildDefineList(tool, defs): |
| 250 pattern = BUILD_RULES[tool]['TOOL']['DEFINE'] | 257 return BuildList(tool, 'DEFINE', defs) |
| 251 defines = [(pattern % name) for name in defs] | 258 |
| 252 return ' '.join(defines) | 259 |
| 260 def BuildIncludeList(tool, includes): | |
| 261 return BuildList(tool, 'INCLUDE', includes) | |
| 253 | 262 |
| 254 | 263 |
| 255 def BuildLibList(tool, libs): | 264 def BuildLibList(tool, libs): |
| 256 pattern = BUILD_RULES[tool]['TOOL']['LIBRARY'] | 265 return BuildList(tool, 'LIBRARY', libs) |
| 257 libraries = [(pattern % name) for name in libs] | |
| 258 return ' '.join(libraries) | |
| 259 | 266 |
| 260 | 267 |
| 261 def BuildToolDict(toolchain, project, arch = {}, ext='nexe', **kwargs): | 268 def BuildToolDict(toolchain, project, arch = {}, ext='nexe', **kwargs): |
| 262 tc = toolchain | 269 tc = toolchain |
| 263 TC = toolchain.upper() | 270 TC = toolchain.upper() |
| 264 proj = project | 271 proj = project |
| 265 PROJ = proj.upper() | 272 PROJ = proj.upper() |
| 266 EXT = EXT_MAP.get(ext, ext.upper()) | 273 EXT = EXT_MAP.get(ext, ext.upper()) |
| 267 | 274 |
| 268 replace = { | 275 replace = { |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 287 for key in kwargs: | 294 for key in kwargs: |
| 288 replace['<%s>' % key] = kwargs[key] | 295 replace['<%s>' % key] = kwargs[key] |
| 289 | 296 |
| 290 if '<OBJS>' not in replace: | 297 if '<OBJS>' not in replace: |
| 291 if replace.get('<ARCH>', ''): | 298 if replace.get('<ARCH>', ''): |
| 292 replace['<OBJS>'] = '%s_%s_%s_%s_O' % (TC, PROJ, replace['<ARCH>'], EXT) | 299 replace['<OBJS>'] = '%s_%s_%s_%s_O' % (TC, PROJ, replace['<ARCH>'], EXT) |
| 293 else: | 300 else: |
| 294 replace['<OBJS>'] = '%s_%s_%s_O' % (TC, PROJ, EXT) | 301 replace['<OBJS>'] = '%s_%s_%s_O' % (TC, PROJ, EXT) |
| 295 return replace | 302 return replace |
| 296 | 303 |
| OLD | NEW |