+bcachefs: $(filter-out ./tests/%.o, $(OBJS))
+
+MOUNT_SRCS=$(shell find mount/src -type f -iname '*.rs') \
+ mount/Cargo.toml mount/Cargo.lock mount/build.rs
+libbcachefs_mount.a: $(MOUNT_SRCS)
+ LIBBCACHEFS_INCLUDE=$(CURDIR) cargo build --manifest-path mount/Cargo.toml --release
+ cp mount/target/release/libbcachefs_mount.a $@
+
+MOUNT_OBJ=$(filter-out ./bcachefs.o ./tests/%.o ./cmd_%.o , $(OBJS))
+mount.bcachefs: libbcachefs_mount.a $(MOUNT_OBJ)
+ $(CC) -Wl,--gc-sections libbcachefs_mount.a $(MOUNT_OBJ) -o $@ $(LDLIBS)
+
+tests/test_helper: $(filter ./tests/%.o, $(OBJS))
+
+# 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 '$(VERSION)' > $@
+
+# Rebuild the 'version' command any time the version string changes
+cmd_version.o : .version
+
+doc/bcachefs.5: doc/bcachefs.5.txt
+ a2x -f manpage doc/bcachefs.5.txt