]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - Makefile
Update bcachefs sources to 710cd382bf bcachefs: Fix for leaking of reflinked extents
[bcachefs-tools-debian] / Makefile
index f8b021610ffa20f26cca4719affbed898d5e780c..9ee1ff00dc605871abb79b6a6c211a0a9d99e6f4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -22,26 +22,15 @@ LDFLAGS+=$(CFLAGS) $(EXTRA_LDFLAGS)
 
 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
@@ -72,18 +61,16 @@ else
        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
 
@@ -92,7 +79,7 @@ tests: tests/test_helper
 
 .PHONY: check
 check: tests bcachefs
-       cd tests; $(PYTEST)
+       $(PYTEST)
 
 .PHONY: TAGS tags
 TAGS:
@@ -105,9 +92,13 @@ DOCSRC := opts_macro.h bcachefs.5.rst.tmpl
 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)
@@ -185,6 +176,8 @@ update-bcachefs-sources:
        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