MCPcopy Create free account
hub / github.com/nodejs/node / WriteTargetFlags

Method WriteTargetFlags

tools/gyp/pylib/gyp/generator/android.py:842–883  ·  view source on GitHub ↗

Write Makefile code to specify the link flags and library dependencies. spec, configs: input from gyp. link_deps: link dependency list; see ComputeDeps()

(self, spec, configs, link_deps)

Source from the content-addressed store, hash-verified

840 return (gyp.common.uniquer(deps), gyp.common.uniquer(link_deps))
841
842 def WriteTargetFlags(self, spec, configs, link_deps):
843 """Write Makefile code to specify the link flags and library dependencies.
844
845 spec, configs: input from gyp.
846 link_deps: link dependency list; see ComputeDeps()
847 """
848 # Libraries (i.e. -lfoo)
849 # These must be included even for static libraries as some of them provide
850 # implicit include paths through the build system.
851 libraries = gyp.common.uniquer(spec.get("libraries", []))
852 static_libs, dynamic_libs, ldflags_libs = self.FilterLibraries(libraries)
853
854 if self.type != "static_library":
855 for configname, config in sorted(configs.items()):
856 ldflags = list(config.get("ldflags", []))
857 self.WriteLn("")
858 self.WriteList(ldflags, "LOCAL_LDFLAGS_%s" % configname)
859 self.WriteList(ldflags_libs, "LOCAL_GYP_LIBS")
860 self.WriteLn(
861 "LOCAL_LDFLAGS := $(LOCAL_LDFLAGS_$(GYP_CONFIGURATION)) "
862 "$(LOCAL_GYP_LIBS)"
863 )
864
865 # Link dependencies (i.e. other gyp targets this target depends on)
866 # These need not be included for static libraries as within the gyp build
867 # we do not use the implicit include path mechanism.
868 if self.type != "static_library":
869 static_link_deps = [x[1] for x in link_deps if x[0] == "static"]
870 shared_link_deps = [x[1] for x in link_deps if x[0] == "shared"]
871 else:
872 static_link_deps = []
873 shared_link_deps = []
874
875 # Only write the lists if they are non-empty.
876 if static_libs or static_link_deps:
877 self.WriteLn("")
878 self.WriteList(static_libs + static_link_deps, "LOCAL_STATIC_LIBRARIES")
879 self.WriteLn("# Enable grouping to fix circular references")
880 self.WriteLn("LOCAL_GROUP_STATIC_LIBRARIES := true")
881 if dynamic_libs or shared_link_deps:
882 self.WriteLn("")
883 self.WriteList(dynamic_libs + shared_link_deps, "LOCAL_SHARED_LIBRARIES")
884
885 def WriteTarget(
886 self, spec, configs, deps, link_deps, part_of_all, write_alias_target

Callers 1

WriteTargetMethod · 0.95

Calls 7

FilterLibrariesMethod · 0.95
WriteLnMethod · 0.95
WriteListMethod · 0.95
sortedFunction · 0.85
getMethod · 0.65
listFunction · 0.50
itemsMethod · 0.45

Tested by

no test coverage detected