aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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