Skip to content

Conversation

@jserv
Copy link
Contributor

@jserv jserv commented Oct 16, 2025

This converts tools/kconfig to git submodule pointing to the refined one [1], integrates Kbuild toolchain detection functions for automatic dependency checking, and tweaks build system to prevent unnecessary compilation when invalid targets are specified.

  • Add Kbuild $(success,...) functions to detect SDL2, Pixman, libpng, libjpeg
  • Add dependency clauses to backend and loader options

[1] https://github.com/sysprog21/Kconfiglib

@jserv jserv force-pushed the refine-kconfiglib branch from 954ee24 to 512d1f6 Compare October 16, 2025 08:41
This converts tools/kconfig to git submodule pointing to the refined
one [1], integrates Kbuild toolchain detection functions for automatic
dependency checking, and tweaks build system to prevent unnecessary
compilation when invalid targets are specified.
- Add Kbuild $(success,...) functions to detect SDL2, Pixman, libpng,
  libjpeg
- Add dependency clauses to backend and loader options

[1] https://github.com/sysprog21/Kconfiglib
@jserv jserv force-pushed the refine-kconfiglib branch from 512d1f6 to 72fb57b Compare October 16, 2025 08:57
@jserv jserv merged commit 4bb784a into main Oct 16, 2025
7 checks passed
@jserv jserv deleted the refine-kconfiglib branch October 16, 2025 09:01
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 issues found across 17 files

Prompt for AI agents (all 3 issues)

Understand the root cause of the following 3 issues and fix them.


<file name="configs/Kconfig">

<violation number="1" location="configs/Kconfig:9">
`def_bool` cannot invoke Make functions like `$(success,...)`; this introduces invalid syntax and causes Kconfig parsing to fail. Please replace the defaults with a valid Kconfig mechanism (e.g., deriving the value from another symbol or environment option).</violation>
</file>

<file name="mk/common.mk">

<violation number="1" location="mk/common.mk:685">
This condition only checks whether any goal is known. If a user runs a mix of known and unknown targets (e.g. `make foo clean`), `$(filter ...)` returns `clean`, so the block still includes `$(target-depends)` and the build fails with missing .d files. The guard needs to verify that **all** goals are known before including dependencies.</violation>
</file>

<file name="Makefile">

<violation number="1" location="Makefile:9">
Skipping mk/common.mk whenever config/defconfig appears in MAKECMDGOALS means multi-goal invocations like &quot;make defconfig all&quot; can no longer build because the core rules are never included.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.


# Dependency detection using Kbuild toolchain functions
config HAVE_SDL2
def_bool $(success,pkg-config --exists sdl2)
Copy link

@cubic-dev-ai cubic-dev-ai bot Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

def_bool cannot invoke Make functions like $(success,...); this introduces invalid syntax and causes Kconfig parsing to fail. Please replace the defaults with a valid Kconfig mechanism (e.g., deriving the value from another symbol or environment option).

Prompt for AI agents
Address the following comment on configs/Kconfig at line 9:

<comment>`def_bool` cannot invoke Make functions like `$(success,...)`; this introduces invalid syntax and causes Kconfig parsing to fail. Please replace the defaults with a valid Kconfig mechanism (e.g., deriving the value from another symbol or environment option).</comment>

<file context>
@@ -4,6 +4,19 @@ config CONFIGURED
 
+# Dependency detection using Kbuild toolchain functions
+config HAVE_SDL2
+    def_bool $(success,pkg-config --exists sdl2)
+
+config HAVE_PIXMAN
</file context>
Fix with Cubic

build-goals := all clean $(target-builds)
ifneq ($(MAKECMDGOALS),)
# MAKECMDGOALS is not empty, check if it's a known target
ifneq ($(filter $(MAKECMDGOALS),$(build-goals)),)
Copy link

@cubic-dev-ai cubic-dev-ai bot Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition only checks whether any goal is known. If a user runs a mix of known and unknown targets (e.g. make foo clean), $(filter ...) returns clean, so the block still includes $(target-depends) and the build fails with missing .d files. The guard needs to verify that all goals are known before including dependencies.

Prompt for AI agents
Address the following comment on mk/common.mk at line 685:

<comment>This condition only checks whether any goal is known. If a user runs a mix of known and unknown targets (e.g. `make foo clean`), `$(filter ...)` returns `clean`, so the block still includes `$(target-depends)` and the build fails with missing .d files. The guard needs to verify that **all** goals are known before including dependencies.</comment>

<file context>
@@ -678,6 +678,17 @@ clean: __FORCE
+build-goals := all clean $(target-builds)
+ifneq ($(MAKECMDGOALS),)
+    # MAKECMDGOALS is not empty, check if it&#39;s a known target
+    ifneq ($(filter $(MAKECMDGOALS),$(build-goals)),)
+        # Known target, include dependencies (except for clean)
+        ifneq &quot;$(MAKECMDGOALS)&quot; &quot;clean&quot;
</file context>
Suggested change
ifneq ($(filter $(MAKECMDGOALS),$(build-goals)),)
ifeq ($(filter-out $(build-goals),$(MAKECMDGOALS)),)
Fix with Cubic

ifneq "$(CONFIG_CONFIGURED)" "y"
$(error You must first run 'make config')
endif
ifeq ($(filter $(check_goal),config defconfig),)
Copy link

@cubic-dev-ai cubic-dev-ai bot Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skipping mk/common.mk whenever config/defconfig appears in MAKECMDGOALS means multi-goal invocations like "make defconfig all" can no longer build because the core rules are never included.

Prompt for AI agents
Address the following comment on Makefile at line 9:

<comment>Skipping mk/common.mk whenever config/defconfig appears in MAKECMDGOALS means multi-goal invocations like &quot;make defconfig all&quot; can no longer build because the core rules are never included.</comment>

<file context>
@@ -1,13 +1,18 @@
-ifneq &quot;$(CONFIG_CONFIGURED)&quot; &quot;y&quot;
-$(error You must first run &#39;make config&#39;)
-endif
+ifeq ($(filter $(check_goal),config defconfig),)
+    ifneq &quot;$(CONFIG_CONFIGURED)&quot; &quot;y&quot;
+        $(error You must first run &#39;make config&#39; or &#39;make defconfig&#39;)
</file context>
Fix with Cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants