forked from xnvme/xnvme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
689 lines (625 loc) · 20.6 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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
#
# xNVMe uses meson, however, to provide the conventional practice of:
#
# ./configure
# make
# make install
#
# The initial targets of this Makefile supports the behavior, instrumenting
# meson based on the options passed to "./configure". However, to do proper configuration then
# actually use meson, this is just here to get one started, showing some default usage of meson and
# providing pointers to where to read about meson.
#
# SPDX-FileCopyrightText: Samsung Electronics Co., Ltd
#
# SPDX-License-Identifier: BSD-3-Clause
ifeq ($(PLATFORM_ID),Windows)
else
PLATFORM_ID = $$( uname -s )
endif
PLATFORM = $$( \
case $(PLATFORM_ID) in \
( Linux | FreeBSD | OpenBSD | NetBSD | Windows | Darwin ) echo $(PLATFORM_ID) ;; \
( * ) echo Unrecognized ;; \
esac)
CTAGS = $$( \
case $(PLATFORM_ID) in \
( Linux | Darwin ) echo "ctags" ;; \
( FreeBSD | OpenBSD | NetBSD | Windows) echo "exctags" ;; \
( * ) echo Unrecognized ;; \
esac)
MAKE = $$( \
case $(PLATFORM_ID) in \
( Linux | Windows | Darwin ) echo "make" ;; \
( FreeBSD | OpenBSD | NetBSD ) echo "gmake" ;; \
( * ) echo Unrecognized ;; \
esac)
MESON = $$( \
case $(PLATFORM_ID) in \
( Linux | Windows | Darwin ) echo "meson" ;; \
( FreeBSD | OpenBSD | NetBSD ) echo "meson" ;; \
( * ) echo Unrecognized ;; \
esac)
NPROC = $$( \
case $(PLATFORM_ID) in \
( Linux | Windows ) nproc ;; \
( FreeBSD | OpenBSD | NetBSD | Darwin ) sysctl -n hw.ncpu ;; \
( * ) echo Unrecognized ;; \
esac)
GIT = $$( \
case $(PLATFORM_ID) in \
( Linux | Windows | Darwin ) echo "git" ;; \
( FreeBSD | OpenBSD | NetBSD ) echo "git" ;; \
( * ) echo Unrecognized ;; \
esac)
# This is done to avoid appleframework deprecation warnings
export MACOSX_DEPLOYMENT_TARGET=11.0
BUILD_DIR?=builddir
TOOLBOX_DIR?=toolbox
PROJECT_VER = $$( python3 $(TOOLBOX_DIR)/xnvme_ver.py --path meson.build )
ALLOW_DIRTY ?= 0
define default-help
# Invoke: 'make help'
endef
.PHONY: default
default: help
define common-help
# Invokes: make info git-setup clean config build tags
#
# The common behavior when invoking 'make', that is, dump out info relevant to
# the system, generate ctags, setup git-hoooks, configure the meson-build and
# start compiling
endef
.PHONY: common
common: info tags git-setup clean config build
define config-help
# Configure Meson
endef
.PHONY: config
config:
@echo "## xNVMe: make config"
CC=$(CC) CXX=$(CXX) $(MESON) setup $(BUILD_DIR)
@echo "## xNVMe: make config [DONE]"
define config-debug-help
# Configure Meson to compile xNVMe with '--buildtype=debug'
endef
.PHONY: config-debug
config-debug:
@echo "## xNVMe: make config-debug"
CC=$(CC) CXX=$(CXX) $(MESON) setup $(BUILD_DIR) \
--buildtype=debug
@echo "## xNVMe: make config-debug [DONE]"
define config-slim-help
# Configure Meson to compile xNVMe without any third-party libraries
endef
.PHONY: config-slim
config-slim:
@echo "## xNVMe: make config-slim"
CC=$(CC) CXX=$(CXX) $(MESON) setup $(BUILD_DIR) \
-Dwith-spdk=false \
-Dwith-liburing=disabled \
-Dwith-libvfn=disabled \
-Dwith-libaio=disabled \
-Dwith-libisal=disabled
@echo "## xNVMe: make config-slim [DONE]"
define docker-help
# Drop into a docker instance with the repository bind-mounted at /tmp/xnvme
endef
.PHONY: docker
docker:
@echo "## xNVMe: docker"
@docker run -it -w /tmp/xnvme --mount type=bind,source="$(shell pwd)",target=/tmp/xnvme ghcr.io/xnvme/xnvme-deps-debian-bookworm:next bash
@echo "## xNVME: docker [DONE]"
define docs-help
# Build docs (without command-execution) and open them
endef
.PHONY: docs
docs:
@echo "## xNVMe: make docs"
cd docs/autogen && make
@echo "## xNVMe: make docs [DONE]"
define docker-privileged-help
# Drop into a privileged docker instance with the repository bind-mounted at /tmp/xnvme
endef
.PHONY: docker-privileged
docker-privileged:
@echo "## xNVMe: docker-privileged"
@docker run -it --privileged -w /tmp/xnvme --mount type=bind,source="$(shell pwd)",target=/tmp/xnvme ghcr.io/xnvme/xnvme-qemu:latest bash
@echo "## xNVME: docker-privileged [DONE]"
define cijoe-help
# Setup a CIJOE environment for Linux development, documentation, and testing
endef
.PHONY: cijoe
cijoe:
@echo "## xNVMe: cijoe"
@pipx install cijoe==v0.9.29 --include-deps
@pipx inject cijoe cijoe-pkg-qemu==v6.1.15
@pipx inject cijoe cijoe-pkg-linux==v0.9.7
@pipx inject cijoe cijoe-pkg-fio==v0.9.7
@pipx inject cijoe matplotlib
@pipx inject cijoe numpy
@pipx install rst2pdf
@mkdir -p ~/.config/cijoe
@[ -e ~/.config/cijoe/cijoe-config.toml ] || cp cijoe/configs/debian-bullseye.toml ~/.config/cijoe/cijoe-config.toml
@echo ""
@echo ""
@echo " !!!! READ THIS !!!!"
@echo ""
@echo ""
@echo " --={[ Edit the config at ~/.config/cijoe/cijoe-config.toml ]}=-- "
@echo ""
@echo ""
@echo " !!!! READ THIS !!!!"
@echo ""
@echo ""
@echo "## xNVME: cijoe [DONE]"
define cijoe-guest-setup-xnvme-using-tgz-help
# Create and start a qemu-guest, then setup xNVMe within the guest using tgz
endef
.PHONY: cijoe-guest-setup-xnvme-using-tgz
cijoe-guest-setup-xnvme-using-tgz:
@echo "## xNVMe: cijoe-guest-setup-xnvme-using-tgz"
@cd cijoe && cijoe -w workflows/provision-using-tgz.yaml -l
@echo "## xNVME: cijoe-guest-setup-xnvme-using-tgz [DONE]"
define cijoe-guest-setup-xnvme-using-git-help
# Create and start a qemu-guest, then setup xNVMe within the guest using git
endef
.PHONY: cijoe-guest-setup-xnvme-using-git
cijoe-guest-setup-xnvme-using-git:
@echo "## xNVMe: cijoe-guest-setup-xnvme-using-git"
@cd cijoe && cijoe -w workflows/provision-using-git.yaml -l
@echo "## xNVME: cijoe-guest-setup-xnvme-using-git [DONE]"
define cijoe-guest-setup-blank-help
# Create and start a qemu-guest
endef
.PHONY: cijoe-guest-setup-blank
cijoe-guest-setup-blank:
@echo "## xNVMe: cijoe-guest-setup-blank"
@cd cijoe && cijoe -w workflows/provision-using-git.yaml -l \
guest_kill \
guest_init \
guest_start \
guest_check
@echo "## xNVME: cijoe-guest-setup-blank [DONE]"
define cijoe-guest-start-help
# Start the qemu-guest -- assumes a qemu-guest has been setup
endef
.PHONY: cijoe-guest-start
cijoe-guest-start:
@echo "## xNVMe: cijoe-guest-start"
@cd cijoe && cijoe -w workflows/provision-using-git.yaml -l \
guest_start \
guest_check
@echo "## xNVMe: cijoe-guest-start [DONE]"
define cijoe-guest-stop-help
# Stop the qemu-guest -- assumes a qemu-guest has been setup
endef
.PHONY: cijoe-guest-stop
cijoe-guest-stop:
@echo "## xNVMe: cijoe-guest-stop"
@cd cijoe && cijoe -w workflows/provision-using-git.yaml -l \
guest_kill
@echo "## xNVMe: cijoe-guest-stop [DONE]"
define cijoe-setup-xnvme-using-git-help
# Synchronize xNVMe source using git, then setup xNVMe
endef
.PHONY: cijoe-setup-xnvme-using-git
cijoe-setup-xnvme-using-git:
@echo "## xNVMe: cijoe-setup-xnvme-using-git"
@cd cijoe && cijoe -w workflows/provision-using-git.yaml -l \
xnvme_source_sync \
xnvme_build_prep \
xnvme_build \
xnvme_install \
xnvme_aux_prep \
xnvme_bindings_py_build \
fio_prep
@echo "## xNVME: cijoe-setup-xnvme-using-git [DONE]"
define cijoe-setup-xnvme-using-tgz-help
# Synchronize xNVMe source using tgz, then setup xNVMe
endef
.PHONY: cijoe-setup-xnvme-using-tgz
cijoe-setup-xnvme-using-tgz:
@echo "## xNVMe: cijoe-setup-xnvme-using-tgz"
@cd cijoe && cijoe -w workflows/provision-using-tgz.yaml -l \
xnvme_source_sync \
xnvme_build_prep \
xnvme_build \
xnvme_install \
xnvme_aux_prep \
xnvme_bindings_py_install_tgz \
fio_prep
@echo "## xNVME: cijoe-setup-xnvme-using-tgz [DONE]"
define cijoe-sync-git-help
# Synchronize xNVMe source using git
endef
.PHONY: cijoe-sync-git
cijoe-sync-git:
@echo "## xNVMe: cijoe-sync-git"
@cd cijoe && cijoe -w workflows/provision-using-git.yaml -l \
xnvme_source_sync
@echo "## xNVME: cijoe-sync-git [DONE]"
define cijoe-sync-tgz-help
# Synchronize xNVMe source using tgz
endef
.PHONY: cijoe-sync-tgz
cijoe-sync-tgz:
@echo "## xNVMe: cijoe-sync-tgz"
@cd cijoe && cijoe -w workflows/provision-using-tgz.yaml -l \
xnvme_source_sync
@echo "## xNVME: cijoe-sync-tgz [DONE]"
define cijoe-do-docgen-help
# Generate documentation with command execution / output generation
endef
.PHONY: cijoe-do-docgen
cijoe-do-docgen:
@echo "## xNVMe: cijoe-do-docgen"
@cd cijoe && cijoe -w workflows/docgen.yaml -l
@echo "## xNVME: cijoe-do-docgen [DONE]"
define cijoe-do-selftest-help
# Run the cijoe selftest, this is useful after setting up cijoe
endef
.PHONY: cijoe-do-selftest
cijoe-do-selftest:
@echo "## xNVMe: cijoe-do-selftest"
@cd cijoe && pytest tests/selftest --config configs/default-config.toml
@echo "## xNVME: cijoe-do-selftest [DONE]"
define cijoe-do-test-linux-help
# Run the testsuite for Linux -- assumes a provisioned qemu-guest
endef
.PHONY: cijoe-do-test-linux
cijoe-do-test-linux:
@echo "## xNVMe: cijoe-do-test-linux"
@cd cijoe && cijoe -w workflows/test-debian-bullseye.yaml -l
@echo "## xNVME: cijoe-do-test-linux [DONE]"
define cijoe-do-test-freebsd-help
# Run the testsuite for FreeBSD -- assumes a provisioned qemu-guest
endef
.PHONY: cijoe-do-test-freebsd
cijoe-do-test-freebsd:
@echo "## xNVMe: cijoe-do-test-freebsd"
@cd cijoe && cijoe -w workflows/test-freebsd-13.yaml -l
@echo "## xNVME: cijoe-do-test-freebsd [DONE]"
define cijoe-do-benchmark-scale-help
# Run the scalability benchmark
endef
.PHONY: cijoe-do-benchmark-scale
cijoe-do-benchmark-scale:
@echo "## xNVMe: cijoe-do-benchmark-scale"
@cd cijoe && cijoe -w workflows/bench.yaml -l
@echo "## xNVME: cijoe-do-benchmark-scale [DONE]"
define cijoe-do-bootimage-debian-bullseye-amd64-help
# Create a Debian Linux - amd64 - bootable system image for a qemu-guest
endef
.PHONY: cijoe-do-bootimage-debian-bullseye-amd64
cijoe-do-bootimage-debian-bullseye-amd64:
@echo "## xNVMe: cijoe-do-bootimage-debian-bullseye-amd64"
@cd cijoe && cijoe -w workflows/bootimg-debian-bullseye-amd64.yaml -l
@echo "## xNVME: cijoe-do-bootimage-debian-bullseye-amd64 [DONE]"
define cijoe-do-bootimage-freebsd-amd64-help
# Create a FreeBSD - amd64 - bootable system image for a qemu-guest
endef
.PHONY: cijoe-do-bootimage-freebsd-amd64
cijoe-do-bootimage-freebsd-amd64:
@echo "## xNVMe: cijoe-do-bootimage-freebsd-amd64"
@cd cijoe && cijoe -w workflows/bootimg-freebsd-13-amd64.yaml -l
@echo "## xNVME: cijoe-do-bootimage-freebsd-amd64 [DONE]"
define cijoe-do-linux-kdebs-help
# Build a custom Linux kernel as installable packages (.deb)
endef
.PHONY: cijoe-do-linux-kdebs
cijoe-do-linux-kdebs:
@echo "## xNVMe: cijoe-do-linux-kdebs"
@cd cijoe && cijoe -w workflows/build-kdebs.yaml -l
@echo "## xNVME: cijoe-do-linux-kdebs [DONE]"
define cijoe-report-help
# Produce a report for the latest cijoe state (cijoe/cijoe-output)
endef
.PHONY: cijoe-report
cijoe-report:
@echo "## xNVMe: cijoe-report"
@cd cijoe && cijoe -p
@echo "## xNVME: cijoe-report [DONE]"
define git-setup-help
# Do git config for: 'core.hooksPath' and 'blame.ignoreRevsFile'
endef
.PHONY: git-setup
git-setup:
@echo "## xNVMe: git-setup"
@./$(TOOLBOX_DIR)/pre-commit-check.sh;
$(GIT) config blame.ignoreRevsFile .git-blame-ignore-revs || true
@echo "## xNVMe: git-setup [DONE]"
define format-help
# Run code format (style, code-conventions and language-integrity) on staged changes
endef
.PHONY: format
format:
@echo "## xNVMe: format"
@pre-commit run
@echo "## xNVME: format [DONE]"
define format-all-help
# Run code format (style, code-conventions and language-integrity) on staged and committed changes
endef
.PHONY: format-all
format-all:
@echo "## xNVMe: format-all"
@pre-commit run --all-files
@echo "## xNVME: format-all [DONE]"
define info-help
# Print information relevant to xNVMe
#
# Such as:
# - OS
# - Project version
# - Versions of tools
endef
.PHONY: info
info:
@echo "## xNVMe: make info"
@echo "PLATFORM: $(PLATFORM)"
@echo "CC: $(CC)"
@echo "CXX: $(CXX)"
@echo "MAKE: $(MAKE)"
@echo "CTAGS: $(CTAGS)"
@echo "NPROC: $(NPROC)"
@echo "PROJECT_VER: $(PROJECT_VER)"
@echo "## xNVMe: make info [DONE]"
define build-help
# Build xNVMe with Meson
endef
.PHONY: build
build: info _require_builddir
@echo "## xNVMe: make build"
$(MESON) compile -C $(BUILD_DIR)
@echo "## xNVMe: make build [DONE]"
define install-help
# Install xNVMe with Meson
endef
.PHONY: install
install: _require_builddir
@echo "## xNVMe: make install"
$(MESON) install -C $(BUILD_DIR)
@echo "## xNVMe: make install [DONE]"
define uninstall-help
# Uninstall xNVMe with Meson
endef
.PHONY: uninstall
uninstall:
@echo "## xNVMe: make uninstall"
@if [ ! -d "$(BUILD_DIR)" ]; then \
echo "Missing builddir('$(BUILD_DIR))"; \
false; \
fi
cd $(BUILD_DIR) && $(MESON) --internal uninstall
@echo "## xNVMe: make uninstall [DONE]"
define build-deb-help
# Build a binary DEB package
#
# NOTE: The binary DEB packages generated here are not meant to be used for anything
# but easy install/uninstall during test and development
endef
.PHONY: build-deb
build-deb: _require_builddir
@echo "## xNVMe: make build-deb"
rm -rf $(BUILD_DIR)/meson-dist/deb
python3 $(TOOLBOX_DIR)/meson_dist_deb_build.py \
--deb-description "xNVMe binary package for test/development" \
--deb-maintainer "See GitHUB and https://xnvme.io/" \
--builddir $(BUILD_DIR) \
--workdir $(BUILD_DIR)/meson-dist/deb \
--output $(BUILD_DIR)/meson-dist/xnvme.deb
@echo "## xNVMe: make-deb [DONE]; find it here:"
@find $(BUILD_DIR)/meson-dist/ -name '*.deb'
define install-deb-help
# Install the binary DEB package created with: make build-deb
#
# This will install it instead of copying it directly
# into the system paths. This is convenient as it is easier to purge it by
# running eg.
# make uninstall-deb
endef
.PHONY: install-deb
install-deb: _require_builddir
@echo "## xNVMe: make install-deb"
dpkg -i $(BUILD_DIR)/meson-dist/xnvme.deb
@echo "## xNVMe: make install-deb [DONE]"
define uninstall-deb-help
# Uninstall xNVMe with apt-get
endef
.PHONY: uninstall-deb
uninstall-deb:
@echo "## xNVMe: make uninstall-deb"
apt-get --yes remove xnvme* || true
@echo "## xNVMe: make uninstall-deb [DONE]"
define build-rpm-help
# Build a binary RPM package
endef
.PHONY: build-rpm
build-rpm: _require_builddir
@echo "## xNVMe: make build-rpm"
meson ${BUILD_DIR}
git archive --format=tar HEAD > xnvme.tar
tar rf xnvme.tar ${BUILD_DIR}/xnvme.spec
gzip -f -9 xnvme.tar
rpmbuild -ta xnvme.tar.gz -v --define "_topdir $(shell pwd)/${BUILD_DIR}/meson-dist" --define "_prefix /usr/local"
@echo "## xNVMe: make build-rpm [DONE]; find it here:"
@find $(BUILD_DIR)/meson-dist/ -name '*.rpm'
define install-rpm-help
# Install the binary RPM package created with: make build-rpm
# This will install it instead of copying it directly
# into the system paths. This is convenient as it is easier to purge it by
# running eg.
# make uninstall-rpm
endef
.PHONY: install-rpm
install-rpm: _require_builddir
@echo "## xNVMe: make install-rpm"
rpm -ivh $(shell find $(BUILD_DIR)/meson-dist/ -name '*.rpm')
@echo "## xNVMe: make install-rpm [DONE]"
define uninstall-rpm-help
# Uninstall xNVMe with yum
endef
.PHONY: uninstall-rpm
uninstall-rpm:
@echo "## xNVMe: make uninstall-rpm"
yum remove -y xnvme* || true
@echo "## xNVMe: make uninstall-rpm [DONE]"
define clean-help
# Remove Meson builddir
endef
.PHONY: clean
clean:
@echo "## xNVMe: make clean"
rm -fr $(BUILD_DIR) || true
@echo "## xNVMe: make clean [DONE]"
define clean-subprojects-help
# Remove Meson builddir as well as running 'make clean' in all subprojects
endef
.PHONY: clean-subprojects
clean-subprojects:
@echo "## xNVMe: make clean-subprojects"
@if [ -d "subprojects/spdk" ] && [ ${PLATFORM_ID} != 'Darwin' ]; then cd subprojects/spdk &&$(MAKE) clean; fi;
rm -fr $(BUILD_DIR) || true
@echo "## xNVMe: make clean-subprojects [DONE]"
define gen-libconf-help
# Helper-target generating third-party/subproject/os/library-configuration string
endef
.PHONY: gen-libconf
gen-libconf:
@echo "## xNVMe: make gen-libconf"
./$(TOOLBOX_DIR)/xnvme_libconf.py --repos .
@echo "## xNVMe: make gen-libconf [DONE]"
define gen-src-archive-help
# Produce a source-archive (.tar.gz) without subproject-source
endef
.PHONY: gen-src-archive
gen-src-archive:
@echo "## xNVMe: make gen-src-archive"
$(MESON) setup $(BUILD_DIR) -Dbuild_subprojects=false -Dwith-liburing=disabled -Dwith-libvfn=disabled
@if [ $(ALLOW_DIRTY) -eq 1 ]; then \
$(MESON) dist -C $(BUILD_DIR) --no-tests --formats gztar --allow-dirty; \
else \
$(MESON) dist -C $(BUILD_DIR) --no-tests --formats gztar; \
fi
@echo "## xNVMe: make gen-src-archive [DONE]"
define gen-src-archive-with-subprojects-help
# Produce a source-archive (.tar.gz) with subproject-source
endef
.PHONY: gen-src-archive-with-subprojects
gen-src-archive-with-subprojects:
@echo "## xNVMe: make gen-src-archive-with-subprojects"
$(MESON) setup $(BUILD_DIR) -Dbuild_subprojects=false -Dwith-liburing=disabled -Dwith-libvfn=disabled
$(MESON) dist -C $(BUILD_DIR) --no-tests --formats gztar --include-subprojects
@echo "## xNVMe: make gen-src-archive-with-subprojects [DONE]"
define gen-artifacts-help
# Generate artifacts in "/tmp/artifacts" for local guest provisoning
#
# This is a helper to produce the set of files used by toolbox/workflows/provision.workflow
# The set of files would usually be downloaded from the CI build-artifacts, however, this helper
# provides the means to perform local provisioning without downloading files.
endef
.PHONY: gen-artifacts
gen-artifacts: gen-src-archive-with-subprojects
@echo "## xNVMe: make gen-artifacts"
@cd python/bindings && make clean build
@mkdir -p /tmp/artifacts
@ls -l /tmp/artifacts
@cp builddir/meson-dist/xnvme-$(PROJECT_VER).tar.gz /tmp/artifacts/xnvme-src.tar.gz
@cp python/bindings/dist/xnvme-$(PROJECT_VER).tar.gz /tmp/artifacts/xnvme-py-sdist.tar.gz
@ls -l /tmp/artifacts
@echo "## xNVMe: make gen-artifacts [DONE]"
define gen-bash-completions-help
# Helper-target to produce Bash-completions for tools (tools, examples, tests)
#
# NOTE: This target requires a bunch of things: binaries must be built and
# residing in '$(BUILD_DIR)/tools' etc. AND installed on the system. Also, the find
# command has only been tried with GNU find
endef
.PHONY: gen-bash-completions
gen-bash-completions:
@echo "## xNVMe: make gen-bash-completions"
python3 ./$(TOOLBOX_DIR)/xnvmec_generator.py cpl --output $(TOOLBOX_DIR)/bash_completion.d
@echo "## xNVMe: make gen-bash-completions [DONE]"
define gen-man-pages-help
# Helper-target to produce man pages for tools (tools, examples, tests)
#
# NOTE: This target requires a bunch of things: binaries must be built and
# residing in '$(BUILD_DIR)/tools' etc. AND installed on the system. Also, the find
# command has only been tried with GNU find
endef
.PHONY: gen-man-pages
gen-man-pages:
@echo "## xNVMe: make gen-man-pages"
python3 ./$(TOOLBOX_DIR)/xnvmec_generator.py man --output man/
@echo "## xNVMe: make gen-man-pages [DONE]"
define tags-help
# Helper-target to produce tags and compile-commands
endef
.PHONY: tags
tags:
@echo "## xNVMe: make tags"
@if [ -d "$(BUILD_DIR)" ]; then cp $(BUILD_DIR)/compile_commands.json .; fi;
@$(CTAGS) * --languages=C -h=".c.h" -R --exclude=$(BUILD_DIR) \
include \
lib \
tools \
examples \
tests \
subprojects/* \
|| true
@echo "## xNVMe: make tags [DONE]"
define tags-xnvme-public-help
# Make tags for public APIs
endef
.PHONY: tags-xnvme-public
tags-xnvme-public:
@echo "## xNVMe: make tags-xnvme-public"
@$(CTAGS) --c-kinds=dfpgs -R include/lib*.h || true
@echo "## xNVMe: make tags-xnvme-public [DONE]"
define _require_builddir-help
# This helper is not intended to be invoked via the command-line-interface.
endef
.PHONY: _require_builddir
_require_builddir:
@if [ ! -d "$(BUILD_DIR)" ]; then \
echo ""; \
echo "+========================================+"; \
echo " "; \
echo " ERR: missing builddir: '$(BUILD_DIR)' "; \
echo " "; \
echo " Configure it first by running: "; \
echo " "; \
echo " 'meson setup $(BUILD_DIR)' "; \
echo " "; \
echo "+========================================+"; \
echo ""; \
false; \
fi
define clobber-help
# Invoke 'make clean' and: remove subproject builds, git-clean and git-checkout .
#
# This is intended as a way to clearing out the repository for any old "build-debris",
# take care that you have stashed/commit any of your local changes as anything unstaged
# will be removed.
endef
.PHONY: clobber
clobber: clean
@echo "## xNVMe: clobber"
@git clean -dfx
@git clean -dfX
@git checkout .
@rm -rf subprojects/libvfn || true
@rm -rf subprojects/spdk || true
@echo "## xNVMe: clobber [DONE]"
define help-help
# Print the description of every target
endef
.PHONY: help
help:
@./$(TOOLBOX_DIR)/print_help.py --repos .
define help-verbose-help
# Print the verbose description of every target
endef
.PHONY: help-verbose
help-verbose:
@./$(TOOLBOX_DIR)/print_help.py --verbose --repos .