This repository has been archived by the owner on May 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
247 lines (189 loc) · 6.5 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
#
# Author: Markus Stenberg <fingon@iki.fi>
#
# Copyright (c) 2017 Markus Stenberg
#
# Created: Fri Aug 11 16:08:26 2017 mstenber
# Last modified: Thu Mar 7 14:38:07 2019 mstenber
# Edit time: 152 min
#
#
GREENPACKS=$(wildcard */*_greenpack.go) $(wildcard */*/*_greenpack.go)
GREENPACK_OPTS=-alltuple
# ^ remove -alltuple someday if we want to pretend to be compatible over versions
GENERATED=\
ibtree/hugger/treerootpointer_gen.go \
fs/inodemetapointer_gen.go \
fs/deletenotifylist_gen.go \
fs/deletenotifyichannel_gen.go \
storage/blockpointerfuture_gen.go \
util/bytesliceatomiclist_gen.go \
util/byteslicefuture_gen.go \
util/byteslicepointer_gen.go \
util/stringlist_gen.go \
util/maprunnercallbacklist_gen.go \
storage/jobtype_string.go \
xxx/xxxcartentrylist_gen.go \
ibtree/nodedatacartentrylist_gen.go \
ibtree/nodedatacart_gen.go
SUBDIRS=\
codec fs ibtree ibtree/hugger mlog server \
storage storage/badger storage/bolt util
BINARIES=tfhfs tfhfs-connector
all: generate test binaries
binaries: $(BINARIES)
bench: .done.buildable
go test ./... -bench .
cover: .done.cover
html-cover: .done.cover
grep -v '_gen.go:' .done.cover > .done.cover.nongen
go tool cover -html=.done.cover.nongen
get: .done.getprebuild
generate: .done.buildable
storage/jobtype_string.go: storage/storagejob.go
( cd storage && stringer -type=jobType . )
ibtree/hugger/treerootpointer_gen.go: Makefile xxx/pointer.go
( echo "package hugger" ; \
egrep -A 9999 '^import' xxx/pointer.go | \
sed 's/XXXType/(*treeRoot)/g;s/XXX/treeRoot/g' | \
cat ) > $@.new
mv $@.new $@
fs/inodemetapointer_gen.go: Makefile xxx/pointer.go
( echo "package fs" ; \
egrep -A 9999 '^import' xxx/pointer.go | \
sed 's/XXXType/(*InodeMeta)/g;s/XXX/InodeMeta/g' | \
cat ) > $@.new
mv $@.new $@
storage/blockpointerfuture_gen.go: Makefile xxx/future.go
( echo "package storage" ; \
egrep -A 9999 '^import' xxx/future.go | \
sed 's/YYYType/*Block/g;s/YYY/BlockPointer/g' | \
cat ) > $@.new
mv $@.new $@
util/bytesliceatomiclist_gen.go: Makefile xxx/atomiclist.go
( echo "package util" ; \
egrep -A 9999 '^import' xxx/atomiclist.go | \
egrep -v '/util"' | \
sed 's/util\.//g;s/XXXType/[]byte/g;s/XXX/ByteSlice/g;s/xxx/byteSlice/g' | \
cat ) > $@.new
mv $@.new $@
util/byteslicefuture_gen.go: Makefile xxx/future.go
( echo "package util" ; \
egrep -A 9999 '^import' xxx/future.go | \
egrep -v '/util"' | \
sed 's/util\.//g;s/YYYType/[]byte/g;s/YYY/ByteSlice/g' | \
cat ) > $@.new
mv $@.new $@
util/byteslicepointer_gen.go: Makefile xxx/pointer.go
( echo "package util" ; \
egrep -A 9999 '^import' xxx/pointer.go | \
sed 's/XXXType/(*[]byte)/g;s/XXX/ByteSlice/g' | \
cat ) > $@.new
mv $@.new $@
util/stringlist_gen.go: Makefile xxx/list.go
( echo "package util" ; \
egrep -A 9999 '^import' xxx/list.go | \
sed 's/YYYType/string/g;s/YYY/String/g' | \
cat ) > $@.new
mv $@.new $@
fs/deletenotifylist_gen.go: Makefile xxx/list.go
( echo "package fs" ; \
egrep -A 9999 '^import' xxx/list.go | \
sed 's/YYYType/deleteNotify/g;s/YYY/deleteNotify/g' | \
cat ) > $@.new
mv $@.new $@
fs/deletenotifyichannel_gen.go: Makefile xxx/ichannel.go
( echo "package fs" ; \
egrep -A 9999 '^import' xxx/ichannel.go | \
sed 's/YYYType/deleteNotify/g;s/YYY/deleteNotify/g' | \
cat ) > $@.new
mv $@.new $@
util/maprunnercallbacklist_gen.go: Makefile xxx/list.go
( echo "package util" ; \
egrep -A 9999 '^import' xxx/list.go | \
sed 's/YYYType/MapRunnerCallback/g;s/YYY/MapRunnerCallback/g' | \
cat ) > $@.new
mv $@.new $@
xxx/xxxcartentrylist_gen.go: Makefile xxx/list.go
( echo "package xxx" ; \
egrep -A 9999 '^import' xxx/list.go | \
sed 's/YYY/XXXCartEntry/g;s/XXXCartEntryType/*XXXCartEntry/g' | \
cat ) > $@.new
mv $@.new $@
ibtree/nodedatacartentrylist_gen.go: Makefile xxx/list.go
( echo "package ibtree" ; \
egrep -A 9999 '^import' xxx/list.go | \
sed 's/YYY/NodeDataCartEntry/g;s/NodeDataCartEntryType/*NodeDataCartEntry/g' | \
cat ) > $@.new
mv $@.new $@
ibtree/nodedatacart_gen.go: Makefile xxx/cart.go
( echo "package ibtree" ; \
egrep -A 9999 '^import' xxx/cart.go | \
sed 's/XXX/NodeDataCart/g;s/CartCart/Cart/g;s/NodeDataCartType/*NodeData/g;s/ZZZType/BlockId/g' | \
cat ) > $@.new
mv $@.new $@
prof-%: .done.cpuprof.%
go tool pprof $<
test: .done.test
tfhfs: cmd/tfhfs/tfhfs.go $(wildcard */*.go)
go build -o ./tfhfs cmd/tfhfs/tfhfs.go
tfhfs-darwin: .done.test tfhfs
GOOS=darwin go build -o tfhfs-darwin cmd/tfhfs/tfhfs.go
tfhfs-linux: .done.test tfhfs
GOOS=linux go build -o tfhfs-linux cmd/tfhfs/tfhfs.go
tfhfs-connector: cmd/tfhfs-connector/tfhfs-connector.go $(wildcard */*.go)
go build -o ./tfhfs-connector cmd/tfhfs-connector/tfhfs-connector.go
.done.cover: .done.buildable $(wildcard %/*.go) $(wildcard %/*.go)
go test ./... -coverprofile=.done.cover.new
mv .done.cover.new .done.cover
.done.cpuprof.%: .done.buildable $(wildcard %/*.go)
(cd $* && go test -cpuprofile=../$@.new)
mv $@.new $@
.done.getprebuild: Makefile go-get-deps.txt
for LINE in `cat go-get-deps.txt`; do go get $$LINE; done
touch $@
.done.greenpack: .done.getprebuild $(GREENPACKS)
for FILE in $(GREENPACKS); do greenpack $(GREENPACK_OPTS) -file $$FILE ; done
touch $@
.done.buildable: .done.greenpack .done.protoc .done.generated .done.mlog
touch $@
.done.generated: $(GENERATED)
touch $@
.done.test: .done.buildable .done.generated $(wildcard */*.go)
go test ./...
touch $@
.done.mlog: Makefile $(wildcard */*.go)
find . -type f -name '*.go' | sed 's/^\.\///' | xargs python3 mlog/fix-print2.py
touch $@
.done.protoc: Makefile pb/$(wildcard *.proto)
(cd pb && protoc --go_out=. --twirp_out=. *.proto )
touch $@
prep-perf:
rm -rf /tmp/perf
mkdir -p /tmp/perf/size
mkdir -p /tmp/perf/amount
cp ~/software/mac/install-mojave.tgz /tmp/perf/size
rsync -a ~/share/1/Maildir/.Junk /tmp/perf/amount
perf.md: .done.perf
cp .done.perf $@
.done.perf: tfhfs
support/perf_fs.py | tee $@.new
egrep -q 'Took ' $@.new
mv $@.new $@
# System test targets
# https://github.com/fingon/fstest [fuse branch]
fstest: binaries
./sanitytest.sh d
cd /tmp/x && sudo prove -f -o -r ~/git/fstest/tests && umount /tmp/x
# https://github.com/macosforge/fstools
fstorture: binaries
./sanitytest.sh d
mkdir -p /tmp/x/d1
mkdir -p /tmp/x/d2
~/git/fstools/src/fstorture/fstorture /tmp/d[12] 123 -t 1m
# https://github.com/pjd/pjdfstest
logs/pjdfstest/tfhfs.log: binaries
./sanitytest.sh d
( cd /tmp/x && sudo prove -f -o -r ~/git/pjdfstest/tests 2>&1) | tee $@.new ; umount /tmp/x
mv $@.new $@
pjdfstest: logs/pjdfstest/tfhfs.log