mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-02-09 00:00:04 +03:00
Makefile: fix rst2man lookup and add pytest lookup
add pytest and rst2man lookups though command-v and which if available, default to ENV/ARGS in the case of user specified locations and otherwise lookup via shell Signed-off-by: Kayla Firestack <dev@kaylafire.me>
This commit is contained in:
parent
045f7d2ba1
commit
ae3d49e823
35
Makefile
35
Makefile
@ -1,7 +1,7 @@
|
|||||||
PREFIX?=/usr/local
|
PREFIX?=/usr/local
|
||||||
PKG_CONFIG?=pkg-config
|
PKG_CONFIG?=pkg-config
|
||||||
INSTALL=install
|
INSTALL=install
|
||||||
PYTEST=pytest-3
|
|
||||||
CFLAGS+=-std=gnu89 -O2 -g -MMD -Wall -fPIC \
|
CFLAGS+=-std=gnu89 -O2 -g -MMD -Wall -fPIC \
|
||||||
-Wno-pointer-sign \
|
-Wno-pointer-sign \
|
||||||
-fno-strict-aliasing \
|
-fno-strict-aliasing \
|
||||||
@ -19,6 +19,24 @@ CFLAGS+=-std=gnu89 -O2 -g -MMD -Wall -fPIC \
|
|||||||
-DVERSION_STRING='"$(VERSION)"' \
|
-DVERSION_STRING='"$(VERSION)"' \
|
||||||
$(EXTRA_CFLAGS)
|
$(EXTRA_CFLAGS)
|
||||||
LDFLAGS+=$(CFLAGS) $(EXTRA_LDFLAGS)
|
LDFLAGS+=$(CFLAGS) $(EXTRA_LDFLAGS)
|
||||||
|
|
||||||
|
## Configure Tools
|
||||||
|
PYTEST_ARGS?=
|
||||||
|
PYTEST_CMD?=$(shell \
|
||||||
|
command -v pytest-3 \
|
||||||
|
|| which pytest-3 \
|
||||||
|
)
|
||||||
|
PYTEST:=$(PYTEST_CMD) $(PYTEST_ARGS)
|
||||||
|
|
||||||
|
RST2MAN_ARGS?=
|
||||||
|
RST2MAN_CMD?=$(shell \
|
||||||
|
command -v rst2man \
|
||||||
|
|| which rst2man \
|
||||||
|
|| command -v rst2man.py \
|
||||||
|
|| which rst2man.py \
|
||||||
|
)
|
||||||
|
RST2MAN:=$(RST2MAN_CMD) $(RST2MAN_ARGS)
|
||||||
|
|
||||||
CARGO_ARGS=
|
CARGO_ARGS=
|
||||||
CARGO=cargo $(CARGO_ARGS)
|
CARGO=cargo $(CARGO_ARGS)
|
||||||
CARGO_PROFILE=release
|
CARGO_PROFILE=release
|
||||||
@ -66,14 +84,6 @@ else
|
|||||||
INITRAMFS_DIR=/etc/initramfs-tools
|
INITRAMFS_DIR=/etc/initramfs-tools
|
||||||
endif
|
endif
|
||||||
|
|
||||||
RST2MAN:=$(shell command -v rst2man)
|
|
||||||
ifeq ($(RST2MAN),)
|
|
||||||
RST2MAN:=$(shell command -v rst2man.py)
|
|
||||||
ifeq ($(RST2MAN),)
|
|
||||||
@echo "WARNING: no rst2man found! Man page not generated."
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: bcachefs bcachefs.5 lib
|
all: bcachefs bcachefs.5 lib
|
||||||
|
|
||||||
@ -85,7 +95,11 @@ tests: tests/test_helper
|
|||||||
|
|
||||||
.PHONY: check
|
.PHONY: check
|
||||||
check: tests bcachefs
|
check: tests bcachefs
|
||||||
|
ifneq (,$(PYTEST_CMD))
|
||||||
$(PYTEST)
|
$(PYTEST)
|
||||||
|
else
|
||||||
|
@echo "WARNING: pytest not found or specified, tests could not be run."
|
||||||
|
endif
|
||||||
|
|
||||||
.PHONY: TAGS tags
|
.PHONY: TAGS tags
|
||||||
TAGS:
|
TAGS:
|
||||||
@ -98,7 +112,7 @@ DOCSRC := opts_macro.h bcachefs.5.rst.tmpl
|
|||||||
DOCGENERATED := bcachefs.5 doc/bcachefs.5.rst
|
DOCGENERATED := bcachefs.5 doc/bcachefs.5.rst
|
||||||
DOCDEPS := $(addprefix ./doc/,$(DOCSRC))
|
DOCDEPS := $(addprefix ./doc/,$(DOCSRC))
|
||||||
bcachefs.5: $(DOCDEPS) libbcachefs/opts.h
|
bcachefs.5: $(DOCDEPS) libbcachefs/opts.h
|
||||||
ifneq (,$(RST2MAN))
|
ifneq (,$(RST2MAN_CMD))
|
||||||
$(CC) doc/opts_macro.h -I libbcachefs -I include -E 2>/dev/null \
|
$(CC) doc/opts_macro.h -I libbcachefs -I include -E 2>/dev/null \
|
||||||
| doc/macro2rst.py
|
| doc/macro2rst.py
|
||||||
$(RST2MAN) doc/bcachefs.5.rst bcachefs.5
|
$(RST2MAN) doc/bcachefs.5.rst bcachefs.5
|
||||||
@ -195,6 +209,7 @@ update-bcachefs-sources:
|
|||||||
$(RM) libbcachefs/*.mod.c
|
$(RM) libbcachefs/*.mod.c
|
||||||
git -C $(LINUX_DIR) rev-parse HEAD | tee .bcachefs_revision
|
git -C $(LINUX_DIR) rev-parse HEAD | tee .bcachefs_revision
|
||||||
git add .bcachefs_revision
|
git add .bcachefs_revision
|
||||||
|
|
||||||
|
|
||||||
.PHONY: update-commit-bcachefs-sources
|
.PHONY: update-commit-bcachefs-sources
|
||||||
update-commit-bcachefs-sources: update-bcachefs-sources
|
update-commit-bcachefs-sources: update-bcachefs-sources
|
||||||
|
Loading…
Reference in New Issue
Block a user