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 954ee24

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 954ee24

File tree

16 files changed

+51
-11152
lines changed

16 files changed

+51
-11152
lines changed

‎.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: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ $(error You must first run 'make config')
77
endif
88
endif
99

10-
# Rules
10+
# Target variables initialization
1111

1212
target-y :=
1313
target.o-y :=
@@ -58,11 +58,12 @@ libtwin.a_includes-y := \
5858
include \
5959
src
6060

61-
# Features
61+
# Optional features
62+
6263
libtwin.a_files-$(CONFIG_LOGGING) += src/log.c
6364
libtwin.a_files-$(CONFIG_CURSOR) += src/cursor.c
6465

65-
# Renderer
66+
# Rendering backends
6667
libtwin.a_files-$(CONFIG_RENDERER_BUILTIN) += src/draw-builtin.c
6768
libtwin.a_files-$(CONFIG_RENDERER_PIXMAN) += src/draw-pixman.c
6869
libtwin.a_cflags-$(CONFIG_RENDERER_PIXMAN) += $(shell pkg-config --cflags pixman-1)
@@ -156,28 +157,32 @@ demo-$(BACKEND)_ldflags-y := \
156157
$(TARGET_LIBS)
157158
endif
158159

160+
# Font editor tool
161+
159162
ifeq ($(CONFIG_TOOLS), y)
160163
target-$(CONFIG_TOOL_FONTEDIT) += font-edit
161164
font-edit_files-y = \
162-
tools/font-edit/sfit.c \
163-
tools/font-edit/font-edit.c
165+
tools/font-edit/sfit.c \
166+
tools/font-edit/font-edit.c
164167
font-edit_includes-y := tools/font-edit
165168
font-edit_cflags-y := \
166-
$(shell pkg-config --cflags cairo) \
167-
$(shell sdl2-config --cflags)
169+
$(shell pkg-config --cflags cairo) \
170+
$(shell sdl2-config --cflags)
168171
font-edit_ldflags-y := \
169-
$(shell pkg-config --libs cairo) \
170-
$(shell sdl2-config --libs)
172+
$(shell pkg-config --libs cairo) \
173+
$(shell sdl2-config --libs)
171174
endif
172175

176+
# Build system integration
177+
173178
CFLAGS += -include config.h
174179

175-
check_goal := $(strip$(MAKECMDGOALS))
180+
# Only include build rules when not running config target
176181
ifneq ($(check_goal), config)
177182
include mk/common.mk
178183
endif
179184

180-
# Menuconfig
185+
# Configuration target
181186
.PHONY: config
182187
config: configs/Kconfig
183188
@tools/kconfig/menuconfig.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.

‎tools/kconfig/genconfig.py‎

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

0 commit comments

Comments
(0)

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