1
1
SHELL =/usr/bin/env bash
2
2
3
- all : build
3
+ all : build # # Build all main binaries (default target)
4
+
4
5
.PHONY : all
5
6
6
7
unexport GOFLAGS
@@ -46,13 +47,13 @@ MODULES+=$(FFI_PATH)
46
47
BUILD_DEPS+ =build/.filecoin-install
47
48
CLEAN+ =build/.filecoin-install
48
49
49
- ffi-version-check :
50
+ ffi-version-check : # # Check FFI version compatibility
50
51
@[[ " $$ (awk '/const Version/{print $$ 5}' extern/filecoin-ffi/version.go)" -eq 3 ]] || (echo " FFI version mismatch, update submodules" ; exit 1)
51
52
BUILD_DEPS+ =ffi-version-check
52
53
53
54
.PHONY : ffi-version-check
54
55
55
- $(MODULES ) : build/.update-modules ;
56
+ $(MODULES ) : build/.update-modules ; # # Update git submodules
56
57
# dummy file that marks the last time modules were updated
57
58
build/.update-modules :
58
59
git submodule update --init --recursive
@@ -64,169 +65,169 @@ build/.update-modules:
64
65
65
66
CLEAN+ =build/.update-modules
66
67
67
- deps : $(BUILD_DEPS )
68
+ deps : $(BUILD_DEPS ) # # Install build dependencies
68
69
.PHONY : deps
69
70
70
- build-devnets : build lotus-seed lotus-shed
71
+ build-devnets : build lotus-seed lotus-shed # # Build binaries for development networks
71
72
.PHONY : build-devnets
72
73
73
74
debug : GOFLAGS+=-tags=debug
74
- debug : build-devnets
75
+ debug : build-devnets # # Build with debug tags
75
76
76
77
2k : GOFLAGS+=-tags=2k
77
- 2k : build-devnets
78
+ 2k : build-devnets # # Build for 2k network
78
79
79
80
calibnet : GOFLAGS+=-tags=calibnet
80
- calibnet : build-devnets
81
+ calibnet : build-devnets # # Build for calibnet network
81
82
82
83
butterflynet : GOFLAGS+=-tags=butterflynet
83
- butterflynet : build-devnets
84
+ butterflynet : build-devnets # # Build for butterflynet network
84
85
85
86
interopnet : GOFLAGS+=-tags=interopnet
86
- interopnet : build-devnets
87
+ interopnet : build-devnets # # Build for interopnet network
87
88
88
- lotus : $(BUILD_DEPS )
89
+ lotus : $(BUILD_DEPS ) # # Build the main Lotus binary
89
90
rm -f lotus
90
91
$(GOCC ) build $(GOFLAGS ) -o lotus ./cmd/lotus
91
92
92
93
.PHONY : lotus
93
94
BINS+ =lotus
94
95
95
- lotus-miner : $(BUILD_DEPS )
96
+ lotus-miner : $(BUILD_DEPS ) # # Build the Lotus miner binary
96
97
rm -f lotus-miner
97
98
$(GOCC ) build $(GOFLAGS ) -o lotus-miner ./cmd/lotus-miner
98
99
.PHONY : lotus-miner
99
100
BINS+ =lotus-miner
100
101
101
- lotus-worker : $(BUILD_DEPS )
102
+ lotus-worker : $(BUILD_DEPS ) # # Build the Lotus worker binary
102
103
rm -f lotus-worker
103
104
$(GOCC ) build $(GOFLAGS ) -o lotus-worker ./cmd/lotus-worker
104
105
.PHONY : lotus-worker
105
106
BINS+ =lotus-worker
106
107
107
- lotus-shed : $(BUILD_DEPS )
108
+ lotus-shed : $(BUILD_DEPS ) # # Build the Lotus shed tool
108
109
rm -f lotus-shed
109
110
$(GOCC ) build $(GOFLAGS ) -o lotus-shed ./cmd/lotus-shed
110
111
.PHONY : lotus-shed
111
112
BINS+ =lotus-shed
112
113
113
- lotus-gateway : $(BUILD_DEPS )
114
+ lotus-gateway : $(BUILD_DEPS ) # # Build the Lotus gateway
114
115
rm -f lotus-gateway
115
116
$(GOCC ) build $(GOFLAGS ) -o lotus-gateway ./cmd/lotus-gateway
116
117
.PHONY : lotus-gateway
117
118
BINS+ =lotus-gateway
118
119
119
- build : lotus lotus-miner lotus-worker
120
+ build : lotus lotus-miner lotus-worker # # Build all main binaries
120
121
@[[ $$ (type -P " lotus" ) ]] && echo " Caution: you have \
121
122
an existing lotus binary in your PATH. This may cause problems if you don't run 'sudo make install'" || true
122
123
123
124
.PHONY : build
124
125
125
- install : install-daemon install-miner install-worker
126
+ install : install-daemon install-miner install-worker # # Install all binaries
126
127
127
- install-daemon :
128
+ install-daemon : # # Install the Lotus daemon
128
129
install -C ./lotus /usr/local/bin/lotus
129
130
130
- install-miner :
131
+ install-miner : # # Install the Lotus miner
131
132
install -C ./lotus-miner /usr/local/bin/lotus-miner
132
133
133
- install-worker :
134
+ install-worker : # # Install the Lotus worker
134
135
install -C ./lotus-worker /usr/local/bin/lotus-worker
135
136
136
- install-app :
137
+ install-app : # # Install a specified app
137
138
install -C ./$(APP ) /usr/local/bin/$(APP )
138
139
139
- uninstall : uninstall-daemon uninstall-miner uninstall-worker
140
+ uninstall : uninstall-daemon uninstall-miner uninstall-worker # # Uninstall all binaries
140
141
.PHONY : uninstall
141
142
142
- uninstall-daemon :
143
+ uninstall-daemon : # # Uninstall the Lotus daemon
143
144
rm -f /usr/local/bin/lotus
144
145
145
- uninstall-miner :
146
+ uninstall-miner : # # Uninstall the Lotus miner
146
147
rm -f /usr/local/bin/lotus-miner
147
148
148
- uninstall-worker :
149
+ uninstall-worker : # # Uninstall the Lotus worker
149
150
rm -f /usr/local/bin/lotus-worker
150
151
151
152
# TOOLS
152
153
153
- lotus-seed : $(BUILD_DEPS )
154
+ lotus-seed : $(BUILD_DEPS ) # # Build the Lotus seed tool
154
155
rm -f lotus-seed
155
156
$(GOCC ) build $(GOFLAGS ) -o lotus-seed ./cmd/lotus-seed
156
157
157
158
.PHONY : lotus-seed
158
159
BINS+ =lotus-seed
159
160
160
- benchmarks :
161
+ benchmarks : # # Run benchmarks and submit results
161
162
$(GOCC ) run github.com/whyrusleeping/bencher ./... > bench.json
162
163
@echo Submitting results
163
164
@curl -X POST ' http://benchmark.kittyhawk.wtf/benchmark' -d ' @bench.json' -u " ${benchmark_http_cred} "
164
165
.PHONY : benchmarks
165
166
166
- lotus-fountain :
167
+ lotus-fountain : # # Build the Lotus fountain tool
167
168
rm -f lotus-fountain
168
169
$(GOCC ) build $(GOFLAGS ) -o lotus-fountain ./cmd/lotus-fountain
169
170
$(GOCC ) run github.com/GeertJohan/go.rice/rice append --exec lotus-fountain -i ./cmd/lotus-fountain -i ./build
170
171
.PHONY : lotus-fountain
171
172
BINS+ =lotus-fountain
172
173
173
- lotus-bench :
174
+ lotus-bench : # # Build the Lotus bench tool
174
175
rm -f lotus-bench
175
176
$(GOCC ) build $(GOFLAGS ) -o lotus-bench ./cmd/lotus-bench
176
177
.PHONY : lotus-bench
177
178
BINS+ =lotus-bench
178
179
179
- lotus-stats :
180
+ lotus-stats : # # Build the Lotus stats tool
180
181
rm -f lotus-stats
181
182
$(GOCC ) build $(GOFLAGS ) -o lotus-stats ./cmd/lotus-stats
182
183
.PHONY : lotus-stats
183
184
BINS+ =lotus-stats
184
185
185
- lotus-pcr :
186
+ lotus-pcr : # # Build the Lotus PCR tool
186
187
rm -f lotus-pcr
187
188
$(GOCC ) build $(GOFLAGS ) -o lotus-pcr ./cmd/lotus-pcr
188
189
.PHONY : lotus-pcr
189
190
BINS+ =lotus-pcr
190
191
191
- lotus-health :
192
+ lotus-health : # # Build the Lotus health tool
192
193
rm -f lotus-health
193
194
$(GOCC ) build -o lotus-health ./cmd/lotus-health
194
195
.PHONY : lotus-health
195
196
BINS+ =lotus-health
196
197
197
- lotus-wallet : $(BUILD_DEPS )
198
+ lotus-wallet : $(BUILD_DEPS ) # # Build the Lotus wallet tool
198
199
rm -f lotus-wallet
199
200
$(GOCC ) build $(GOFLAGS ) -o lotus-wallet ./cmd/lotus-wallet
200
201
.PHONY : lotus-wallet
201
202
BINS+ =lotus-wallet
202
203
203
- lotus-keygen :
204
+ lotus-keygen : # # Build the Lotus keygen tool
204
205
rm -f lotus-keygen
205
206
$(GOCC ) build -o lotus-keygen ./cmd/lotus-keygen
206
207
.PHONY : lotus-keygen
207
208
BINS+ =lotus-keygen
208
209
209
- testground :
210
+ testground : # # Build for testground
210
211
$(GOCC ) build -tags testground -o /dev/null ./cmd/lotus
211
212
.PHONY : testground
212
213
BINS+ =testground
213
214
214
215
215
- tvx :
216
+ tvx : # # Build the TVX tool
216
217
rm -f tvx
217
218
$(GOCC ) build -o tvx ./cmd/tvx
218
219
.PHONY : tvx
219
220
BINS+ =tvx
220
221
221
- lotus-sim : $(BUILD_DEPS )
222
+ lotus-sim : $(BUILD_DEPS ) # # Build the Lotus simulator
222
223
rm -f lotus-sim
223
224
$(GOCC ) build $(GOFLAGS ) -o lotus-sim ./cmd/lotus-sim
224
225
.PHONY : lotus-sim
225
226
BINS+ =lotus-sim
226
227
227
228
# SYSTEMD
228
229
229
- install-daemon-service : install-daemon
230
+ install-daemon-service : install-daemon # # Install systemd service for Lotus daemon
230
231
mkdir -p /etc/systemd/system
231
232
mkdir -p /var/log/lotus
232
233
install -C -m 0644 ./scripts/lotus-daemon.service /etc/systemd/system/lotus-daemon.service
@@ -236,7 +237,7 @@ install-daemon-service: install-daemon
236
237
@echo " To start the service, run: 'sudo systemctl start lotus-daemon'"
237
238
@echo " To enable the service on startup, run: 'sudo systemctl enable lotus-daemon'"
238
239
239
- install-miner-service : install-miner install-daemon-service
240
+ install-miner-service : install-miner install-daemon-service # # Install systemd service for Lotus miner
240
241
mkdir -p /etc/systemd/system
241
242
mkdir -p /var/log/lotus
242
243
install -C -m 0644 ./scripts/lotus-miner.service /etc/systemd/system/lotus-miner.service
@@ -246,81 +247,80 @@ install-miner-service: install-miner install-daemon-service
246
247
@echo " To start the service, run: 'sudo systemctl start lotus-miner'"
247
248
@echo " To enable the service on startup, run: 'sudo systemctl enable lotus-miner'"
248
249
249
- install-main-services : install-miner-service
250
+ install-main-services : install-miner-service # # Install main systemd services
250
251
251
- install-all-services : install-main-services
252
+ install-all-services : install-main-services # # Install all systemd services
252
253
253
- install-services : install-main-services
254
+ install-services : install-main-services # # Alias for installing main services
254
255
255
- clean-daemon-service : clean-miner-service
256
+ clean-daemon-service : clean-miner-service # # Clean systemd service for Lotus daemon
256
257
-systemctl stop lotus-daemon
257
258
-systemctl disable lotus-daemon
258
259
rm -f /etc/systemd/system/lotus-daemon.service
259
260
systemctl daemon-reload
260
261
261
- clean-miner-service :
262
+ clean-miner-service : # # Clean systemd service for Lotus miner
262
263
-systemctl stop lotus-miner
263
264
-systemctl disable lotus-miner
264
265
rm -f /etc/systemd/system/lotus-miner.service
265
266
systemctl daemon-reload
266
267
267
- clean-main-services : clean-daemon-service
268
+ clean-main-services : clean-daemon-service # # Clean main systemd services
268
269
269
- clean-all-services : clean-main-services
270
+ clean-all-services : clean-main-services # # Clean all systemd services
270
271
271
- clean-services : clean-all-services
272
+ clean-services : clean-all-services # # Alias for cleaning all services
272
273
273
274
# MISC
275
+ buildall : $(BINS ) # # Build all binaries
274
276
275
- buildall : $(BINS )
276
-
277
- install-completions :
277
+ install-completions : # # Install shell completions
278
278
mkdir -p /usr/share/bash-completion/completions /usr/local/share/zsh/site-functions/
279
279
install -C ./scripts/bash-completion/lotus /usr/share/bash-completion/completions/lotus
280
280
install -C ./scripts/zsh-completion/lotus /usr/local/share/zsh/site-functions/_lotus
281
281
282
- unittests :
282
+ unittests : # # Run unit tests
283
283
@$(GOCC ) test $(shell go list ./... | grep -v /lotus/itests)
284
284
.PHONY : unittests
285
285
286
- clean :
286
+ clean : # # Clean build artifacts
287
287
rm -rf $(CLEAN ) $(BINS )
288
288
-$(MAKE ) -C $(FFI_PATH ) clean
289
289
.PHONY : clean
290
290
291
- dist-clean :
291
+ dist-clean : # # Thoroughly clean, including git submodules
292
292
git clean -xdff
293
293
git submodule deinit --all -f
294
294
.PHONY : dist-clean
295
295
296
- type-gen : api-gen
296
+ type-gen : api-gen # # Generate type information
297
297
$(GOCC ) run ./gen/main.go
298
298
$(GOCC ) generate -x ./...
299
299
$(FIX_IMPORTS )
300
300
301
- actors-code-gen :
301
+ actors-code-gen : # # Generate actor code
302
302
$(GOCC ) run ./gen/inline-gen . gen/inlinegen-data.json
303
303
$(GOCC ) run ./chain/actors/agen
304
304
$(GOCC ) fmt ./...
305
305
306
- actors-gen : actors-code-gen
306
+ actors-gen : actors-code-gen # # Generate actors
307
307
$(GOCC ) run ./scripts/fiximports
308
308
.PHONY : actors-gen
309
309
310
- bundle-gen :
310
+ bundle-gen : # # Generate bundle
311
311
$(GOCC ) run ./gen/bundle $(VERSION ) $(RELEASE ) $(RELEASE_OVERRIDES )
312
312
$(GOCC ) fmt ./build/...
313
313
.PHONY : bundle-gen
314
314
315
- api-gen :
315
+ api-gen : # # Generate API
316
316
$(GOCC ) run ./gen/api
317
317
$(FIX_IMPORTS )
318
318
.PHONY : api-gen
319
319
320
- cfgdoc-gen :
320
+ cfgdoc-gen : # # Generate configuration documentation
321
321
$(GOCC ) run ./node/config/cfgdocgen > ./node/config/doc_gen.go
322
322
323
- appimage : lotus
323
+ appimage : lotus # # Build AppImage
324
324
rm -rf appimage-builder-cache || true
325
325
rm AppDir/io.filecoin.lotus.desktop || true
326
326
rm AppDir/icon.svg || true
@@ -329,29 +329,33 @@ appimage: lotus
329
329
cp ./lotus AppDir/usr/bin/
330
330
appimage-builder
331
331
332
- docsgen : fiximports
332
+ docsgen : fiximports # # Generate documentation
333
333
$(GOCC ) run ./gen/docs
334
334
.PHONY : docsgen
335
335
336
- fiximports :
336
+ fiximports : # # Fix imports
337
337
$(FIX_IMPORTS )
338
338
.PHONY : fiximports
339
339
340
- gen : actors-code-gen type-gen cfgdoc-gen docsgen api-gen
340
+ gen : actors-code-gen type-gen cfgdoc-gen docsgen api-gen # # Run all generation tasks
341
341
$(GOCC ) run ./scripts/fiximports
342
342
@echo " >>> IF YOU'VE MODIFIED THE CLI OR CONFIG, REMEMBER TO ALSO RUN 'make docsgen-cli'"
343
343
.PHONY : gen
344
344
345
- jen : gen
345
+ jen : gen # # Alias for gen
346
346
347
- snap : lotus lotus-miner lotus-worker
347
+ snap : lotus lotus-miner lotus-worker # # Build snap package
348
348
snapcraft
349
349
# snapcraft upload ./lotus_*.snap
350
350
351
- docsgen-cli :
351
+ # separate from gen because it needs binaries
352
+ docsgen-cli : lotus lotus-miner lotus-worker # # Generate CLI documentation
352
353
$(GOCC ) run ./scripts/docsgen-cli
353
354
.PHONY : docsgen-cli
354
355
355
- print-% :
356
+ print-% : # # Print variable value
356
357
@echo $* =$($* )
357
358
359
+ help : # # Display this help message
360
+ @echo " Available targets:"
361
+ @awk ' BEGIN {FS = ":.*?## "}; /^[a-zA-Z_-]+:.*?## / {printf " \033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST ) | sort
0 commit comments