summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile16
1 files changed, 7 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index a80916b..d11c945 100644
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,10 @@
-SUBDIRS := cmd/tunnel cmd/tunneld
-TARGETS := build clean install
+COMMIT = $(shell git describe --always --long --dirt)
+TIME = $(shell date +'%Y-%m-%d/%H:%M:%S')
+VERSION = $(COMMIT) at $(TIME)
+LDFLAGS = -ldflags "-X 'main.BuildVersion=$(VERSION)'"
-.PHONY: default
-default: build
-
-$(TARGETS): $(SUBDIRS)
-$(SUBDIRS):
- @$(MAKE) -C $@ $(MAKECMDGOALS)
+build:
+ go build $(LDFLAGS) -v -o bin/ ./...
fmt:
go fmt tunnel/...
@@ -14,4 +12,4 @@ fmt:
test:
go test tunnel/pkg/test
-.PHONY: $(TARGETS) $(SUBDIRS) test
+.PHONY: build fmt test