Provide a way to show the list of read Makefiles
diff --git a/main.go b/main.go
index 2c8285e..b58b9de 100644
--- a/main.go
+++ b/main.go
@@ -324,7 +324,7 @@
}
if queryFlag != "" {
- HandleQuery(queryFlag, nodes, vars)
+ HandleQuery(queryFlag, g)
return
}
diff --git a/query.go b/query.go
index 095459e..31053ca 100644
--- a/query.go
+++ b/query.go
@@ -53,19 +53,26 @@
}
}
-func HandleQuery(q string, nodes []*DepNode, vars Vars) {
+func HandleQuery(q string, g *DepGraph) {
+ if q == "$MAKEFILE_LIST" {
+ for _, mk := range g.readMks {
+ fmt.Printf("%s: state=%d\n", mk.Filename, mk.State)
+ }
+ return
+ }
+
if q == "$*" {
- for k, v := range vars {
+ for k, v := range g.vars {
fmt.Printf("%s=%s\n", k, v.String())
}
return
}
if q == "*" {
- for _, n := range nodes {
+ for _, n := range g.nodes {
fmt.Printf("%s\n", n.Output)
}
return
}
- HandleNodeQuery(q, nodes)
+ HandleNodeQuery(q, g.nodes)
}