aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-01-08 16:42:30 +0100
committerDimitri Sokolyuk <demon@dim13.org>2015-01-08 16:42:30 +0100
commitc0b7b03138ae64bdf36fe2153ba07f083fb2d7a1 (patch)
treea6956d725a386bf0f0dda9b871fdb4af72a09dc2
parentdf12c567d70b03022bd97f86a79c759eefe67350 (diff)
refine auto make
-rw-r--r--.gitignore3
-rw-r--r--Makefile16
2 files changed, 15 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
index f217972..2ac56a5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,6 @@
calc
calc.go
y.output
+*~
+*.swp
+*.swo
diff --git a/Makefile b/Makefile
index a615f2c..65004bb 100644
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,20 @@
PROG := calc
+GO := go
+GOFILES := $(wildcard *.go)
+YYFILES := $(wildcard *.y)
+AUTOGEN := $(YYFILES:.y=.go)
-$(PROG): $(wildcard *.go) $(PROG).go
- go build
+$(PROG): $(GOFILES) $(AUTOGEN)
+ $(GO) build
%.go: %.y
- go tool yacc -o $@ $<
+ $(GO) tool yacc -o $@ $<
clean:
- $(RM) $(PROG) $(PROG).go y.output
+ $(GO) clean
+ $(RM) $(AUTOGEN) y.output
+
+install:
+ $(GO) install
.PHONY: clean