Skip to contentSkip to conversation

Makefile: ignore configs/ prefix on configuration events

PATCH In review James Knight 2 participants 6 messages Jun 30, 2025 – Jul 7, 2025 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makefile: ignore configs/ prefix on configuration events

Allows accepting board configuration events that are prefixed with a configs/ path. This provides a convenience for users where it can be slightly easier/quicker to utilize shell completion to prepare a build. For example:

make configs/qemu_sparc64_sun4u_defconfig

Would be equivalent to:

make qemu_sparc64_sun4u_defconfig

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index c581067320..46b246245b 100644
@@ -1026,7 +1026,7 @@ defconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 		$(firstword \
 			$(foreach d, \
 				$(call reverse,$(TOPDIR) $(BR2_EXTERNAL_DIRS)), \
-				$(wildcard $(d)/configs/$@) \
+				$(wildcard $(d)/configs/$(@:configs/%=%)) \
 			) \
 		), \
 		$(error "Can't find $@") \
Signature · 6 lines
2.49.0.windows.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Hello all!

Quoted 10 lines · James Knight

Allows accepting board configuration events that are prefixed with a configs/ path. This provides a convenience for users where it can be slightly easier/quicker to utilize shell completion to prepare a build. For example:

make configs/qemu_sparc64_sun4u_defconfig

Would be equivalent to:

make qemu_sparc64_sun4u_defconfig

I don't know how this is supposed to work but, in my experience, shell completion on buildroot's make targets is painfully slow, and does not work with defonfig targets.

With this patch applied:

make qem<TAB> → make qemu
make qemu_sp<TAB>arc64<TAB> # no completion

make conf<TAB> → make config␣ # where “␣” is a trailing space make configs/qe<TAB>mu_sp<TAB>arc64<TAB> # no completion

It would be very cool to have usable shell completion though.

Context: Ubuntu 24.04, buildroot git master

Regards,

Edgar Bonet.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw
Quoted 20 lines · Edgar Bonet via buildroot

Hello all!

Quoted 10 lines · James Knight

Allows accepting board configuration events that are prefixed with a configs/ path. This provides a convenience for users where it can be slightly easier/quicker to utilize shell completion to prepare a build. For example:

make configs/qemu_sparc64_sun4u_defconfig

Would be equivalent to:

make qemu_sparc64_sun4u_defconfig

I don't know how this is supposed to work but, in my experience, shell completion on buildroot's make targets is painfully slow, and does not work with defonfig targets.

With this patch applied:

Quoted 7 lines

make qem<TAB> → make qemu
make qemu_sp<TAB>arc64<TAB> # no completion

make conf<TAB> → make config␣ # where “␣” is a trailing space make configs/qe<TAB>mu_sp<TAB>arc64<TAB> # no completion

It would be very cool to have usable shell completion though.

In bash, you can use Ctrl-backslash to only use filename completion, not
context-sensitive completion. But that only works if it's an actual filename, like in the example that James gives.

The context-sensitive completion with TAB already works without James' patch.

So basically, this patch is exactly a workaround for the problem you indicate
(if you know what ctrl-backslash does).

Regards,
Arnout

Quoted 10 lines

Context: Ubuntu 24.04, buildroot git master

Regards,

Edgar Bonet.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw

Hello!

Quoted 3 lines · Arnout Vandecappelle

In bash, you can use Ctrl-backslash to only use filename completion, not context-sensitive completion. But that only works if it's an actual filename, like in the example that James gives.

Today I learned something. Thanks! Now, on my system the key bindings are different:

    Ctrl-\  →  send SIGQUIT (ignored by bash)
    Alt-/   →  filename completion

Regards,

Edgar.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw
In reply to James Knight

Hi James,

Quoted 10 lines · James Knight

Allows accepting board configuration events that are prefixed with a configs/ path. This provides a convenience for users where it can be slightly easier/quicker to utilize shell completion to prepare a build. For example:

make configs/qemu_sparc64_sun4u_defconfig

Would be equivalent to:

make qemu_sparc64_sun4u_defconfig

I agree with the principle (though I want to think a little more about the
implications in corner cases). However...

Quoted 11 lines
---
  Makefile | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +0 -0
index c581067320..46b246245b 100644

Makefile defconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile · line 1029

Quoted 5 lines
Makefile +1 -1
@@ -1026,7 +1026,7 @@ defconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
  		$(firstword \
  			$(foreach d, \
  				$(call reverse,$(TOPDIR) $(BR2_EXTERNAL_DIRS)), \
-				$(wildcard $(d)/configs/$@) \
+				$(wildcard $(d)/configs/$(@:configs/%=%)) \

We don't use this kind of substitution, instead use patsubst.

And maybe it's simpler to use

	$(wildcard $(d)/configs/$@ $(d)/$@)

It would mean that any defconfig at the top of a br2-external would also work, but perhaps there's nothing wrong with that...

Regards,
Arnout

Makefile defconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile · line 1032

Quoted 3 lines
Makefile +0 -0
  			) \
  		), \
  		$(error "Can't find $@") \

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#5 lore raw

Arnout,

Quoted 1 line · Arnout Vandecappelle

We don't use this kind of substitution, instead use patsubst.

If using pathsubst is preferred (e.g. "$(wildcard $(d)/configs/$(call pathsubst,configs/,,$@))"), or using the other suggested variant:

Quoted 1 line
        $(wildcard $(d)/configs/$@ $(d)/$@)

Let me know and I can set up a patch for it (if desired).

Quoted 1 line

... I want to think a little more about the implications in corner cases...

And no worries if such a modification is not desired.
_______________________________________________
buildroot mailing list [email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot