Add a NO_RUST option

For systems without working rust/llvm/bindgen, add an option for
building without Rust. This will be less of an option in the future, as
more code gets rewritten in Rust.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2023-04-20 12:35:27 -04:00
parent 700afe1939
commit 0f37f9f05f
2 changed files with 17 additions and 2 deletions

View File

@ -108,7 +108,15 @@ OBJS=$(SRCS:.c=.o)
@echo " [CC] $@" @echo " [CC] $@"
$(Q)$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< $(Q)$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
bcachefs: libbcachefs.a rust-src/target/release/libbcachefs_rust.a BCACHEFS_DEPS=libbcachefs.a
ifndef NO_RUST
BCACHEFS_DEPS+=rust-src/target/release/libbcachefs_rust.a
else
CFLAGS+=-DBCACHEFS_NO_RUST
endif
bcachefs: $(BCACHEFS_DEPS)
@echo " [LD] $@" @echo " [LD] $@"
$(Q)$(CC) $(LDFLAGS) -Wl,--whole-archive $+ $(LOADLIBES) -Wl,--no-whole-archive $(LDLIBS) -o $@ $(Q)$(CC) $(LDFLAGS) -Wl,--whole-archive $+ $(LOADLIBES) -Wl,--no-whole-archive $(LDLIBS) -o $@

View File

@ -35,9 +35,11 @@ static void usage(void)
" show-super Dump superblock information to stdout\n" " show-super Dump superblock information to stdout\n"
" set-option Set a filesystem option\n" " set-option Set a filesystem option\n"
"\n" "\n"
#ifndef BCACHEFS_NO_RUST
"Mount:\n" "Mount:\n"
" mount Mount a filesystem\n" " mount Mount a filesystem\n"
"\n" "\n"
#endif
"Repair:\n" "Repair:\n"
" fsck Check an existing filesystem for errors\n" " fsck Check an existing filesystem for errors\n"
"\n" "\n"
@ -85,7 +87,9 @@ static void usage(void)
"Debug:\n" "Debug:\n"
"These commands work on offline, unmounted filesystems\n" "These commands work on offline, unmounted filesystems\n"
" dump Dump filesystem metadata to a qcow2 image\n" " dump Dump filesystem metadata to a qcow2 image\n"
#ifndef BCACHEFS_NO_RUST
" list List filesystem metadata in textual form\n" " list List filesystem metadata in textual form\n"
#endif
" list_journal List contents of journal\n" " list_journal List contents of journal\n"
"\n" "\n"
"Miscellaneous:\n" "Miscellaneous:\n"
@ -231,8 +235,10 @@ int main(int argc, char *argv[])
if (!strcmp(cmd, "dump")) if (!strcmp(cmd, "dump"))
return cmd_dump(argc, argv); return cmd_dump(argc, argv);
#ifndef BCACHEFS_NO_RUST
if (!strcmp(cmd, "list")) if (!strcmp(cmd, "list"))
return cmd_list(argc, argv); return cmd_list(argc, argv);
#endif
if (!strcmp(cmd, "list_journal")) if (!strcmp(cmd, "list_journal"))
return cmd_list_journal(argc, argv); return cmd_list_journal(argc, argv);
if (!strcmp(cmd, "kill_btree_node")) if (!strcmp(cmd, "kill_btree_node"))
@ -240,11 +246,12 @@ int main(int argc, char *argv[])
if (!strcmp(cmd, "setattr")) if (!strcmp(cmd, "setattr"))
return cmd_setattr(argc, argv); return cmd_setattr(argc, argv);
#ifndef BCACHEFS_NO_RUST
if (!strcmp(cmd, "mount")) { if (!strcmp(cmd, "mount")) {
cmd_mount(argc, argv); cmd_mount(argc, argv);
return 0; return 0;
} }
#endif
#ifdef BCACHEFS_FUSE #ifdef BCACHEFS_FUSE
if (!strcmp(cmd, "fusemount")) if (!strcmp(cmd, "fusemount"))