-
Notifications
You must be signed in to change notification settings - Fork 24
/
Makefile
44 lines (37 loc) · 1.1 KB
/
Makefile
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
# Basic Go makefile
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
all: build
build:
$(GOBUILD) -v
test:
$(GOTEST) -v ./...
clean:
$(GOCLEAN)
# NOTE: MUST update version number here prior to running 'make release'
VERS=v2.0.0-dev0.0.2
PACKAGE=emer
GIT_COMMIT=`git rev-parse --short HEAD`
VERS_DATE=`date -u +%Y-%m-%d\ %H:%M`
VERS_FILE=version.go
release:
/bin/rm -f $(VERS_FILE)
@echo "// WARNING: auto-generated by Makefile release target -- run 'make release' to update" > $(VERS_FILE)
@echo "" >> $(VERS_FILE)
@echo "package $(PACKAGE)" >> $(VERS_FILE)
@echo "" >> $(VERS_FILE)
@echo "const (" >> $(VERS_FILE)
@echo " Version = \"$(VERS)\"" >> $(VERS_FILE)
@echo " GitCommit = \"$(GIT_COMMIT)\" // the commit JUST BEFORE the release" >> $(VERS_FILE)
@echo " VersionDate = \"$(VERS_DATE)\" // UTC" >> $(VERS_FILE)
@echo ")" >> $(VERS_FILE)
@echo "" >> $(VERS_FILE)
goimports -w $(VERS_FILE)
/bin/cat $(VERS_FILE)
git commit -am "$(VERS) release -- $(VERS_FILE) updated"
git tag -a $(VERS) -m "$(VERS) release"
git push
git push origin --tags