-
Notifications
You must be signed in to change notification settings - Fork 23
Refine Kconfig integration and build system #126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
954ee24 to
512d1f6
Compare
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
512d1f6 to
72fb57b
Compare
There was a problem hiding this 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 "make defconfig all" 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) |
There was a problem hiding this comment.
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>
| build-goals := all clean $(target-builds) | ||
| ifneq ($(MAKECMDGOALS),) | ||
| # MAKECMDGOALS is not empty, check if it's a known target | ||
| ifneq ($(filter $(MAKECMDGOALS),$(build-goals)),) |
There was a problem hiding this comment.
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's a known target
+ ifneq ($(filter $(MAKECMDGOALS),$(build-goals)),)
+ # Known target, include dependencies (except for clean)
+ ifneq "$(MAKECMDGOALS)" "clean"
</file context>
| ifneq ($(filter $(MAKECMDGOALS),$(build-goals)),) | |
| ifeq ($(filter-out $(build-goals),$(MAKECMDGOALS)),) |
| ifneq "$(CONFIG_CONFIGURED)" "y" | ||
| $(error You must first run 'make config') | ||
| endif | ||
| ifeq ($(filter $(check_goal),config defconfig),) |
There was a problem hiding this comment.
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 "make defconfig all" can no longer build because the core rules are never included.</comment>
<file context>
@@ -1,13 +1,18 @@
-ifneq "$(CONFIG_CONFIGURED)" "y"
-$(error You must first run 'make config')
-endif
+ifeq ($(filter $(check_goal),config defconfig),)
+ ifneq "$(CONFIG_CONFIGURED)" "y"
+ $(error You must first run 'make config' or 'make defconfig')
</file context>
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.
$(success,...)functions to detect SDL2, Pixman, libpng, libjpeg[1] https://github.com/sysprog21/Kconfiglib