Files
LithosAnanke/tools/kconfig/Makefile
T
Claude 3bd81097e1 chore(license): an SPDX header on every source file that had none (LicenseRef-Starship-1.0) [skip ci]
The header scan (Captain Bob, 2026-11-10): 788 source files -- 351 with the
SL-1.0 header, 12 with the old name (docs/working/experiments, kept by
ruling), 31 under someone else's licence (tools/kconfig, Linux's, GPL-2.0:
kept), and 394 with none. Ruled: the SPDX form; capsules (.4th, .f18) and
proofs (.thy) left for a ruling of their own (mkcapsule's 64x16 block format,
content-addressed capsules).

253 files now begin
    SPDX-License-Identifier: LicenseRef-Starship-1.0
    Copyright (c) 2023-2026 Robert A. James
as a /* */ block (C, headers, assembly, linker scripts) or # lines (scripts,
Makefiles, Kconfig; below a shebang or a coding line); tools/mkcapsule.c,
which had the copyright line, gets the SPDX line only.

Not touched: docs/working/ (archive and old campaign material, as the
ruling kept the experiments); v4/system/post_cases.c (generated by
v4/tools/mkpost.py, "do not edit" -- the generator has the header).

Comments only: the kernel builds on amd64, aarch64, riscv64; make -C v4
test-32: 39 programs, 0 failures; every changed script parses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GE3SDvQn5EoxdGufk84zz2
2026-11-10 04:12:49 +00:00

109 lines
4.0 KiB
Makefile

# SPDX-License-Identifier: LicenseRef-Starship-1.0
# Copyright (c) 2023-2026 Robert A. James
# Bespoke build for the vendored Linux Kconfig tooling.
# See README.md for what's vendored, what's dropped, and why this Makefile
# is hand-written instead of adapting upstream's scripts/kconfig/Makefile
# (kept alongside as Makefile.upstream-reference for comparison only --
# it isn't self-contained outside a full kernel Kbuild tree).
#
# Builds three standalone host binaries: conf, mconf, qconf.
# GPL-2.0 vendored source, host-side build tooling only -- see LICENSE.
HOSTCC ?= gcc
HOSTCXX ?= g++
HOSTPKG_CONFIG ?= pkg-config
BISON ?= bison
FLEX ?= flex
export HOSTPKG_CONFIG HOSTCC
CFLAGS_COMMON := -I. -Iscripts-include -Wall -Wno-unused-function -D_GNU_SOURCE -g -O1
.PHONY: all clean
all: conf mconf qconf
# ==============================================================================
# Generated parser/lexer
# ==============================================================================
parser.tab.c parser.tab.h &: parser.y
$(BISON) -d -t -o parser.tab.c $<
lexer.lex.c: lexer.l parser.tab.h
$(FLEX) -o $@ $<
# ==============================================================================
# Core engine objects (shared by all three frontends)
# ==============================================================================
CORE_OBJS := confdata.o expr.o lexer.lex.o menu.o parser.tab.o preprocess.o symbol.o util.o
confdata.o expr.o menu.o preprocess.o symbol.o util.o conf.o: %.o: %.c
$(HOSTCC) $(CFLAGS_COMMON) -c -o $@ $<
lexer.lex.o: lexer.lex.c
$(HOSTCC) $(CFLAGS_COMMON) -c -o $@ $<
parser.tab.o: parser.tab.c
$(HOSTCC) $(CFLAGS_COMMON) -c -o $@ $<
# ==============================================================================
# conf -- headless config/oldconfig/defconfig/syncconfig
# ==============================================================================
conf: conf.o $(CORE_OBJS)
$(HOSTCC) -o $@ $^
# ==============================================================================
# mconf -- ncurses menuconfig
# ==============================================================================
mconf-cflags.mk: mconf-cfg.sh
@sh mconf-cfg.sh .mconf.cflags .mconf.libs
@echo "MCONF_CFLAGS := $$(cat .mconf.cflags)" > $@
@echo "MCONF_LIBS := $$(cat .mconf.libs)" >> $@
-include mconf-cflags.mk
MCONF_OBJS := mconf.o mnconf-common.o lxdialog/checklist.o lxdialog/inputbox.o \
lxdialog/menubox.o lxdialog/textbox.o lxdialog/util.o lxdialog/yesno.o
mconf.o mnconf-common.o lxdialog/checklist.o lxdialog/inputbox.o lxdialog/menubox.o \
lxdialog/textbox.o lxdialog/util.o lxdialog/yesno.o: %.o: %.c mconf-cflags.mk
$(HOSTCC) $(CFLAGS_COMMON) $(MCONF_CFLAGS) -c -o $@ $<
mconf: $(MCONF_OBJS) $(CORE_OBJS) mconf-cflags.mk
$(HOSTCC) -o $@ $(MCONF_OBJS) $(CORE_OBJS) $(MCONF_LIBS)
# ==============================================================================
# qconf -- Qt xconfig
# ==============================================================================
qconf-cflags.mk: qconf-cfg.sh
@sh qconf-cfg.sh .qconf.cflags .qconf.libs .qconf.bin
@echo "QCONF_CFLAGS := $$(cat .qconf.cflags)" > $@
@echo "QCONF_LIBS := $$(cat .qconf.libs)" >> $@
@echo "QCONF_MOC := $$(cat .qconf.bin)/moc" >> $@
-include qconf-cflags.mk
qconf-moc.cc: qconf.h qconf-cflags.mk
$(QCONF_MOC) $< -o $@
qconf.o: qconf.cc qconf-cflags.mk
$(HOSTCXX) -std=c++17 -fPIC $(QCONF_CFLAGS) -I. -Iscripts-include -c -o $@ $<
qconf-moc.o: qconf-moc.cc qconf-cflags.mk
$(HOSTCXX) -std=c++17 -fPIC $(QCONF_CFLAGS) -I. -Iscripts-include -c -o $@ $<
qconf: qconf.o qconf-moc.o $(CORE_OBJS) qconf-cflags.mk
$(HOSTCXX) -o $@ qconf.o qconf-moc.o $(CORE_OBJS) $(QCONF_LIBS)
# ==============================================================================
clean:
rm -f conf mconf qconf
rm -f *.o lxdialog/*.o
rm -f parser.tab.c parser.tab.h lexer.lex.c qconf-moc.cc
rm -f mconf-cflags.mk qconf-cflags.mk .mconf.cflags .mconf.libs
rm -f .qconf.cflags .qconf.libs .qconf.bin