aboutsummaryrefslogtreecommitdiff
path: root/exec.go
diff options
context:
space:
mode:
authorFumitoshi Ukai <fumitoshi.ukai@gmail.com>2015-04-22 23:27:18 +0900
committerFumitoshi Ukai <fumitoshi.ukai@gmail.com>2015-04-22 23:27:58 +0900
commitab431e2847071432953a10e463d2e2e62a34d51e (patch)
tree0c7060632aa28617c0e0ea1ffe9eab9569a9a503 /exec.go
parentf4d3ee5b3dfcb6ef7052b29e6f08c022cc2aae54 (diff)
downloadkati-ab431e2847071432953a10e463d2e2e62a34d51e.tar.gz
fix phony
Diffstat (limited to 'exec.go')
-rw-r--r--exec.go18
1 files changed, 13 insertions, 5 deletions
diff --git a/exec.go b/exec.go
index 02dc239..5b7fd48 100644
--- a/exec.go
+++ b/exec.go
@@ -232,7 +232,7 @@ func (ex *Executor) build(n *DepNode, neededBy string) (int64, error) {
outputTs, ok := ex.done[output]
if ok {
- if outputTs < 0 {
+ if outputTs < 0 && !n.IsPhony {
fmt.Printf("Circular %s <- %s dependency dropped.\n", neededBy, output)
}
Log("Building: %s already done: %d", output, outputTs)
@@ -240,10 +240,14 @@ func (ex *Executor) build(n *DepNode, neededBy string) (int64, error) {
return outputTs, nil
}
ex.done[output] = -1
- outputTs = getTimestamp(output)
+ if n.IsPhony {
+ outputTs = -2 // trigger cmd even if all inputs don't exist.
+ } else {
+ outputTs = getTimestamp(output)
+ }
if !n.HasRule {
- if outputTs >= 0 {
+ if outputTs >= 0 || n.IsPhony {
ex.done[output] = outputTs
ex.noRuleCnt++
return outputTs, nil
@@ -257,7 +261,7 @@ func (ex *Executor) build(n *DepNode, neededBy string) (int64, error) {
}
latest := int64(-1)
- Log("Building: %s inputs:%q", output, n.Deps)
+ Log("Building: %s inputs:%q ts=%d", output, n.Deps, outputTs)
for _, d := range n.Deps {
if d.IsOrderOnly && exists(d.Output) {
continue
@@ -323,7 +327,11 @@ func (ex *Executor) build(n *DepNode, neededBy string) (int64, error) {
}
}
- outputTs = getTimestamp(output)
+ if n.IsPhony {
+ outputTs = time.Now().Unix()
+ } else {
+ outputTs = getTimestamp(output)
+ }
if outputTs < 0 {
outputTs = time.Now().Unix()
}