diff --git a/expand.go b/expand.go index e33df6d..4bb0684 100644 --- a/expand.go +++ b/expand.go @@ -234,9 +234,10 @@ func expandSuffixes(input string, stem string) string { } c, w := utf8.DecodeRuneInString(input[j:]) + expanded = append(expanded, input[i:j]...) if c == '%' { expanded = append(expanded, stem...) - i += w + i = j + w } else { j += w c, w := utf8.DecodeRuneInString(input[j:]) diff --git a/graph.go b/graph.go index 4c16fec..18bcd32 100644 --- a/graph.go +++ b/graph.go @@ -72,6 +72,10 @@ func (u *node) updateTimestamp() { mkError(err.Error()) } } + + if rebuildall { + u.flags |= nodeFlagProbable + } } // Create a new node diff --git a/mk.go b/mk.go index 925f31e..554aa37 100644 --- a/mk.go +++ b/mk.go @@ -97,7 +97,7 @@ func mkNode(g *graph, u *node) { if len(u.prereqs) == 0 { if !(u.r != nil && u.r.attributes.virtual) && !u.exists { wd, _ := os.Getwd() - mkError(fmt.Sprintf("don't know how to make %s in %s", u.name, wd)) + mkError(fmt.Sprintf("don't know how to make %s in %s\n", u.name, wd)) } return } @@ -200,11 +200,11 @@ func mkPrintRecipe(target string, recipe string) { if nocolor { fmt.Printf("%s: ", target) } else { - fmt.Printf("%s%s%s →\n%s", + fmt.Printf("%s%s%s → %s", ansiTermBlue+ansiTermBright+ansiTermUnderline, target, ansiTermDefault, ansiTermBlue) } - printIndented(os.Stdout, recipe, 4) + printIndented(os.Stdout, recipe, len(target)+3) if len(recipe) == 0 { os.Stdout.WriteString("\n") } diff --git a/parse.go b/parse.go index 44053f4..012b40f 100644 --- a/parse.go +++ b/parse.go @@ -347,7 +347,7 @@ func parseRecipe(p *parser, t token) parserStateFun { } if t.typ == tokenRecipe { - r.recipe = stripIndentation(t.val, t.col) + r.recipe = expandRecipeSigils(stripIndentation(t.val, t.col), p.rules.vars) } p.rules.add(r) diff --git a/recipe.go b/recipe.go index 336ac31..a0fedce 100644 --- a/recipe.go +++ b/recipe.go @@ -46,15 +46,19 @@ func stripIndentation(s string, mincol int) string { func printIndented(out io.Writer, s string, ind int) { indentation := strings.Repeat(" ", ind) reader := bufio.NewReader(strings.NewReader(s)) + firstline := true for { line, err := reader.ReadString('\n') if len(line) > 0 { - io.WriteString(out, indentation) + if !firstline { + io.WriteString(out, indentation) + } io.WriteString(out, line) } if err != nil { break } + firstline = false } }