]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - Makefile
Bring back debug makefile target
[bcachefs-tools-debian] / Makefile
index 3fe9604896513eed03b429965cca1bf4202f1c23..6dcbc0682f5fb4725df9fbdcf541aabf418dbde8 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,9 @@
-
 PREFIX?=/usr/local
 PKG_CONFIG?=pkg-config
 INSTALL=install
 PYTEST=pytest-3
 CFLAGS+=-std=gnu89 -O2 -g -MMD -Wall                           \
        -Wno-pointer-sign                                       \
-       -Wno-zero-length-bounds                                 \
-       -Wno-stringop-overflow                                  \
        -fno-strict-aliasing                                    \
        -fno-delete-null-pointer-checks                         \
        -I. -Iinclude -Iraid                                    \
@@ -28,14 +25,19 @@ VERSION?=$(shell git describe --dirty=+ 2>/dev/null || echo v0.1-nogit)
 CC_VERSION=$(shell $(CC) -v 2>&1|grep -E '(gcc|clang) version')
 
 ifneq (,$(findstring gcc,$(CC_VERSION)))
-       CFLAGS+=-Wno-unused-but-set-variable
+       CFLAGS+=-Wno-unused-but-set-variable                    \
+               -Wno-zero-length-bounds                         \
+               -Wno-stringop-overflow
 endif
 
 ifneq (,$(findstring clang,$(CC_VERSION)))
-       CFLAGS+=-Wno-missing-braces
+       CFLAGS+=-Wno-missing-braces                             \
+               -Wno-zero-length-array                          \
+               -Wno-shift-overflow                             \
+               -Wno-enum-conversion
 endif
 
-ifdef D
+ifdef BCACHEFS_DEBUG
        CFLAGS+=-Werror
        CFLAGS+=-DCONFIG_BCACHEFS_DEBUG=y
 endif
@@ -71,7 +73,7 @@ else
 endif
 
 .PHONY: all
-all: bcachefs
+all: bcachefs bcachefs.5
 
 .PHONY: tests
 tests: tests/test_helper
@@ -87,6 +89,14 @@ TAGS:
 tags:
        ctags -R .
 
+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
+       $(CC) doc/opts_macro.h -I libbcachefs -I include -E 2>/dev/null \
+               | doc/macro2rst.py
+       rst2man doc/bcachefs.5.rst bcachefs.5
+
 SRCS=$(shell find . -type f -iname '*.c')
 DEPS=$(SRCS:.c=.d)
 -include $(DEPS)
@@ -96,6 +106,10 @@ bcachefs: $(filter-out ./tests/%.o, $(OBJS))
 
 MOUNT_SRCS=$(shell find mount/src -type f -iname '*.rs') \
     mount/Cargo.toml mount/Cargo.lock mount/build.rs
+
+debug: CFLAGS+=-Werror -DCONFIG_BCACHEFS_DEBUG=y -DCONFIG_VALGRIND=y
+debug: bcachefs
+
 libbcachefs_mount.a: $(MOUNT_SRCS)
        LIBBCACHEFS_INCLUDE=$(CURDIR) cargo build --manifest-path mount/Cargo.toml --release
        cp mount/target/release/libbcachefs_mount.a $@
@@ -116,9 +130,6 @@ endif
 # Rebuild the 'version' command any time the version string changes
 cmd_version.o : .version
 
-doc/bcachefs.5: doc/bcachefs.5.txt
-       a2x -f manpage doc/bcachefs.5.txt
-
 .PHONY: install
 install: INITRAMFS_HOOK=$(INITRAMFS_DIR)/hooks/bcachefs
 install: INITRAMFS_SCRIPT=$(INITRAMFS_DIR)/scripts/local-premount/bcachefs
@@ -135,16 +146,14 @@ install: bcachefs
 
 .PHONY: clean
 clean:
-       $(RM) bcachefs mount.bcachefs libbcachefs_mount.a tests/test_helper .version $(OBJS) $(DEPS)
+       $(RM) bcachefs mount.bcachefs libbcachefs_mount.a tests/test_helper .version $(OBJS) $(DEPS) $(DOCGENERATED)
        $(RM) -rf mount/target
 
 .PHONY: deb
 deb: all
-# --unsigned-source --unsigned-changes --no-pre-clean --build=binary
-# --diff-ignore --tar-ignore
        debuild -us -uc -nc -b -i -I
 
-.PHONE: update-bcachefs-sources
+.PHONY: update-bcachefs-sources
 update-bcachefs-sources:
        git rm -rf --ignore-unmatch libbcachefs
        test -d libbcachefs || mkdir libbcachefs
@@ -152,6 +161,10 @@ update-bcachefs-sources:
        git add libbcachefs/*.[ch]
        cp $(LINUX_DIR)/include/trace/events/bcachefs.h include/trace/events/
        git add include/trace/events/bcachefs.h
+       cp $(LINUX_DIR)/include/linux/xxhash.h include/linux/
+       git add include/linux/xxhash.h
+       cp $(LINUX_DIR)/lib/xxhash.c linux/
+       git add linux/xxhash.c
        cp $(LINUX_DIR)/kernel/locking/six.c linux/
        git add linux/six.c
        cp $(LINUX_DIR)/include/linux/six.h include/linux/
@@ -164,6 +177,6 @@ update-bcachefs-sources:
        git -C $(LINUX_DIR) rev-parse HEAD | tee .bcachefs_revision
        git add .bcachefs_revision
 
-.PHONE: update-commit-bcachefs-sources
+.PHONY: update-commit-bcachefs-sources
 update-commit-bcachefs-sources: update-bcachefs-sources
        git commit -m "Update bcachefs sources to $(shell git -C $(LINUX_DIR) show --oneline --no-patch)"