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 }
// 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") }
func (c *Compiler) depsString() string { extraDeps := util.SortFields(c.extraDeps...) return strings.Join(extraDeps, " ") + "\n" }
func (c *Compiler) lflagsString() string { lflags := util.SortFields(c.info.Lflags...) return strings.Join(lflags, " ") }
func (c *Compiler) cflagsString() string { cflags := util.SortFields(c.info.Cflags...) return strings.Join(cflags, " ") }