Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Side by Side Diff: native_client_sdk/src/build_tools/generate_make.py

Issue 10823016: [NaCl SDK] Don't copy .h files to src in SDK. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: feedback Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 import buildbot_common 6 import buildbot_common
7 import make_rules 7 import make_rules
8 import optparse 8 import optparse
9 import os 9 import os
10 import sys 10 import sys
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 out += line[:-1] + '\n' 56 out += line[:-1] + '\n'
57 line = '%s+=%s ' % (varname, value) 57 line = '%s+=%s ' % (varname, value)
58 else: 58 else:
59 line += value + ' ' 59 line += value + ' '
60 60
61 if line: 61 if line:
62 out += line[:-1] + '\n' 62 out += line[:-1] + '\n'
63 return out 63 return out
64 64
65 65
66 def GenerateCopyList(desc): 66 def GenerateSourceCopyList(desc):
67 sources = [] 67 sources = []
68 # Add sources for each target 68 # Add sources for each target
69 for target in desc['TARGETS']: 69 for target in desc['TARGETS']:
70 sources.extend(target['SOURCES']) 70 sources.extend(target['SOURCES'])
71 71
72 # And HTML and data files 72 # And HTML and data files
73 sources.extend(desc.get('DATA', [])) 73 sources.extend(desc.get('DATA', []))
74 74
75 if desc['DEST'] == 'examples': 75 if desc['DEST'] == 'examples':
76 sources.append('common.js') 76 sources.append('common.js')
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 'PREREQ' : (list, '', False), 264 'PREREQ' : (list, '', False),
265 'TARGETS' : (list, { 265 'TARGETS' : (list, {
266 'NAME': (str, '', True), 266 'NAME': (str, '', True),
267 'TYPE': (str, ['main', 'nexe', 'lib', 'so'], True), 267 'TYPE': (str, ['main', 'nexe', 'lib', 'so'], True),
268 'SOURCES': (list, '', True), 268 'SOURCES': (list, '', True),
269 'CCFLAGS': (list, '', False), 269 'CCFLAGS': (list, '', False),
270 'CXXFLAGS': (list, '', False), 270 'CXXFLAGS': (list, '', False),
271 'LDFLAGS': (list, '', False), 271 'LDFLAGS': (list, '', False),
272 'LIBS' : (list, '', False) 272 'LIBS' : (list, '', False)
273 }, True), 273 }, True),
274 'HEADERS': (list, {
275 'FILES': (list, '', True),
276 'DEST': (str, '', True),
277 }, False),
274 'SEARCH': (list, '', False), 278 'SEARCH': (list, '', False),
275 'POST': (str, '', False), 279 'POST': (str, '', False),
276 'PRE': (str, '', False), 280 'PRE': (str, '', False),
277 'DEST': (str, ['examples', 'src'], True), 281 'DEST': (str, ['examples', 'src'], True),
278 'NAME': (str, '', False), 282 'NAME': (str, '', False),
279 'DATA': (list, '', False), 283 'DATA': (list, '', False),
280 'TITLE': (str, '', False), 284 'TITLE': (str, '', False),
281 'DESC': (str, '', False), 285 'DESC': (str, '', False),
282 'INFO': (str, '', False) 286 'INFO': (str, '', False)
283 } 287 }
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 match = False 448 match = False
445 for toolchain in toolchains: 449 for toolchain in toolchains:
446 if toolchain in desc['TOOLS']: 450 if toolchain in desc['TOOLS']:
447 match = True 451 match = True
448 break 452 break
449 if not match: 453 if not match:
450 return None 454 return None
451 return desc 455 return desc
452 456
453 457
458 def FindAndCopyFiles(src_files, root, search_dirs, dst_dir):
459 buildbot_common.MakeDir(dst_dir)
460 for src_name in src_files:
461 src_file = FindFile(src_name, root, search_dirs)
462 if not src_file:
463 ErrorMsgFunc('Failed to find: ' + src_name)
464 return None
465 dst_file = os.path.join(dst_dir, src_name)
466 buildbot_common.CopyFile(src_file, dst_file)
467
468
454 def ProcessProject(srcroot, dstroot, desc, toolchains): 469 def ProcessProject(srcroot, dstroot, desc, toolchains):
455 name = desc['NAME'] 470 name = desc['NAME']
456 out_dir = os.path.join(dstroot, desc['DEST'], name) 471 out_dir = os.path.join(dstroot, desc['DEST'], name)
457 buildbot_common.MakeDir(out_dir) 472 buildbot_common.MakeDir(out_dir)
458 srcdirs = desc.get('SEARCH', ['.', '..']) 473 srcdirs = desc.get('SEARCH', ['.', '..'])
459 474
460 # Copy sources to example directory 475 # Copy sources to example directory
461 sources = GenerateCopyList(desc) 476 sources = GenerateSourceCopyList(desc)
462 for src_name in sources: 477 FindAndCopyFiles(sources, srcroot, srcdirs, out_dir)
463 src_file = FindFile(src_name, srcroot, srcdirs) 478
464 if not src_file: 479 # Copy public headers to the include directory.
465 ErrorMsgFunc('Failed to find: ' + src_name) 480 for headers_set in desc.get('HEADERS', []):
466 return None 481 headers = headers_set['FILES']
467 dst_file = os.path.join(out_dir, src_name) 482 header_out_dir = os.path.join(dstroot, headers_set['DEST'])
468 buildbot_common.CopyFile(src_file, dst_file) 483 FindAndCopyFiles(headers, srcroot, srcdirs, header_out_dir)
469 484
470 if IsNexe(desc): 485 if IsNexe(desc):
471 template=os.path.join(SCRIPT_DIR, 'template.mk') 486 template=os.path.join(SCRIPT_DIR, 'template.mk')
472 else: 487 else:
473 template=os.path.join(SCRIPT_DIR, 'library.mk') 488 template=os.path.join(SCRIPT_DIR, 'library.mk')
474 489
475 tools = [] 490 tools = []
476 for tool in desc['TOOLS']: 491 for tool in desc['TOOLS']:
477 if tool in toolchains: 492 if tool in toolchains:
478 tools.append(tool) 493 tools.append(tool)
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 master_in = os.path.join(SDK_EXAMPLE_DIR, 'Makefile') 571 master_in = os.path.join(SDK_EXAMPLE_DIR, 'Makefile')
557 master_out = os.path.join(options.dstroot, 'examples', 'Makefile') 572 master_out = os.path.join(options.dstroot, 'examples', 'Makefile')
558 GenerateMasterMakefile(master_in, master_out, examples) 573 GenerateMasterMakefile(master_in, master_out, examples)
559 master_out = os.path.join(options.dstroot, 'src', 'Makefile') 574 master_out = os.path.join(options.dstroot, 'src', 'Makefile')
560 GenerateMasterMakefile(master_in, master_out, libs) 575 GenerateMasterMakefile(master_in, master_out, libs)
561 return 0 576 return 0
562 577
563 578
564 if __name__ == '__main__': 579 if __name__ == '__main__':
565 sys.exit(main(sys.argv[1:])) 580 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « native_client_sdk/src/build_tools/build_sdk.py ('k') | native_client_sdk/src/build_tools/make_rules.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698