Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 512d1f6

Browse files
committed
Refine Kconfig integration and build system
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
1 parent 4f4ee7c commit 512d1f6

File tree

17 files changed

+66
-11153
lines changed

17 files changed

+66
-11153
lines changed

‎.github/workflows/main.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ jobs:
4747
shell: bash
4848
- name: default build
4949
run: |
50+
make init-submodule
5051
tools/kconfig/defconfig.py --kconfig configs/Kconfig configs/defconfig
5152
tools/kconfig/genconfig.py configs/Kconfig
5253
make

‎.gitmodules‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "tools/kconfig"]
2+
path = tools/kconfig
3+
url = https://github.com/sysprog21/Kconfiglib

‎Makefile‎

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Ensure tools/kconfig submodule is initialized
2+
ifeq ($(wildcard tools/kconfig/menuconfig.py),)
3+
$(shell git submodule update --init tools/kconfig)
4+
endif
5+
16
-include .config
27

38
check_goal := $(strip $(MAKECMDGOALS))
@@ -7,7 +12,7 @@ $(error You must first run 'make config')
712
endif
813
endif
914

10-
# Rules
15+
# Target variables initialization
1116

1217
target-y :=
1318
target.o-y :=
@@ -58,11 +63,12 @@ libtwin.a_includes-y := \
5863
include \
5964
src
6065

61-
# Features
66+
# Optional features
67+
6268
libtwin.a_files-$(CONFIG_LOGGING) += src/log.c
6369
libtwin.a_files-$(CONFIG_CURSOR) += src/cursor.c
6470

65-
# Renderer
71+
# Rendering backends
6672
libtwin.a_files-$(CONFIG_RENDERER_BUILTIN) += src/draw-builtin.c
6773
libtwin.a_files-$(CONFIG_RENDERER_PIXMAN) += src/draw-pixman.c
6874
libtwin.a_cflags-$(CONFIG_RENDERER_PIXMAN) += $(shell pkg-config --cflags pixman-1)
@@ -156,29 +162,41 @@ demo-$(BACKEND)_ldflags-y := \
156162
$(TARGET_LIBS)
157163
endif
158164

165+
# Font editor tool
166+
159167
ifeq ($(CONFIG_TOOLS), y)
160168
target-$(CONFIG_TOOL_FONTEDIT) += font-edit
161169
font-edit_files-y = \
162-
tools/font-edit/sfit.c \
163-
tools/font-edit/font-edit.c
170+
tools/font-edit/sfit.c \
171+
tools/font-edit/font-edit.c
164172
font-edit_includes-y := tools/font-edit
165173
font-edit_cflags-y := \
166-
$(shell pkg-config --cflags cairo) \
167-
$(shell sdl2-config --cflags)
174+
$(shell pkg-config --cflags cairo) \
175+
$(shell sdl2-config --cflags)
168176
font-edit_ldflags-y := \
169-
$(shell pkg-config --libs cairo) \
170-
$(shell sdl2-config --libs)
177+
$(shell pkg-config --libs cairo) \
178+
$(shell sdl2-config --libs)
171179
endif
172180

181+
# Build system integration
182+
173183
CFLAGS += -include config.h
174184

175-
check_goal := $(strip$(MAKECMDGOALS))
185+
# Only include build rules when not running config target
176186
ifneq ($(check_goal), config)
177187
include mk/common.mk
178188
endif
179189

180-
# Menuconfig
190+
# Initialize submodule (for CI/CD use)
191+
.PHONY: init-submodule
192+
init-submodule:
193+
@if [ ! -f tools/kconfig/menuconfig.py ]; then \
194+
echo "Initializing Kconfig submodule..."; \
195+
git submodule update --init tools/kconfig; \
196+
fi
197+
198+
# Configuration target
181199
.PHONY: config
182-
config: configs/Kconfig
200+
config: init-submodule configs/Kconfig
183201
@tools/kconfig/menuconfig.py $<
184202
@tools/kconfig/genconfig.py $<

‎configs/Kconfig‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@ config CONFIGURED
44
bool
55
default y
66

7+
# Dependency detection using Kbuild toolchain functions
8+
config HAVE_SDL2
9+
def_bool $(success,pkg-config --exists sdl2)
10+
11+
config HAVE_PIXMAN
12+
def_bool $(success,pkg-config --exists pixman-1)
13+
14+
config HAVE_LIBPNG
15+
def_bool $(success,pkg-config --exists libpng)
16+
17+
config HAVE_LIBJPEG
18+
def_bool $(success,pkg-config --exists libjpeg)
19+
720
choice
821
prompt "Backend Selection"
922
default BACKEND_SDL
@@ -14,6 +27,7 @@ config BACKEND_FBDEV
1427

1528
config BACKEND_SDL
1629
bool "SDL video output support"
30+
depends on HAVE_SDL2
1731

1832
config BACKEND_VNC
1933
bool "VNC server output support"
@@ -28,6 +42,7 @@ config RENDERER_BUILTIN
2842

2943
config RENDERER_PIXMAN
3044
bool "Pixman based rendering"
45+
depends on HAVE_PIXMAN
3146

3247
endchoice
3348

@@ -83,10 +98,12 @@ menu "Image Loaders"
8398

8499
config LOADER_PNG
85100
bool "Enable PNG loader"
101+
depends on HAVE_LIBPNG
86102
default y
87103

88104
config LOADER_JPEG
89105
bool "Enable JPEG loader"
106+
depends on HAVE_LIBJPEG
90107
default y
91108

92109
config LOADER_GIF
@@ -131,7 +148,7 @@ config DEMO_LINE
131148
depends on DEMO_APPLICATIONS
132149

133150
config DEMO_SPLINE
134-
bool "Build spline demp"
151+
bool "Build spline demo"
135152
default y
136153
depends on DEMO_APPLICATIONS
137154

‎mk/common.mk‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,17 @@ clean: __FORCE
678678
__FORCE:
679679
@true
680680

681-
ifneq "$(MAKECMDGOALS)" "clean"
682-
-include $(target-depends)
681+
# Only include dependencies when building known targets
682+
build-goals := all clean $(target-builds)
683+
ifneq ($(MAKECMDGOALS),)
684+
# MAKECMDGOALS is not empty, check if it's a known target
685+
ifneq ($(filter $(MAKECMDGOALS),$(build-goals)),)
686+
# Known target, include dependencies (except for clean)
687+
ifneq "$(MAKECMDGOALS)" "clean"
688+
-include $(target-depends)
689+
endif
690+
endif
691+
else
692+
# Empty MAKECMDGOALS means building 'all', include dependencies
693+
-include $(target-depends)
683694
endif

‎tools/kconfig‎

Submodule kconfig added at e1f15e3

‎tools/kconfig/.gitignore‎

Lines changed: 0 additions & 4 deletions
This file was deleted.

‎tools/kconfig/LICENSE‎

Lines changed: 0 additions & 13 deletions
This file was deleted.

‎tools/kconfig/README.md‎

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎tools/kconfig/defconfig.py‎

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /