mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-02-22 00:00:03 +03:00
bcachefs-tools: Prettify make output
Make the default "make" output look more like kbuild; this makes errors and warnings much easier to spot. "Make V=1" will revert to showing the full command lines. This is done by redefining some implicit rules to add the echo and the quiet variable. These changes are similar to those in xfsprogs. and btrfs-progs This patch also silences things if pytest-3 is not found. Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
This commit is contained in:
parent
e2442e57f2
commit
cde2d0e2fc
35
Makefile
35
Makefile
@ -2,6 +2,19 @@ PREFIX?=/usr/local
|
|||||||
PKG_CONFIG?=pkg-config
|
PKG_CONFIG?=pkg-config
|
||||||
INSTALL=install
|
INSTALL=install
|
||||||
|
|
||||||
|
ifeq ("$(origin V)", "command line")
|
||||||
|
BUILD_VERBOSE = $(V)
|
||||||
|
endif
|
||||||
|
ifndef BUILD_VERBOSE
|
||||||
|
BUILD_VERBOSE = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(BUILD_VERBOSE),1)
|
||||||
|
Q =
|
||||||
|
else
|
||||||
|
Q = @
|
||||||
|
endif
|
||||||
|
|
||||||
CFLAGS+=-std=gnu11 -O2 -g -MMD -Wall -fPIC \
|
CFLAGS+=-std=gnu11 -O2 -g -MMD -Wall -fPIC \
|
||||||
-Wno-pointer-sign \
|
-Wno-pointer-sign \
|
||||||
-fno-strict-aliasing \
|
-fno-strict-aliasing \
|
||||||
@ -24,7 +37,7 @@ LDFLAGS+=$(CFLAGS) $(EXTRA_LDFLAGS)
|
|||||||
PYTEST_ARGS?=
|
PYTEST_ARGS?=
|
||||||
PYTEST_CMD?=$(shell \
|
PYTEST_CMD?=$(shell \
|
||||||
command -v pytest-3 \
|
command -v pytest-3 \
|
||||||
|| which pytest-3 \
|
|| which pytest-3 2>/dev/null \
|
||||||
)
|
)
|
||||||
PYTEST:=$(PYTEST_CMD) $(PYTEST_ARGS)
|
PYTEST:=$(PYTEST_CMD) $(PYTEST_ARGS)
|
||||||
|
|
||||||
@ -104,7 +117,14 @@ DEPS=$(SRCS:.c=.d)
|
|||||||
-include $(DEPS)
|
-include $(DEPS)
|
||||||
|
|
||||||
OBJS=$(SRCS:.c=.o)
|
OBJS=$(SRCS:.c=.o)
|
||||||
|
|
||||||
|
%.o: %.c
|
||||||
|
@echo " [CC] $@"
|
||||||
|
$(Q)$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
bcachefs: $(filter-out ./tests/%.o, $(OBJS))
|
bcachefs: $(filter-out ./tests/%.o, $(OBJS))
|
||||||
|
@echo " [LD] $@"
|
||||||
|
$(Q)$(CC) $(LDFLAGS) $+ $(LOADLIBES) $(LDLIBS) -o $@
|
||||||
|
|
||||||
RUST_SRCS=$(shell find rust-src/ -type f -iname '*.rs')
|
RUST_SRCS=$(shell find rust-src/ -type f -iname '*.rs')
|
||||||
MOUNT_SRCS=$(filter %mount, $(RUST_SRCS))
|
MOUNT_SRCS=$(filter %mount, $(RUST_SRCS))
|
||||||
@ -115,7 +135,8 @@ debug: bcachefs
|
|||||||
MOUNT_OBJ=$(filter-out ./bcachefs.o ./tests/%.o ./cmd_%.o , $(OBJS))
|
MOUNT_OBJ=$(filter-out ./bcachefs.o ./tests/%.o ./cmd_%.o , $(OBJS))
|
||||||
libbcachefs.so: LDFLAGS+=-shared
|
libbcachefs.so: LDFLAGS+=-shared
|
||||||
libbcachefs.so: $(MOUNT_OBJ)
|
libbcachefs.so: $(MOUNT_OBJ)
|
||||||
$(CC) $(LDFLAGS) $+ -o $@ $(LDLIBS)
|
@echo " [CC] $@"
|
||||||
|
$(Q)$(CC) $(LDFLAGS) $+ -o $@ $(LDLIBS)
|
||||||
|
|
||||||
MOUNT_TOML=rust-src/mount/Cargo.toml
|
MOUNT_TOML=rust-src/mount/Cargo.toml
|
||||||
mount.bcachefs: lib $(MOUNT_SRCS)
|
mount.bcachefs: lib $(MOUNT_SRCS)
|
||||||
@ -127,13 +148,16 @@ mount.bcachefs: lib $(MOUNT_SRCS)
|
|||||||
|
|
||||||
|
|
||||||
tests/test_helper: $(filter ./tests/%.o, $(OBJS))
|
tests/test_helper: $(filter ./tests/%.o, $(OBJS))
|
||||||
|
@echo " [LD] $@"
|
||||||
|
$(Q)$(CC) $(LDFLAGS) $+ $(LOADLIBES) $(LDLIBS) -o $@
|
||||||
|
|
||||||
# If the version string differs from the last build, update the last version
|
# If the version string differs from the last build, update the last version
|
||||||
ifneq ($(VERSION),$(shell cat .version 2>/dev/null))
|
ifneq ($(VERSION),$(shell cat .version 2>/dev/null))
|
||||||
.PHONY: .version
|
.PHONY: .version
|
||||||
endif
|
endif
|
||||||
.version:
|
.version:
|
||||||
echo '$(VERSION)' > $@
|
@echo " [VERS] $@"
|
||||||
|
$(Q)echo '$(VERSION)' > $@
|
||||||
|
|
||||||
# Rebuild the 'version' command any time the version string changes
|
# Rebuild the 'version' command any time the version string changes
|
||||||
cmd_version.o : .version
|
cmd_version.o : .version
|
||||||
@ -156,8 +180,9 @@ install: bcachefs lib
|
|||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
$(RM) bcachefs mount.bcachefs libbcachefs_mount.a tests/test_helper .version $(OBJS) $(DEPS) $(DOCGENERATED)
|
@echo "Cleaning all"
|
||||||
$(RM) -rf rust-src/*/target
|
$(Q)$(RM) bcachefs mount.bcachefs libbcachefs_mount.a tests/test_helper .version $(OBJS) $(DEPS) $(DOCGENERATED)
|
||||||
|
$(Q)$(RM) -rf rust-src/*/target
|
||||||
|
|
||||||
.PHONY: deb
|
.PHONY: deb
|
||||||
deb: all
|
deb: all
|
||||||
|
Loading…
Reference in New Issue
Block a user