Add a mkfiledir variable that evuates to the full path of the current mkfile.

This commit is contained in:
Daniel Jones 2014-08-05 14:16:59 -07:00
parent 4554b8c6cb
commit 49fdbebf48
2 changed files with 22 additions and 7 deletions

8
mk.go
View file

@ -6,6 +6,7 @@ import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
"sync"
)
@ -312,7 +313,12 @@ func main() {
input, _ := ioutil.ReadAll(mkfile)
mkfile.Close()
rs := parse(string(input), mkfilepath)
abspath, err := filepath.Abs(mkfilepath)
if err != nil {
mkError("unable to find mkfile's absolute path")
}
rs := parse(string(input), mkfilepath, abspath)
targets := flag.Args()
// build the first non-meta rule in the makefile, if none are given explicitly