]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - Makefile
Update bcachefs sources to b964c6cba8 bcachefs: Change lockrestart_do() to always...
[bcachefs-tools-debian] / Makefile
index 6424433b9acdb91ac84e2ea158ae23b2557a2c6e..23e0508569d8b3856d0a4906d43be01495dda3df 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@ LDFLAGS+=$(CFLAGS) $(EXTRA_LDFLAGS)
 
 VERSION?=$(shell git describe --dirty=+ 2>/dev/null || echo v0.1-nogit)
 
-include Kbuild.include
+include Makefile.compiler
 
 CFLAGS+=$(call cc-disable-warning, unused-but-set-variable)
 CFLAGS+=$(call cc-disable-warning, stringop-overflow)
@@ -61,8 +61,24 @@ else
        INITRAMFS_DIR=/etc/initramfs-tools
 endif
 
+var := $(shell rst2man -V 2>/dev/null)
+ifeq ($(.SHELLSTATUS),0)
+       RST2MAN=rst2man
+endif
+
+var := $(shell rst2man.py -V 2>/dev/null)
+ifeq ($(.SHELLSTATUS),0)
+       RST2MAN=rst2man.py
+endif
+
+undefine var
+
+ifeq (,$(RST2MAN))
+       @echo "WARNING: no RST2MAN found!"
+endif
+
 .PHONY: all
-all: bcachefs
+all: bcachefs bcachefs.5
 
 .PHONY: tests
 tests: tests/test_helper
@@ -78,6 +94,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)
@@ -111,9 +135,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
@@ -130,16 +151,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
@@ -147,6 +166,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/
@@ -155,12 +178,12 @@ 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/Kbuild.include ./
-       git add Kbuild.include
+       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
 
-.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)"