forked from hwaf/hwaf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmd_waf_show_cmtcfg.go
54 lines (44 loc) · 1.11 KB
/
cmd_waf_show_cmtcfg.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package main
import (
"fmt"
"path/filepath"
"github.com/gonuts/commander"
"github.com/gonuts/flag"
"github.com/hwaf/hwaf/hwaflib"
)
func hwaf_make_cmd_waf_show_cmtcfg() *commander.Command {
cmd := &commander.Command{
Run: hwaf_run_cmd_waf_show_cmtcfg,
UsageLine: "cmtcfg",
Short: "show local project's CMTCFG value",
Long: `
show cmtcfg displays the project's CMTCFG value.
ex:
$ hwaf show cmtcfg
x86_64-linux-gcc-opt
`,
Flag: *flag.NewFlagSet("hwaf-waf-show-cmtcfg", flag.ExitOnError),
}
return cmd
}
func hwaf_run_cmd_waf_show_cmtcfg(cmd *commander.Command, args []string) {
var err error
//n := "hwaf-" + cmd.Name()
workdir, err := g_ctx.Workarea()
handle_err(err)
// FIXME: get actual value from waf, somehow
pinfo_name := filepath.Join(workdir, "__build__", "c4che", "_cache.py")
if !path_exists(pinfo_name) {
err = fmt.Errorf(
"no such file [%s]. did you run \"hwaf configure\" ?",
pinfo_name,
)
handle_err(err)
}
pinfo, err := hwaflib.NewProjectInfo(pinfo_name)
handle_err(err)
cmtcfg, err := pinfo.Get("CMTCFG")
handle_err(err)
fmt.Printf("%s\n", cmtcfg)
}
// EOF