bcachefs-tools/Makefile

96 lines
2.7 KiB
Makefile
Raw Normal View History

2010-05-15 19:26:35 +04:00
2018-02-09 18:33:26 +03:00
PREFIX=/usr/local
2013-10-07 01:13:05 +04:00
INSTALL=install
2017-08-18 00:11:06 +03:00
CFLAGS+=-std=gnu89 -O2 -g -MMD -Wall \
2017-01-08 12:13:18 +03:00
-Wno-pointer-sign \
-fno-strict-aliasing \
-I. -Iinclude \
2017-01-08 12:13:18 +03:00
-D_FILE_OFFSET_BITS=64 \
-D_GNU_SOURCE \
-D_LGPL_SOURCE \
-DRCU_MEMBARRIER \
-DZSTD_STATIC_LINKING_ONLY \
-DNO_BCACHEFS_CHARDEV \
-DNO_BCACHEFS_FS \
-DNO_BCACHEFS_SYSFS \
2017-01-08 12:13:18 +03:00
$(EXTRA_CFLAGS)
2017-11-13 00:48:07 +03:00
LDFLAGS+=$(CFLAGS)
2017-02-02 06:16:42 +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
endif
ifneq (,$(findstring clang,$(CC_VERSION)))
CFLAGS+=-Wno-missing-braces
endif
ifdef D
CFLAGS+=-Werror
2017-08-18 00:11:06 +03:00
CFLAGS+=-DCONFIG_BCACHEFS_DEBUG=y
endif
2010-05-15 19:26:35 +04:00
PKGCONFIG_LIBS="blkid uuid liburcu libsodium zlib"
PKGCONFIG_LIBS_STATIC="libzstd"
2016-08-24 06:50:31 +03:00
CFLAGS+=`pkg-config --cflags ${PKGCONFIG_LIBS}`
LDLIBS+=`pkg-config --libs ${PKGCONFIG_LIBS}`
CFLAGS+=`pkg-config --static --cflags ${PKGCONFIG_LIBS_STATIC}`
LDLIBS+=`pkg-config --static --libs ${PKGCONFIG_LIBS_STATIC}`
LDLIBS+=-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
INITRAMFS_DIR=$(PREFIX)/share/initramfs-tools
2016-04-26 04:13:15 +03:00
else
ROOT_SBINDIR=$(PREFIX)/sbin
INITRAMFS_DIR=/etc/initramfs-tools
2016-04-26 04:13:15 +03:00
endif
2010-05-15 19:26:35 +04:00
2016-08-29 05:00:50 +03:00
.PHONY: all
all: bcachefs
2016-04-26 04:13:15 +03:00
SRCS=$(shell find . -type f -iname '*.c')
DEPS=$(SRCS:.c=.d)
2017-01-08 12:13:18 +03:00
-include $(DEPS)
2016-10-12 04:50:54 +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
install: bcachefs
2016-08-29 05:00:50 +03:00
mkdir -p $(DESTDIR)$(ROOT_SBINDIR)
mkdir -p $(DESTDIR)$(PREFIX)/share/man/man8/
$(INSTALL) -m0755 bcachefs $(DESTDIR)$(ROOT_SBINDIR)
$(INSTALL) -m0755 fsck.bcachefs $(DESTDIR)$(ROOT_SBINDIR)
$(INSTALL) -m0755 mkfs.bcachefs $(DESTDIR)$(ROOT_SBINDIR)
$(INSTALL) -m0755 -D initramfs/hook $(DESTDIR)$(INITRAMFS_DIR)/hooks/bcachefs
echo "copy_exec $(ROOT_SBINDIR)/bcachefs /sbin/bcachefs" >> $(DESTDIR)$(INITRAMFS_DIR)/hooks/bcachefs
$(INSTALL) -m0755 -D initramfs/script $(DESTDIR)$(INITRAMFS_DIR)/scripts/local-premount/bcachefs
$(INSTALL) -m0644 bcachefs.8 $(DESTDIR)$(PREFIX)/share/man/man8/
2016-08-29 05:00:50 +03:00
.PHONY: clean
clean:
$(RM) bcachefs $(OBJS) $(DEPS)
2016-08-29 05:00:50 +03:00
.PHONY: deb
deb: all
# --unsigned-source --unsigned-changes --no-pre-clean --build=binary
# --diff-ignore --tar-ignore
debuild -us -uc -nc -b -i -I
2017-01-08 12:13:18 +03:00
.PHONE: update-bcachefs-sources
update-bcachefs-sources:
git rm -rf --ignore-unmatch libbcachefs
cp $(LINUX_DIR)/fs/bcachefs/*.[ch] libbcachefs/
cp $(LINUX_DIR)/include/trace/events/bcachefs.h include/trace/events/
echo `cd $(LINUX_DIR); git rev-parse HEAD` > .bcachefs_revision
git add libbcachefs/*.[ch] include/trace/events/bcachefs.h .bcachefs_revision
2017-04-04 10:05:13 +03:00
.PHONE: update-commit-bcachefs-sources
update-commit-bcachefs-sources: update-bcachefs-sources
git commit -m "Update bcachefs sources to `cd $(LINUX_DIR); git show --oneline --no-patch`"