func flagsBase(cflags string) string {
	if cflags == "-O" || len(cflags) == 3 && strings.HasPrefix(cflags, "-O") {
		return "-O"
	}
	eqIdx := strings.IndexByte(cflags, '=')
	if eqIdx == -1 {
		return cflags
	} else {
		return cflags[:eqIdx]
	}
}
Extracts the base of a flag string.  A flag base is used when detecting flag
conflicts.  If two flags have identicial bases, then they are in conflict.
package toolchain
import (
	"fmt"
	"io/ioutil"
	"os"
	"path"
	"path/filepath"
	"regexp"
	"runtime"
	"sort"
	"strconv"
	"strings"
	"sync"
	"time"
	log "github.com/sirupsen/logrus"
	"mynewt.apache.org/newt/newt/config"
	"mynewt.apache.org/newt/newt/project"
	"mynewt.apache.org/newt/newt/symbol"
	"mynewt.apache.org/newt/newt/ycfg"
	"mynewt.apache.org/newt/util"
)
const COMPILER_FILENAME string = "compiler.yml"
const (
	COMPILER_TYPE_C       = 0
	COMPILER_TYPE_ASM     = 1
	COMPILER_TYPE_CPP     = 2
	COMPILER_TYPE_ARCHIVE = 3
)
type CompilerInfo struct {
	Includes    []string
	Cflags      []string
	CXXflags    []string
	Lflags      []string
	Aflags      []string
	IgnoreFiles []*regexp.Regexp
	IgnoreDirs  []*regexp.Regexp
}
type CompileCommand struct {
	Directory string `json:"directory"`
	Command   string `json:"command"`
	File      string `json:"file"`
}
type Compiler struct {
	objPathList   map[string]bool
	LinkerScripts []string
	mutex *sync.Mutex
	depTracker            DepTracker
	ccPath                string
	cppPath               string
	asPath                string
	arPath                string
	odPath                string
	osPath                string
	ocPath                string
	ldResolveCircularDeps bool
	ldMapFile             bool
	ldBinFile             bool
	baseDir               string
	srcDir                string
	dstDir                string
	info CompilerInfo
	lclInfo CompilerInfo
	lclInfoAdded bool
	compileCommands []CompileCommand
	extraDeps []string
}
func (c *Compiler) GetCompileCommands() []CompileCommand {
	return c.compileCommands
}
func (c *Compiler) GetCcPath() string {
	return c.ccPath
}
func (c *Compiler) GetCppPath() string {
	return c.cppPath
}
func (c *Compiler) GetAsPath() string {
	return c.asPath
}
func (c *Compiler) GetArPath() string {
	return c.arPath
}
func (c *Compiler) GetObjcopyPath() string {
	return c.ocPath
}
func (c *Compiler) GetObjdumpPath() string {
	return c.odPath
}
func (c *Compiler) GetSizePath() string {
	return c.osPath
}
func (c *Compiler) GetLdResolveCircularDeps() bool {
	return c.ldResolveCircularDeps
}
func (c *Compiler) GetCompilerInfo() CompilerInfo {
	return c.info
}
func (c *Compiler) GetLocalCompilerInfo() CompilerInfo {
	return c.lclInfo
}
type CompilerJob struct {
	Filename     string
	Compiler     *Compiler
	CompilerType int
}
func NewCompilerInfo() *CompilerInfo {
	ci := &CompilerInfo{}
	ci.Includes = []string{}
	ci.Cflags = []string{}
	ci.CXXflags = []string{}
	ci.Lflags = []string{}
	ci.Aflags = []string{}
	ci.IgnoreFiles = []*regexp.Regexp{}
	ci.IgnoreDirs = []*regexp.Regexp{}
	return ci
}