コード例 #1
0
ファイル: util.go プロジェクト: apache/incubator-mynewt-newt
func ResolveTarget(name string) *target.Target {
	// Trim trailing slash from name.  This is necessary when tab
	// completion is used to specify the name.
	name = strings.TrimSuffix(name, "/")

	targetMap := target.GetTargets()

	// Check for fully-qualified name.
	if t := targetMap[name]; t != nil {
		return t
	}

	// Check the local "targets" directory.
	if t := targetMap[TARGET_DEFAULT_DIR+"/"+name]; t != nil {
		return t
	}

	// Check each repo alphabetically.
	fullNames := []string{}
	for fullName, _ := range targetMap {
		fullNames = append(fullNames, fullName)
	}
	for _, fullName := range util.SortFields(fullNames...) {
		if name == filepath.Base(fullName) {
			return targetMap[fullName]
		}
	}

	return nil
}
コード例 #2
0
// Generates a string consisting of all the necessary include path (-I)
// options.  The result is sorted and contains no duplicate paths.
func (c *Compiler) includesString() string {
	if len(c.info.Includes) == 0 {
		return ""
	}

	includes := util.SortFields(c.info.Includes...)
	return "-I" + strings.Join(includes, " -I")
}
コード例 #3
0
func (c *Compiler) depsString() string {
	extraDeps := util.SortFields(c.extraDeps...)
	return strings.Join(extraDeps, " ") + "\n"
}
コード例 #4
0
func (c *Compiler) lflagsString() string {
	lflags := util.SortFields(c.info.Lflags...)
	return strings.Join(lflags, " ")
}
コード例 #5
0
func (c *Compiler) cflagsString() string {
	cflags := util.SortFields(c.info.Cflags...)
	return strings.Join(cflags, " ")
}