Skip to content

Commit eeea1fc

Browse files
committed
makefile
1 parent 63c102f commit eeea1fc

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@ _testmain.go
2222
*.exe
2323
*.test
2424
*.prof
25+
26+
env/
27+
hooks/

Makefile

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
go_version = go1.6.2.linux-amd64
2+
3+
go:
4+
5+
@echo "\033[1mInstall Go compiler\033[0m"
6+
7+
@[ -d env ] || mkdir env
8+
9+
@if [ ! -d env/go ]; then \
10+
cd env && \
11+
wget https://storage.googleapis.com/golang/$(go_version).tar.gz && \
12+
tar -xf ./$(go_version).tar.gz && \
13+
mkdir gopath && \
14+
rm ./$(go_version).tar.gz ; \
15+
fi
16+
17+
@GOROOT=$(shell pwd)/env/go \
18+
GOPATH=$(shell pwd)/env/gopath \
19+
env/go/bin/go get -u github.com/FiloSottile/gvt
20+
21+
@GOROOT=$(shell pwd)/env/go \
22+
GOPATH=$(shell pwd)/env/gopath \
23+
env/go/bin/go get -u github.com/kshvakov/build-html
24+
25+
@echo "\033[1mGo compiler installed!\033[0m"
26+
27+
build-hooks:
28+
29+
@echo "\033[1mBuild hooks\033[0m"
30+
31+
@rm -rf hooks && mkdir -p hooks/bin && \
32+
rm -rf env/gopath/src/github.com/postgres-ci/hooks
33+
34+
@git clone -b master https://github.com/postgres-ci/hooks.git env/gopath/src/github.com/postgres-ci/hooks
35+
36+
@echo "\033[1mBuild post-commit hook\033[0m"
37+
38+
@GOROOT=$(shell pwd)/env/go \
39+
GOPATH=$(shell pwd)/env/gopath \
40+
env/go/bin/go build -ldflags='-s -w' -o hooks/bin/post-commit \
41+
env/gopath/src/github.com/postgres-ci/hooks/local/bin/post-commit.go
42+
43+
@echo "\033[1mBuild post-receive hook\033[0m"
44+
45+
@GOROOT=$(shell pwd)/env/go \
46+
GOPATH=$(shell pwd)/env/gopath \
47+
env/go/bin/go build -ldflags='-s -w' -o hooks/bin/post-receive \
48+
env/gopath/src/github.com/postgres-ci/hooks/server-side/bin/post-receive.go
49+
50+
@cp env/gopath/src/github.com/postgres-ci/hooks/local/post-commit.sample hooks
51+
@cp env/gopath/src/github.com/postgres-ci/hooks/server-side/post-receive.sample hooks
52+
53+
@echo "\033[1mBuild hooks: done!\033[0m"
54+
55+
56+
all: go build-hooks

0 commit comments

Comments
 (0)