func (c *Config) Expand(orig *Makefile) (*Makefile, error) {
	var mf Makefile
	mf.Rules = make([]Rule, len(orig.Rules))
	for i, rule := range orig.Rules {
		expandedPrereqs, err := c.globs(rule.Prereqs())
		if err != nil {
			return nil, err
		}
		mf.Rules[i] = &BasicRule{
			TargetFile:  rule.Target(),
			PrereqFiles: expandedPrereqs,
			RecipeCmds:  rule.Recipes(),
		}
	}
	return &mf, nil
}
Expand returns a clone of mf with Prereqs filepath globs expanded. If rules
contain globs, they are replaced with BasicRules with the globs expanded.

Only globs containing "*" are detected.
package makex
import (
	"bytes"
	"fmt"
	"path/filepath"
	"regexp"
	"strconv"
	"strings"
	"sourcegraph.com/sourcegraph/rwvfs"
)
type Makefile struct {
	Rules []Rule
}
type BasicRule struct {
	TargetFile  string
	PrereqFiles []string
	RecipeCmds  []string
}
func (r *BasicRule) Target() string { return r.TargetFile }
func (r *BasicRule) Prereqs() []string { return r.PrereqFiles }
func (r *BasicRule) Recipes() []string { return r.RecipeCmds }
func (mf *Makefile) Rule(target string) Rule {
	for _, rule := range mf.Rules {
		if rule.Target() == target {
			return rule
		}
	}
	return nil
}
type Rule interface {
	Target() string
	Prereqs() []string
	Recipes() []string
}
func (mf *Makefile) DefaultRule() Rule {
	for _, rule := range mf.Rules {
		target := rule.Target()
		if !strings.HasPrefix(target, ".") {
			return rule
		}
	}
	return nil
}