VERSION?=$(shell git describe --dirty=+ 2>/dev/null || echo v0.1-nogit)
-CC_VERSION=$(shell $(CC) -v 2>&1|grep -E '(gcc|clang) version')
+include Makefile.compiler
-ifneq (,$(findstring gcc,$(CC_VERSION)))
- CFLAGS+=-Wno-unused-but-set-variable \
- -Wno-zero-length-bounds \
- -Wno-stringop-overflow
-endif
-
-ifneq (,$(findstring clang,$(CC_VERSION)))
- CFLAGS+=-Wno-missing-braces \
- -Wno-zero-length-array \
- -Wno-shift-overflow \
- -Wno-enum-conversion
-endif
-
-ifdef BCACHEFS_DEBUG
- CFLAGS+=-Werror
- CFLAGS+=-DCONFIG_BCACHEFS_DEBUG=y
-endif
- CFLAGS+=-DCONFIG_VALGRIND=y
+CFLAGS+=$(call cc-disable-warning, unused-but-set-variable)
+CFLAGS+=$(call cc-disable-warning, stringop-overflow)
+CFLAGS+=$(call cc-disable-warning, zero-length-bounds)
+CFLAGS+=$(call cc-disable-warning, missing-braces)
+CFLAGS+=$(call cc-disable-warning, zero-length-array)
+CFLAGS+=$(call cc-disable-warning, shift-overflow)
+CFLAGS+=$(call cc-disable-warning, enum-conversion)
PKGCONFIG_LIBS="blkid uuid liburcu libsodium zlib liblz4 libzstd libudev"
ifdef BCACHEFS_FUSE
INITRAMFS_DIR=/etc/initramfs-tools
endif
-var := $(shell rst2man 2>/dev/null)
-ifeq ($(.SHELLSTATUS),0)
+STATUS:=$(shell rst2man -V 2>/dev/null; echo $$?)
+ifeq ($(STATUS),0)
RST2MAN=rst2man
endif
-var := $(shell rst2man.py 2>/dev/null)
-ifeq ($(.SHELLSTATUS),0)
+STATUS:=$(shell rst2man.py -V 2>/dev/null; echo $$?)
+ifeq ($(STATUS),0)
RST2MAN=rst2man.py
endif
-undefine var
-
.PHONY: all
all: bcachefs bcachefs.5
.PHONY: check
check: tests bcachefs
- cd tests; $(PYTEST)
+ $(PYTEST)
.PHONY: TAGS tags
TAGS:
DOCGENERATED := bcachefs.5 doc/bcachefs.5.rst
DOCDEPS := $(addprefix ./doc/,$(DOCSRC))
bcachefs.5: $(DOCDEPS) libbcachefs/opts.h
+ifneq (,$(RST2MAN))
$(CC) doc/opts_macro.h -I libbcachefs -I include -E 2>/dev/null \
| doc/macro2rst.py
$(RST2MAN) doc/bcachefs.5.rst bcachefs.5
+else
+ @echo "WARNING: no rst2man found! Man page not generated."
+endif
SRCS=$(shell find . -type f -iname '*.c')
DEPS=$(SRCS:.c=.d)
git add include/linux/list_nulls.h
cp $(LINUX_DIR)/include/linux/poison.h include/linux/
git add include/linux/poison.h
+ cp $(LINUX_DIR)/scripts/Makefile.compiler ./
+ git add Makefile.compiler
$(RM) libbcachefs/*.mod.c
git -C $(LINUX_DIR) rev-parse HEAD | tee .bcachefs_revision
git add .bcachefs_revision