2010-05-15 19:26:35 +04:00
|
|
|
|
2010-12-16 12:22:45 +03:00
|
|
|
PREFIX=/usr
|
2013-10-07 01:13:05 +04:00
|
|
|
INSTALL=install
|
2017-02-02 06:16:42 +03:00
|
|
|
CFLAGS+=-std=gnu99 -O2 -g -MMD -Wall \
|
2017-01-08 12:13:18 +03:00
|
|
|
-Wno-pointer-sign \
|
|
|
|
-fno-strict-aliasing \
|
2017-03-20 02:56:34 +03:00
|
|
|
-I. -Iinclude -Ilibbcachefs \
|
2017-01-08 12:13:18 +03:00
|
|
|
-D_FILE_OFFSET_BITS=64 \
|
|
|
|
-D_GNU_SOURCE \
|
|
|
|
-D_LGPL_SOURCE \
|
|
|
|
-DRCU_MEMBARRIER \
|
2017-03-04 09:09:52 +03:00
|
|
|
-DNO_BCACHE_CHARDEV \
|
|
|
|
-DNO_BCACHE_FS \
|
2017-03-20 08:39:19 +03:00
|
|
|
-DNO_BCACHE_SYSFS \
|
2017-01-08 12:13:18 +03:00
|
|
|
$(EXTRA_CFLAGS)
|
2017-02-02 06:16:42 +03:00
|
|
|
LDFLAGS+=-O2 -g
|
|
|
|
|
2017-04-04 11:28:13 +03:00
|
|
|
CC_VERSION=$(shell $(CC) -v 2>&1|grep -E '(gcc|clang) version')
|
|
|
|
|
|
|
|
ifneq (,$(findstring gcc,$(CC_VERSION)))
|
|
|
|
CFLAGS+=-Wno-unused-but-set-variable
|
|
|
|
ifndef D
|
2017-02-03 09:45:08 +03:00
|
|
|
CFLAGS+=-flto
|
2017-02-02 06:16:42 +03:00
|
|
|
LDFLAGS+=-flto
|
|
|
|
endif
|
2017-04-04 11:28:13 +03:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq (,$(findstring clang,$(CC_VERSION)))
|
|
|
|
CFLAGS+=-Wno-missing-braces
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef D
|
|
|
|
CFLAGS+=-Werror
|
|
|
|
endif
|
2010-05-15 19:26:35 +04:00
|
|
|
|
2017-03-04 09:09:52 +03:00
|
|
|
PKGCONFIG_LIBS="blkid uuid liburcu libsodium zlib"
|
2016-08-24 06:50:31 +03:00
|
|
|
CFLAGS+=`pkg-config --cflags ${PKGCONFIG_LIBS}`
|
2016-10-04 06:22:17 +03:00
|
|
|
LDLIBS+=`pkg-config --libs ${PKGCONFIG_LIBS}` \
|
2017-04-24 08:55:50 +03:00
|
|
|
-lm -lpthread -lrt -lscrypt -lkeyutils -laio
|
2016-08-24 06:50:31 +03:00
|
|
|
|
2016-08-29 05:00:50 +03:00
|
|
|
ifeq ($(PREFIX),/usr)
|
2016-04-26 04:13:15 +03:00
|
|
|
ROOT_SBINDIR=/sbin
|
|
|
|
else
|
|
|
|
ROOT_SBINDIR=$(PREFIX)/sbin
|
|
|
|
endif
|
2010-05-15 19:26:35 +04:00
|
|
|
|
2016-08-29 05:00:50 +03:00
|
|
|
.PHONY: all
|
2017-03-20 02:56:34 +03:00
|
|
|
all: bcachefs
|
2016-04-26 04:13:15 +03:00
|
|
|
|
2017-03-20 02:56:34 +03:00
|
|
|
SRCS=bcachefs.c \
|
|
|
|
cmd_assemble.c \
|
|
|
|
cmd_debug.c \
|
|
|
|
cmd_device.c \
|
|
|
|
cmd_fs.c \
|
|
|
|
cmd_fsck.c \
|
|
|
|
cmd_format.c \
|
|
|
|
cmd_key.c \
|
|
|
|
cmd_migrate.c \
|
|
|
|
cmd_run.c \
|
|
|
|
crypto.c \
|
|
|
|
libbcachefs.c \
|
|
|
|
qcow2.c \
|
|
|
|
tools-util.c \
|
2017-03-20 08:39:19 +03:00
|
|
|
libbcachefs/alloc.c \
|
|
|
|
libbcachefs/bkey.c \
|
|
|
|
libbcachefs/bkey_methods.c \
|
|
|
|
libbcachefs/bset.c \
|
|
|
|
libbcachefs/btree_cache.c \
|
|
|
|
libbcachefs/btree_gc.c \
|
|
|
|
libbcachefs/btree_io.c \
|
|
|
|
libbcachefs/btree_iter.c \
|
2017-06-14 04:06:05 +03:00
|
|
|
libbcachefs/btree_update_interior.c\
|
|
|
|
libbcachefs/btree_update_leaf.c \
|
2017-03-20 08:39:19 +03:00
|
|
|
libbcachefs/buckets.c \
|
|
|
|
libbcachefs/checksum.c \
|
|
|
|
libbcachefs/clock.c \
|
|
|
|
libbcachefs/compress.c \
|
|
|
|
libbcachefs/debug.c \
|
|
|
|
libbcachefs/dirent.c \
|
|
|
|
libbcachefs/error.c \
|
|
|
|
libbcachefs/extents.c \
|
2017-04-15 07:38:49 +03:00
|
|
|
libbcachefs/fsck.c \
|
2017-03-20 08:39:19 +03:00
|
|
|
libbcachefs/inode.c \
|
|
|
|
libbcachefs/io.c \
|
|
|
|
libbcachefs/journal.c \
|
|
|
|
libbcachefs/keylist.c \
|
2017-05-08 13:19:29 +03:00
|
|
|
libbcachefs/lz4_compress.c \
|
|
|
|
libbcachefs/lz4_decompress.c \
|
2017-03-20 08:39:19 +03:00
|
|
|
libbcachefs/migrate.c \
|
|
|
|
libbcachefs/move.c \
|
|
|
|
libbcachefs/movinggc.c \
|
|
|
|
libbcachefs/opts.c \
|
|
|
|
libbcachefs/siphash.c \
|
|
|
|
libbcachefs/six.c \
|
|
|
|
libbcachefs/super.c \
|
|
|
|
libbcachefs/super-io.c \
|
|
|
|
libbcachefs/tier.c \
|
|
|
|
libbcachefs/trace.c \
|
|
|
|
libbcachefs/util.c \
|
|
|
|
libbcachefs/xattr.c \
|
2017-03-20 02:56:34 +03:00
|
|
|
$(wildcard linux/*.c linux/*/*.c) \
|
|
|
|
$(wildcard ccan/*/*.c)
|
2014-12-06 06:20:03 +03:00
|
|
|
|
2017-03-20 02:56:34 +03:00
|
|
|
DEPS=$(SRCS:.c=.d)
|
2017-01-08 12:13:18 +03:00
|
|
|
-include $(DEPS)
|
2016-10-12 04:50:54 +03:00
|
|
|
|
2017-03-20 02:56:34 +03:00
|
|
|
OBJS=$(SRCS:.c=.o)
|
|
|
|
bcachefs: $(OBJS)
|
2016-04-26 04:13:15 +03:00
|
|
|
|
2016-08-29 05:00:50 +03:00
|
|
|
.PHONY: install
|
2017-03-20 02:56:34 +03:00
|
|
|
install: bcachefs
|
2016-08-29 05:00:50 +03:00
|
|
|
mkdir -p $(DESTDIR)$(ROOT_SBINDIR)
|
|
|
|
mkdir -p $(DESTDIR)$(PREFIX)/share/man/man8/
|
2017-03-20 02:56:34 +03:00
|
|
|
$(INSTALL) -m0755 bcachefs $(DESTDIR)$(ROOT_SBINDIR)
|
|
|
|
$(INSTALL) -m0755 fsck.bcachefs $(DESTDIR)$(ROOT_SBINDIR)
|
|
|
|
$(INSTALL) -m0755 mkfs.bcachefs $(DESTDIR)$(ROOT_SBINDIR)
|
|
|
|
$(INSTALL) -m0644 bcachefs.8 $(DESTDIR)$(PREFIX)/share/man/man8/
|
2016-08-29 05:00:50 +03:00
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
2017-03-20 02:56:34 +03:00
|
|
|
$(RM) bcachefs $(OBJS) $(DEPS)
|
2016-08-29 05:00:50 +03:00
|
|
|
|
|
|
|
.PHONY: deb
|
|
|
|
deb: all
|
2016-12-12 02:45:48 +03:00
|
|
|
debuild --unsigned-source \
|
|
|
|
--unsigned-changes \
|
|
|
|
--no-pre-clean \
|
|
|
|
--build=binary \
|
|
|
|
--diff-ignore \
|
|
|
|
--tar-ignore
|
2017-01-08 12:13:18 +03:00
|
|
|
|
2017-03-20 02:56:34 +03:00
|
|
|
.PHONE: update-bcachefs-sources
|
|
|
|
update-bcachefs-sources:
|
|
|
|
echo `cd $(LINUX_DIR); git rev-parse HEAD` > .bcachefs_revision
|
|
|
|
cp $(LINUX_DIR)/fs/bcachefs/*.[ch] libbcachefs/
|
|
|
|
cp $(LINUX_DIR)/include/trace/events/bcachefs.h include/trace/events/
|
2017-04-04 10:05:13 +03:00
|
|
|
|
|
|
|
.PHONE: update-commit-bcachefs-sources
|
|
|
|
update-commit-bcachefs-sources: update-bcachefs-sources
|
2017-05-05 12:49:48 +03:00
|
|
|
git commit -m "Update bcachefs sources to `cd $(LINUX_DIR); git show --oneline --no-patch`"\
|
2017-04-04 10:05:13 +03:00
|
|
|
.bcachefs_revision libbcachefs/
|