MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / DoBuilding

Function DoBuilding

tools/building.py:724–803  ·  view source on GitHub ↗
(target, objects)

Source from the content-addressed store, hash-verified

722 break
723
724def DoBuilding(target, objects):
725
726 # merge all objects into one list
727 def one_list(l):
728 lst = []
729 for item in l:
730 if type(item) == type([]):
731 lst += one_list(item)
732 else:
733 lst.append(item)
734 return lst
735
736 # handle local group
737 def local_group(group, objects):
738 if 'LOCAL_CFLAGS' in group or 'LOCAL_CXXFLAGS' in group or 'LOCAL_CCFLAGS' in group or 'LOCAL_CPPPATH' in group or 'LOCAL_CPPDEFINES' in group or 'LOCAL_ASFLAGS' in group:
739 CFLAGS = Env.get('CFLAGS', '') + group.get('LOCAL_CFLAGS', '')
740 CCFLAGS = Env.get('CCFLAGS', '') + group.get('LOCAL_CCFLAGS', '')
741 CXXFLAGS = Env.get('CXXFLAGS', '') + group.get('LOCAL_CXXFLAGS', '')
742 CPPPATH = list(Env.get('CPPPATH', [''])) + group.get('LOCAL_CPPPATH', [''])
743 CPPDEFINES = list(Env.get('CPPDEFINES', [''])) + group.get('LOCAL_CPPDEFINES', [''])
744 ASFLAGS = Env.get('ASFLAGS', '') + group.get('LOCAL_ASFLAGS', '')
745
746 for source in group['src']:
747 objects.append(Env.Object(source, CFLAGS = CFLAGS, CCFLAGS = CCFLAGS, CXXFLAGS = CXXFLAGS, ASFLAGS = ASFLAGS,
748 CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES))
749
750 return True
751
752 return False
753
754 PreBuilding()
755 objects = one_list(objects)
756
757 program = None
758 # check whether special buildlib option
759 lib_name = GetOption('buildlib')
760 if lib_name:
761 objects = [] # remove all of objects
762 # build library with special component
763 for Group in Projects:
764 if Group['name'] == lib_name:
765 lib_name = GroupLibName(Group['name'], Env)
766 if not local_group(Group, objects):
767 objects = Env.Object(Group['src'])
768
769 program = Env.Library(lib_name, objects)
770
771 # add library copy action
772 Env.BuildLib(lib_name, program)
773
774 break
775 else:
776 # generate build/compile_commands.json
777 if GetOption('cdb') and utils.VerTuple(SCons.__version__) >= (4, 0, 0):
778 Env.Tool("compilation_db")
779 Env.CompilationDatabase('build/compile_commands.json')
780
781 # remove source files with local flags setting

Callers

nothing calls this directly

Calls 5

PreBuildingFunction · 0.85
one_listFunction · 0.85
GroupLibNameFunction · 0.85
local_groupFunction · 0.85
EndBuildingFunction · 0.85

Tested by

no test coverage detected