Skip to content

Commit ebd99a6

Browse files
committed
btrfs: fix build when using M=fs/btrfs
There are people building the module with M= that's supposed to be used for external modules. This got broken in e9aa7c2 ("btrfs: enable W=1 checks for btrfs"). $ make M=fs/btrfs scripts/Makefile.lib:10: *** Recursive variable 'KBUILD_CFLAGS' references itself (eventually). Stop. make: *** [Makefile:1755: modules] Error 2 There's a difference compared to 'make fs/btrfs/btrfs.ko' which needs to rebuild a few more things and also the dependency modules need to be available. It could fail with eg. WARNING: Symbol version dump "Module.symvers" is missing. Modules may not have dependencies or modversions. In some environments it's more convenient to rebuild just the btrfs module by M= so let's make it work. The problem is with recursive variable evaluation in += so the conditional C options are stored in a temporary variable to avoid the recursion. Signed-off-by: David Sterba <[email protected]>
1 parent 3cb8949 commit ebd99a6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

fs/btrfs/Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ subdir-ccflags-y += -Wmissing-format-attribute
77
subdir-ccflags-y += -Wmissing-prototypes
88
subdir-ccflags-y += -Wold-style-definition
99
subdir-ccflags-y += -Wmissing-include-dirs
10-
subdir-ccflags-y += $(call cc-option, -Wunused-but-set-variable)
11-
subdir-ccflags-y += $(call cc-option, -Wunused-const-variable)
12-
subdir-ccflags-y += $(call cc-option, -Wpacked-not-aligned)
13-
subdir-ccflags-y += $(call cc-option, -Wstringop-truncation)
10+
condflags := \
11+
$(call cc-option, -Wunused-but-set-variable) \
12+
$(call cc-option, -Wunused-const-variable) \
13+
$(call cc-option, -Wpacked-not-aligned) \
14+
$(call cc-option, -Wstringop-truncation)
15+
subdir-ccflags-y += $(condflags)
1416
# The following turn off the warnings enabled by -Wextra
1517
subdir-ccflags-y += -Wno-missing-field-initializers
1618
subdir-ccflags-y += -Wno-sign-compare

0 commit comments

Comments
 (0)