PREFIX?=/usr/local
PKG_CONFIG?=pkg-config
INSTALL=install
+PYTEST=pytest-3
CFLAGS+=-std=gnu89 -O2 -g -MMD -Wall \
-Wno-pointer-sign \
-fno-strict-aliasing \
-D_LGPL_SOURCE \
-DRCU_MEMBARRIER \
-DZSTD_STATIC_LINKING_ONLY \
+ -DFUSE_USE_VERSION=32 \
-DNO_BCACHEFS_CHARDEV \
-DNO_BCACHEFS_FS \
-DNO_BCACHEFS_SYSFS \
ifdef D
CFLAGS+=-Werror
CFLAGS+=-DCONFIG_BCACHEFS_DEBUG=y
+ CFLAGS+=-DCONFIG_VALGRIND=y
endif
PKGCONFIG_LIBS="blkid uuid liburcu libsodium zlib liblz4 libzstd"
+ifdef BCACHEFS_FUSE
+ PKGCONFIG_LIBS+="fuse3 >= 3.7"
+ CFLAGS+=-DBCACHEFS_FUSE
+endif
PKGCONFIG_CFLAGS:=$(shell $(PKG_CONFIG) --cflags $(PKGCONFIG_LIBS))
ifeq (,$(PKGCONFIG_CFLAGS))
.PHONY: all
all: bcachefs
+.PHONY: tests
+tests: tests/test_helper
+
+.PHONY: check
+check: tests bcachefs
+ cd tests; $(PYTEST)
+
+.PHONY: TAGS tags
+TAGS:
+ ctags -e -R .
+
+tags:
+ ctags -R .
+
SRCS=$(shell find . -type f -iname '*.c')
DEPS=$(SRCS:.c=.d)
-include $(DEPS)
OBJS=$(SRCS:.c=.o)
-bcachefs: $(OBJS)
+bcachefs: $(filter-out ./tests/%.o, $(OBJS))
+
+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: clean
clean:
- $(RM) bcachefs .version $(OBJS) $(DEPS)
+ $(RM) bcachefs tests/test_helper .version $(OBJS) $(DEPS)
.PHONY: deb
deb: all