| 1 |
# SPDX-License-Identifier: LGPL-2.1-or-later |
| 2 |
# |
| 3 |
# This file is part of libnvme. |
| 4 |
# Copyright (c) 2021 Dell Inc. |
| 5 |
# |
| 6 |
# Authors: Martin Belanger <[email protected]> |
| 7 |
# |
| 8 |
NAME := libnvme |
| 9 |
.DEFAULT_GOAL := ${NAME} |
| 10 |
BUILD-DIR := .build |
| 11 |
|
| 12 |
.PHONY: update-subprojects |
| 13 |
update-subprojects: |
| 14 |
meson subprojects update |
| 15 |
|
| 16 |
${BUILD-DIR}: |
| 17 |
meson setup $@ |
| 18 |
@echo "Configuration located in: $@" |
| 19 |
@echo "-------------------------------------------------------" |
| 20 |
|
| 21 |
.PHONY: ${NAME} |
| 22 |
${NAME}: ${BUILD-DIR} |
| 23 |
meson compile -C ${BUILD-DIR} |
| 24 |
|
| 25 |
.PHONY: clean |
| 26 |
clean: |
| 27 |
ifneq ("$(wildcard ${BUILD-DIR})","") |
| 28 |
rm -rf ${BUILD-DIR} |
| 29 |
meson subprojects purge --confirm |
| 30 |
endif |
| 31 |
|
| 32 |
.PHONY: purge |
| 33 |
purge: clean |
| 34 |
|
| 35 |
.PHONY: install |
| 36 |
install: ${NAME} |
| 37 |
meson install -C ${BUILD-DIR} --skip-subprojects |
| 38 |
|
| 39 |
.PHONY: uninstall |
| 40 |
uninstall: |
| 41 |
cd ${BUILD-DIR} && meson --internal uninstall |
| 42 |
|
| 43 |
.PHONY: dist |
| 44 |
dist: ${NAME} |
| 45 |
meson dist -C ${BUILD-DIR} --formats gztar |
| 46 |
|
| 47 |
.PHONY: test |
| 48 |
test: ${NAME} |
| 49 |
meson test -C ${BUILD-DIR} |
| 50 |
|
| 51 |
# Test strictly libnvme (do not run tests on all the subprojects) |
| 52 |
.PHONY: test-strict |
| 53 |
test-strict: ${NAME} |
| 54 |
meson test -C ${BUILD-DIR} --suite libnvme |
| 55 |
|
| 56 |
.PHONY: rpm |
| 57 |
rpm: ${BUILD-DIR} |
| 58 |
git archive --format=tar HEAD > libnvme.tar |
| 59 |
tar rf libnvme.tar ${BUILD-DIR}/libnvme.spec |
| 60 |
gzip -f -9 libnvme.tar |
| 61 |
rpmbuild -ta libnvme.tar.gz -v |