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>
PKG_CONFIG?=pkg-config
INSTALL=install
PKG_CONFIG?=pkg-config
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 \
-Wno-pointer-sign \
-fno-strict-aliasing \
CFLAGS+=-std=gnu11 -O2 -g -MMD -Wall -fPIC \
-Wno-pointer-sign \
-fno-strict-aliasing \
PYTEST_ARGS?=
PYTEST_CMD?=$(shell \
command -v pytest-3 \
PYTEST_ARGS?=
PYTEST_CMD?=$(shell \
command -v pytest-3 \
+ || which pytest-3 2>/dev/null \
)
PYTEST:=$(PYTEST_CMD) $(PYTEST_ARGS)
)
PYTEST:=$(PYTEST_CMD) $(PYTEST_ARGS)
-include $(DEPS)
OBJS=$(SRCS:.c=.o)
-include $(DEPS)
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')
MOUNT_SRCS=$(filter %mount, $(RUST_SRCS))
RUST_SRCS=$(shell find rust-src/ -type f -iname '*.rs')
MOUNT_SRCS=$(filter %mount, $(RUST_SRCS))
MOUNT_OBJ=$(filter-out ./bcachefs.o ./tests/%.o ./cmd_%.o , $(OBJS))
libbcachefs.so: LDFLAGS+=-shared
libbcachefs.so: $(MOUNT_OBJ)
MOUNT_OBJ=$(filter-out ./bcachefs.o ./tests/%.o ./cmd_%.o , $(OBJS))
libbcachefs.so: LDFLAGS+=-shared
libbcachefs.so: $(MOUNT_OBJ)
- $(CC) $(LDFLAGS) $+ -o $@ $(LDLIBS)
+ @echo " [CC] $@"
+ $(Q)$(CC) $(LDFLAGS) $+ -o $@ $(LDLIBS)
MOUNT_TOML=rust-src/mount/Cargo.toml
mount.bcachefs: lib $(MOUNT_SRCS)
MOUNT_TOML=rust-src/mount/Cargo.toml
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
ifneq ($(VERSION),$(shell cat .version 2>/dev/null))
.PHONY: .version
endif
.version:
# If the version string differs from the last build, update the last version
ifneq ($(VERSION),$(shell cat .version 2>/dev/null))
.PHONY: .version
endif
.version:
+ @echo " [VERS] $@"
+ $(Q)echo '$(VERSION)' > $@
# Rebuild the 'version' command any time the version string changes
cmd_version.o : .version
# Rebuild the 'version' command any time the version string changes
cmd_version.o : .version
- $(RM) bcachefs mount.bcachefs libbcachefs_mount.a tests/test_helper .version $(OBJS) $(DEPS) $(DOCGENERATED)
- $(RM) -rf rust-src/*/target
+ @echo "Cleaning all"
+ $(Q)$(RM) bcachefs mount.bcachefs libbcachefs_mount.a tests/test_helper .version $(OBJS) $(DEPS) $(DOCGENERATED)
+ $(Q)$(RM) -rf rust-src/*/target