-
Notifications
You must be signed in to change notification settings - Fork 53
/
Makefile
98 lines (79 loc) · 2.64 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
GODOC_REV=11bd89d4e1e9a84d4d66c88b7eccfecd66e8f6c9
GO_VER=go1.3
WORKSPACE:=$(shell pwd)/_tmp
export GOPATH=${WORKSPACE}/sub
export PATH:=${GOPATH}/bin:${PATH}
_GOROOT:=${WORKSPACE}/go
GOREPO=code.google.com/p
APP=${GOPATH}/src/godoc
APP_CONTENTS=${APP}/doc/godoc.zip
.PHONY: all
all: update build_doc
.PHONY: clean
clean:
rm -rf ${APP}
rm -rf ${_GOROOT}/*
tr_status:=${_GOROOT}/status/translate.html
tr_tool:=github.com/atotto/gophersjp-go-util/cmd/translate-status
${tr_status}: ${_GOROOT} ${GOPATH}/src/${GOREPO}/go.tools
go get -u ${tr_tool}
mkdir -p ${_GOROOT}/status
translate-status -docroot=$(shell pwd) -goroot=${_GOROOT} -o=$@
build_doc: update_doc ${tr_status} ${APP_CONTENTS}
.PHONY: update_doc
update_doc: ${_GOROOT} ${GOPATH}/src/${GOREPO}/go.tools
#cd ${GOPATH}/src; find code.google.com/p/go.tools -type d -not -path '*/.hg/*'\
# -exec mkdir -p '${_GOROOT}/src/{}' ';'
#cd ${GOPATH}/src; find code.google.com/p/go.tools -type f -not -path '*/.hg/*'\
# -exec cp '{}' '${_GOROOT}/src/{}' ';'
find */ -type d -not -path '.*' -not -path '_tmp/*' \
-exec mkdir -p '${_GOROOT}/{}' ';'
find */ -type f -not -path '.*' -not -path '_tmp/*' \
-exec cp '{}' '${_GOROOT}/{}' ';'
${APP_CONTENTS}: update_doc
which zip || sudo apt-get install zip
mkdir -p ${APP}/doc
cd ${_GOROOT}/../;\
zip -q -r $@ go/*
public:
cp _robots.txt ${_GOROOT}/robots.txt
cd ${_GOROOT}/../;\
zip -f -r ${APP_CONTENTS} go/*
.PHONY: run
run: update_doc
GOPATH="";godoc -http=:6060 -play -goroot=${_GOROOT}
.PHONY: godep
godep:
which godep ||go get -u github.com/kr/godep
${APP}/godeps: godep
cd ${GOPATH}/src/${GOREPO}/go.tools; hg checkout ${GODOC_REV}
mkdir -p ${APP}
cd ${APP};\
cp -r ${GOPATH}/src/${GOREPO}/go.tools/cmd/godoc/* ${APP};\
git init;\
git add -A;\
git commit -a -m "Add godoc app";\
echo 'web: godoc -http=:$$PORT -play -zip=doc/godoc.zip -goroot=/go' > Procfile;\
git add -A;\
git commit -a -m "Add Procfile";\
godep save;\
git add -A .;\
git commit -a -m "Save godep";\
cat Godeps/Godeps.json | jq -a '.GoVersion = "${GO_VER}"' > Godeps.json;\
mv Godeps.json Godeps/Godeps.json;\
git commit -a -m "go version ${GO_VER}"
deploy: ${APP_CONTENTS} ${APP}/godeps
cd ${APP};\
git remote add heroku-deploy ${HEROKU};\
git push -f heroku-deploy master;\
update: ${_GOROOT} ${GOPATH}/src/${GOREPO}/go.tools
cd ${_GOROOT};\
rm -rf ${_GOROOT}/src/${GOREPO};\
hg checkout tip -C;\
hg --config extensions.purge= clean;\
hg pull; hg update tip
cd ${GOPATH}/src/${GOREPO}/go.tools; hg pull; hg update tip
${_GOROOT}:
hg clone -u tip https://code.google.com/p/go $@
${GOPATH}/src/${GOREPO}/go.tools:
hg clone -u tip https://code.google.com/p/go.tools $@