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

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: Created 8 years, 5 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, '', False),
275 'HEADERS_DEST': (str, '', False),
274 'SEARCH': (list, '', False), 276 'SEARCH': (list, '', False),
275 'POST': (str, '', False), 277 'POST': (str, '', False),
276 'PRE': (str, '', False), 278 'PRE': (str, '', False),
277 'DEST': (str, ['examples', 'src'], True), 279 'DEST': (str, ['examples', 'src'], True),
278 'NAME': (str, '', False), 280 'NAME': (str, '', False),
279 'DATA': (list, '', False), 281 'DATA': (list, '', False),
280 'TITLE': (str, '', False), 282 'TITLE': (str, '', False),
281 'DESC': (str, '', False), 283 'DESC': (str, '', False),
282 'INFO': (str, '', False) 284 'INFO': (str, '', False)
283 } 285 }
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 match = False 446 match = False
445 for toolchain in toolchains: 447 for toolchain in toolchains:
446 if toolchain in desc['TOOLS']: 448 if toolchain in desc['TOOLS']:
447 match = True 449 match = True
448 break 450 break
449 if not match: 451 if not match:
450 return None 452 return None
451 return desc 453 return desc
452 454
453 455
456 def FindAndCopyFiles(src_files, root, search_dirs, dst_dir):
457 buildbot_common.MakeDir(dst_dir)
458 for src_name in src_files:
459 src_file = FindFile(src_name, root, search_dirs)
460 if not src_file:
461 ErrorMsgFunc('Failed to find: ' + src_name)
462 return None
463 dst_file = os.path.join(dst_dir, src_name)
464 buildbot_common.CopyFile(src_file, dst_file)
465
466
454 def ProcessProject(srcroot, dstroot, desc, toolchains): 467 def ProcessProject(srcroot, dstroot, desc, toolchains):
455 name = desc['NAME'] 468 name = desc['NAME']
456 out_dir = os.path.join(dstroot, desc['DEST'], name) 469 out_dir = os.path.join(dstroot, desc['DEST'], name)
457 buildbot_common.MakeDir(out_dir) 470 buildbot_common.MakeDir(out_dir)
458 srcdirs = desc.get('SEARCH', ['.', '..']) 471 srcdirs = desc.get('SEARCH', ['.', '..'])
459 472
460 # Copy sources to example directory 473 # Copy sources to example directory
461 sources = GenerateCopyList(desc) 474 sources = GenerateSourceCopyList(desc)
462 for src_name in sources: 475 FindAndCopyFiles(sources, srcroot, srcdirs, out_dir)
463 src_file = FindFile(src_name, srcroot, srcdirs) 476
464 if not src_file: 477 # Copy public headers to the include directory.
465 ErrorMsgFunc('Failed to find: ' + src_name) 478 if 'HEADERS' in desc:
466 return None 479 headers = desc['HEADERS']
467 dst_file = os.path.join(out_dir, src_name) 480 header_out_dir = os.path.join(dstroot, desc['HEADERS_DEST'])
468 buildbot_common.CopyFile(src_file, dst_file) 481 FindAndCopyFiles(headers, srcroot, srcdirs, header_out_dir)
469 482
470 if IsNexe(desc): 483 if IsNexe(desc):
471 template=os.path.join(SCRIPT_DIR, 'template.mk') 484 template=os.path.join(SCRIPT_DIR, 'template.mk')
472 else: 485 else:
473 template=os.path.join(SCRIPT_DIR, 'library.mk') 486 template=os.path.join(SCRIPT_DIR, 'library.mk')
474 487
475 tools = [] 488 tools = []
476 for tool in desc['TOOLS']: 489 for tool in desc['TOOLS']:
477 if tool in toolchains: 490 if tool in toolchains:
478 tools.append(tool) 491 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') 569 master_in = os.path.join(SDK_EXAMPLE_DIR, 'Makefile')
557 master_out = os.path.join(options.dstroot, 'examples', 'Makefile') 570 master_out = os.path.join(options.dstroot, 'examples', 'Makefile')
558 GenerateMasterMakefile(master_in, master_out, examples) 571 GenerateMasterMakefile(master_in, master_out, examples)
559 master_out = os.path.join(options.dstroot, 'src', 'Makefile') 572 master_out = os.path.join(options.dstroot, 'src', 'Makefile')
560 GenerateMasterMakefile(master_in, master_out, libs) 573 GenerateMasterMakefile(master_in, master_out, libs)
561 return 0 574 return 0
562 575
563 576
564 if __name__ == '__main__': 577 if __name__ == '__main__':
565 sys.exit(main(sys.argv[1:])) 578 sys.exit(main(sys.argv[1:]))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698