| 30 | makefile_name = "Makefile" |
| 31 | |
| 32 | def GetSourceTagFromDeps(path, lib_name, tag_name): |
| 33 | define_name = GetLableName(lib_name, tag_name) |
| 34 | |
| 35 | lib_define_name = GetLableName(lib_name, "LIB") |
| 36 | res = [] |
| 37 | |
| 38 | if(path.find("third_party") >=0): |
| 39 | return res |
| 40 | |
| 41 | if((path,lib_name,tag_name) in res_list): |
| 42 | return res_list[ (path,lib_name,tag_name) ] |
| 43 | |
| 44 | if( tag_name == "FULL_LIB_DEPS_PATH" ): |
| 45 | res.append( "$(SRC_BASE_PATH)/%s" % path ) |
| 46 | |
| 47 | lib_path = base_path + "/" + path + "/" + include_makefile_name |
| 48 | makefile_file = open(lib_path, "r") |
| 49 | try: |
| 50 | lines = makefile_file.readlines() |
| 51 | for line in lines: |
| 52 | values=line.split('=') |
| 53 | if(values[0] == define_name): |
| 54 | value = values[1].replace('\n', '').split(' ') |
| 55 | for obj in value: |
| 56 | if(len(obj) > 0): |
| 57 | if(tag_name == "OBJ"): |
| 58 | res.append("%s/%s" % (path, obj)) |
| 59 | elif(tag_name == "LIB"): |
| 60 | if(len(obj.split(':')) == 1): |
| 61 | res.append(obj) |
| 62 | else: |
| 63 | res.append(obj) |
| 64 | |
| 65 | if(values[0] == lib_define_name): |
| 66 | res_inc = values[1].replace('\n','') |
| 67 | dep_lib_list = res_inc.split(' ') |
| 68 | for dep_lib in dep_lib_list: |
| 69 | if(len(dep_lib.split(':')) > 1): |
| 70 | deps_path = dep_lib.split(':')[0] |
| 71 | deps_lib_name = dep_lib.split(':')[1] |
| 72 | if(deps_path == ""): |
| 73 | deps_path = path |
| 74 | res+=GetSourceTagFromDeps(deps_path, deps_lib_name, tag_name) |
| 75 | |
| 76 | finally: |
| 77 | makefile_file.close() |
| 78 | res=Uniq(res) |
| 79 | res_list[ (path,lib_name,tag_name) ] = res |
| 80 | return res |
| 81 | |
| 82 | |
| 83 | def PrintComm(path, target_name, lib_name): |