forked from aantron/luv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
157 lines (141 loc) · 4.54 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
.PHONY : build
build :
dune build -p luv
.PHONY : test
test :
dune runtest --no-buffer --force
.PHONY : examples
examples :
dune build \
example/hello_world.exe \
example/delay.exe \
example/idle.exe \
example/cat.exe \
example/onchange.exe \
example/tcp_echo_server.exe \
example/tcp_hello_world.exe \
example/udp_echo_server.exe \
example/udp_hello_world.exe \
example/host.exe \
example/http_get.exe \
example/readme.exe \
example/ifconfig.exe \
example/threads.exe \
example/thread_pool.exe \
example/mutex.exe \
example/progress.exe \
example/spawn.exe \
example/stdout.exe \
example/pipe.exe \
example/pipe_echo_server.exe \
example/pipe_hello_world.exe \
example/send_signal.exe \
example/sigint.exe
_build/default/example/hello_world.exe
_build/default/example/delay.exe
_build/default/example/idle.exe
_build/default/example/cat.exe LICENSE.md
(_build/default/example/onchange.exe false LICENSE.md || true) & \
(sleep 1; touch LICENSE.md)
_build/default/example/tcp_echo_server.exe & \
(_build/default/example/tcp_hello_world.exe; \
sleep 1; killall tcp_echo_server.exe)
_build/default/example/udp_echo_server.exe & \
(_build/default/example/udp_hello_world.exe; \
sleep 1; killall udp_echo_server.exe)
_build/default/example/host.exe localhost
_build/default/example/http_get.exe google.com /
_build/default/example/readme.exe || true
_build/default/example/ifconfig.exe
_build/default/example/threads.exe
_build/default/example/thread_pool.exe
_build/default/example/mutex.exe
_build/default/example/progress.exe
_build/default/example/spawn.exe
_build/default/example/stdout.exe
_build/default/example/pipe.exe
rm -f echo-pipe
_build/default/example/pipe_echo_server.exe & \
(_build/default/example/pipe_hello_world.exe; \
sleep 1; killall pipe_echo_server.exe)
_build/default/example/send_signal.exe
bash -c "[ A$$TRAVIS == Atrue ]" || _build/default/example/sigint.exe
.PHONY : test-installation
test-installation : clean
opam pin add -y --no-action luv . --kind=path
opam reinstall -y luv
cd test/installation && dune exec ./user.exe
opam remove -y luv
.PHONY : test-installation-ci
test-installation-ci :
opam pin add -y --no-action luv . --kind=git
opam install -y luv
cd test/installation && dune exec ./user.exe
opam remove -y luv
opam pin remove -y luv
.PHONY : docs
docs : api-docs luvbook
.PHONY : api-docs
api-docs :
dune build @doc -p luv
.PHONY : luvbook
luvbook :
sphinx-build -b html docs docs/_build
.PHONY : watch-api-docs
watch-api-docs : api-docs
inotifywait -mr -e modify --format '%f' src \
| xargs -L1 -I X make api-docs
.PHONY : watch-luvbook
watch-luvbook : luvbook
inotifywait -mr -e modify docs/conf.py docs/*.rst example \
| xargs -L1 -I X make luvbook
# make watch-api-docs &
# make watch-luvbook &
# open _build/default/_doc/_html/index.html
# open docs/_build/index.html
DOCS := ../gh-pages
.PHONY : stage-docs
stage-docs : api-docs luvbook
[ -d $(DOCS) ] || git clone [email protected]:aantron/luv.git $(DOCS)
cd $(DOCS) && git checkout gh-pages
rm -rf $(DOCS)/*
cp -r _build/default/_doc/_html/* $(DOCS)
cp -r docs/_build/* $(DOCS)
cd $(DOCS) && mv _static static
cd $(DOCS) && mv _sources sources
cd $(DOCS) && ls *.html | xargs -L1 sed -i 's#_static/#static/#g'
cd $(DOCS) && ls *.html | xargs -L1 sed -i 's#_sources/#sources/#g'
cd $(DOCS) && git add -A && git commit --amend --no-edit --reset-author
.PHONY : publish-docs
publish-docs : stage-docs
cd $(DOCS) && git push --force-with-lease
VERSION := $(shell git describe --abbrev=0)
RELEASE := luv-$(VERSION)
.PHONY : release
release : clean
rm -rf $(RELEASE) $(RELEASE).tar $(RELEASE).tar.gz _release
mkdir $(RELEASE)
cp -r dune-project LICENSE.md luv.opam README.md src $(RELEASE)
rm -rf $(RELEASE)/src/c/vendor/gyp/test
rm -rf $(RELEASE)/src/c/vendor/gyp/tools
rm -rf $(RELEASE)/src/c/vendor/libuv/docs
rm -rf $(RELEASE)/src/c/vendor/libuv/img
sed -i "s/version: \"dev\"/version: \"$(VERSION)\"/" $(RELEASE)/luv.opam
diff -u luv.opam $(RELEASE)/luv.opam || true
tar cf $(RELEASE).tar $(RELEASE)
ls -l $(RELEASE).tar
gzip -9 $(RELEASE).tar
ls -l $(RELEASE).tar.gz
mkdir -p _release
cp $(RELEASE).tar.gz _release
(cd _release && tar xf $(RELEASE).tar.gz)
opam pin add -y --no-action luv _release/$(RELEASE) --kind=path
opam reinstall -y --verbose luv
cd test/installation && dune exec ./user.exe
opam remove -y luv
opam pin remove -y luv
md5sum $(RELEASE).tar.gz
.PHONY : clean
clean :
dune clean
rm -rf docs/_build luv-* *.tar *.tar.gz _release *.install echo-pipe