Skip to content

Commit 3b4a8b4

Browse files
author
Martin Belanger
committed
Replacing make by meson.
This involves replacing all Makefiles by meson.build files. Also the top-level configure script now simply invokes meson. The top-level Makefile is just a wrapper for meson. It supports the following operations: make make test make install make clean # Remove build artifacts but keep configuration make purge # Remove build artifacts and configuration Signed-off-by: Martin Belanger <[email protected]>
1 parent ddd725e commit 3b4a8b4

9 files changed

Lines changed: 35 additions & 536 deletions

File tree

.github/workflows/make.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

Makefile

Lines changed: 35 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,39 @@
1-
NAME=libnvme
2-
SPECFILE=$(NAME).spec
3-
VERSION=$(shell awk '/Version:/ { print $$2 }' $(SPECFILE))
4-
TAG = $(NAME)-$(VERSION)
5-
RPMBUILD=$(shell `which rpmbuild >&/dev/null` && echo "rpmbuild" || echo "rpm")
6-
7-
INSTALL=install
8-
9-
default: all
10-
11-
python: all
12-
@$(MAKE) -C libnvme python
13-
14-
all: $(NAME).pc
15-
@$(MAKE) -C src
16-
@$(MAKE) -C test
17-
@$(MAKE) -C examples
18-
19-
runtests: all
20-
@$(MAKE) -C test runtests
21-
runtests-loop:
22-
@$(MAKE) -C test runtests-loop
23-
24-
config-host.mak: configure
25-
@if [ ! -e "$@" ]; then \
26-
echo "Running configure ..."; \
27-
./configure; \
28-
else \
29-
echo "$@ is out-of-date, running configure"; \
30-
sed -n "/.*Configured with/s/[^:]*: //p" "$@" | sh; \
31-
fi
32-
33-
ifneq ($(MAKECMDGOALS),clean)
34-
include config-host.mak
35-
endif
36-
37-
SED_PROCESS = \
38-
sed -e "s%@prefix@%$(prefix)%g" \
39-
-e "s%@libdir@%$(libdir)%g" \
40-
-e "s%@includedir@%$(includedir)%g" \
41-
-e "s%@NAME@%$(NAME)%g" \
42-
-e "s%@VERSION@%$(VERSION)%g" \
43-
$< >$@
44-
45-
%.pc: %.pc.in config-host.mak $(SPECFILE)
46-
$(SED_PROCESS)
47-
48-
install: $(NAME).pc
49-
@$(MAKE) -C src install prefix=$(DESTDIR)$(prefix) includedir=$(DESTDIR)$(includedir) libdir=$(DESTDIR)$(libdir)
50-
$(INSTALL) -D -m 644 $(NAME).pc $(DESTDIR)$(libdir)/pkgconfig/$(NAME).pc
51-
$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man2
52-
$(INSTALL) -m 644 doc/man/*.2 $(DESTDIR)$(mandir)/man2
53-
54-
install-tests:
55-
@$(MAKE) -C test install prefix=$(DESTDIR)$(prefix) datadir=$(DESTDIR)$(datadir)
56-
57-
install-python:
58-
@$(MAKE) -C libnvme install prefix=$(DESTDIR)$(prefix)
59-
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+
${BUILD-DIR}:
13+
meson $@
14+
@echo "Configuration located in: $@"
15+
@echo "-------------------------------------------------------"
16+
17+
.PHONY: ${NAME}
18+
${NAME}: ${BUILD-DIR}
19+
ninja -C ${BUILD-DIR}
20+
21+
.PHONY: clean
6022
clean:
61-
@rm -f config-host.mak config-host.h cscope.out $(NAME).pc
62-
@$(MAKE) -C src clean
63-
@$(MAKE) -C test clean
64-
@$(MAKE) -C examples clean
65-
66-
cscope:
67-
@cscope -b -R
68-
69-
tag-archive:
70-
@git tag $(TAG)
23+
ifneq ("$(wildcard ${BUILD-DIR})","")
24+
ninja -C ${BUILD-DIR} -t $@
25+
endif
7126

72-
create-archive:
73-
@git archive --prefix=$(NAME)-$(VERSION)/ -o $(NAME)-$(VERSION).tar.gz $(TAG)
74-
@echo "The final archive is ./$(NAME)-$(VERSION).tar.gz."
27+
.PHONY: purge
28+
purge:
29+
ifneq ("$(wildcard ${BUILD-DIR})","")
30+
rm -rf ${BUILD-DIR}
31+
endif
7532

76-
archive: clean tag-archive create-archive
33+
.PHONY: install dist
34+
install dist: ${BUILD-DIR}
35+
cd ${BUILD-DIR} && meson $@
7736

78-
srpm: create-archive
79-
$(RPMBUILD) --define "_sourcedir `pwd`" --define "_srcrpmdir `pwd`" --nodeps -bs $(SPECFILE)
37+
.PHONY: test
38+
test: ${BUILD-DIR}
39+
ninja -C ${BUILD-DIR} $@

Makefile.quiet

Lines changed: 0 additions & 10 deletions
This file was deleted.

configure

Lines changed: 0 additions & 230 deletions
This file was deleted.

0 commit comments

Comments
 (0)