func init() { CCENV = append(CCENV, fmt.Sprintf("%s=%s", "C_INCLUDE_PATH", "include")) CCENV = append(CCENV, fmt.Sprintf("%s=%s", "LIBRARY_PATH", "lib")) if cc = build.Getenv("CC"); cc == "" { cc = "CC" } if ld = build.Getenv("LD"); ld == "" { ld = "ld" } if ar = build.Getenv("AR"); ar == "" { ar = "ar" } if out, err := exec.Command(cc, "--version").Output(); err != nil { CCVersion = "deadbeef" } else { CCVersion = strings.TrimSpace(string(out)) } if err := ast.Register("cc_library", CLib{}); err != nil { log.Fatal(err) } if err := ast.Register("cxx_library", CLib{}); err != nil { log.Fatal(err) } if err := ast.Register("cc_binary", CBin{}); err != nil { log.Fatal(err) } }
// Had to be done func Copier() string { if tpfx := build.Getenv("TOOLPREFIX"); tpfx == "" { return "objcopy" } else { return fmt.Sprintf("%s%s", tpfx, "objcopy") } }
// Had to be done func Stripper() string { if tpfx := build.Getenv("TOOLPREFIX"); tpfx == "" { return "strip" } else { return fmt.Sprintf("%s%s", tpfx, "strip") } }
func Linker() string { if tpfx := build.Getenv("TOOLPREFIX"); tpfx == "" { return ld } else { return fmt.Sprintf("%s%s", tpfx, ld) } }
func Archiver() string { if tpfx := build.Getenv("TOOLPREFIX"); tpfx == "" { return ar } else { return fmt.Sprintf("%s%s", tpfx, ar) } }
func Compiler() string { if tpfx := build.Getenv("TOOLPREFIX"); tpfx == "" { return cc } else { return fmt.Sprintf("%s%s", tpfx, cc) } }