4 CFLAGS+=-std=gnu89 -O2 -g -MMD -Wall \
8 -D_FILE_OFFSET_BITS=64 \
12 -DZSTD_STATIC_LINKING_ONLY \
13 -DNO_BCACHEFS_CHARDEV \
16 -DVERSION_STRING='"$(VERSION)"' \
20 VERSION?=$(shell git describe --dirty 2>/dev/null || echo 0.1-nogit)
22 CC_VERSION=$(shell $(CC) -v 2>&1|grep -E '(gcc|clang) version')
24 ifneq (,$(findstring gcc,$(CC_VERSION)))
25 CFLAGS+=-Wno-unused-but-set-variable
28 ifneq (,$(findstring clang,$(CC_VERSION)))
29 CFLAGS+=-Wno-missing-braces
34 CFLAGS+=-DCONFIG_BCACHEFS_DEBUG=y
37 PKGCONFIG_LIBS="blkid uuid liburcu libsodium zlib liblz4 libzstd"
39 CFLAGS+=`pkg-config --cflags ${PKGCONFIG_LIBS}`
40 LDLIBS+=`pkg-config --libs ${PKGCONFIG_LIBS}`
42 LDLIBS+=-lm -lpthread -lrt -lscrypt -lkeyutils -laio
46 INITRAMFS_DIR=$(PREFIX)/share/initramfs-tools
48 ROOT_SBINDIR=$(PREFIX)/sbin
49 INITRAMFS_DIR=/etc/initramfs-tools
55 SRCS=$(shell find . -type f -iname '*.c')
62 # If the version string differs from the last build, update the last version
63 ifneq ($(VERSION),$(shell cat .version 2>/dev/null))
67 echo '$(VERSION)' > $@
69 # Rebuild the 'version' command any time the version string changes
70 cmd_version.o : .version
74 mkdir -p $(DESTDIR)$(ROOT_SBINDIR)
75 mkdir -p $(DESTDIR)$(PREFIX)/share/man/man8/
76 $(INSTALL) -m0755 bcachefs $(DESTDIR)$(ROOT_SBINDIR)
77 $(INSTALL) -m0755 fsck.bcachefs $(DESTDIR)$(ROOT_SBINDIR)
78 $(INSTALL) -m0755 mkfs.bcachefs $(DESTDIR)$(ROOT_SBINDIR)
79 $(INSTALL) -m0755 -D initramfs/hook $(DESTDIR)$(INITRAMFS_DIR)/hooks/bcachefs
80 echo "copy_exec $(ROOT_SBINDIR)/bcachefs /sbin/bcachefs" >> $(DESTDIR)$(INITRAMFS_DIR)/hooks/bcachefs
81 $(INSTALL) -m0755 -D initramfs/script $(DESTDIR)$(INITRAMFS_DIR)/scripts/local-premount/bcachefs
82 $(INSTALL) -m0644 bcachefs.8 $(DESTDIR)$(PREFIX)/share/man/man8/
86 $(RM) bcachefs $(OBJS) $(DEPS)
90 # --unsigned-source --unsigned-changes --no-pre-clean --build=binary
91 # --diff-ignore --tar-ignore
92 debuild -us -uc -nc -b -i -I
94 .PHONE: update-bcachefs-sources
95 update-bcachefs-sources:
96 git rm -rf --ignore-unmatch libbcachefs
97 cp $(LINUX_DIR)/fs/bcachefs/*.[ch] libbcachefs/
98 cp $(LINUX_DIR)/include/trace/events/bcachefs.h include/trace/events/
99 echo `cd $(LINUX_DIR); git rev-parse HEAD` > .bcachefs_revision
100 git add libbcachefs/*.[ch] include/trace/events/bcachefs.h .bcachefs_revision
102 .PHONE: update-commit-bcachefs-sources
103 update-commit-bcachefs-sources: update-bcachefs-sources
104 git commit -m "Update bcachefs sources to `cd $(LINUX_DIR); git show --oneline --no-patch`"