diff options
| author | Mark Brown <broonie@kernel.org> | 2026-10-10 01:31:20 +0100 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-10-10 01:31:20 +0100 |
| commit | dba9716e82ae2c9eacfdc0925360375cd0bb6830 (patch) | |
| tree | b0a41f80f6a35a4be3c607e3957a9d08718baca8 /scripts | |
| parent | c148298f22c67c053bf6507ed092e0ae58a4b2a8 (diff) | |
| parent | ef777ef05ebcc5ea5393b4bd5af6fc3ad1b3aec9 (diff) | |
| download | linux-next-dba9716e82ae2c9eacfdc0925360375cd0bb6830.tar.gz linux-next-dba9716e82ae2c9eacfdc0925360375cd0bb6830.zip | |
Merge branch 'spec' of https://git.kernel.org/pub/scm/linux/kernel/git/sashal/kapi.git
# Conflicts:
# Makefile
# fs/open.c
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/Makefile.build | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 6127feb970c6..faa5f6337e13 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -175,6 +175,32 @@ ifneq ($(KBUILD_EXTRA_WARN),) endif endif +ifeq ($(CONFIG_KAPI_SPEC),y) +# kernel-doc -apispec emits a spec only for comments with two or more KAPI +# sections; pick files with a contexts: (or context-flags:) line and one more +# KAPI section. +has-apispec = $(if $(strip $(1)),$(shell \ + grep -lE '^[[:space:]]*\*[[:space:]]*(contexts|context-flags):' $(1) 2>/dev/null | \ + xargs -r grep -lE '^[[:space:]]*\*[[:space:]]*(api-type|param|error|capability|signal|lock|state-trans|constraint|side-effect|long-desc):')) +apispec-c-files := $(call has-apispec, \ + $(patsubst $(obj)/%.o,$(src)/%.c, \ + $(filter-out %/built-in.a,$(real-obj-y)))) +apispec-y := $(patsubst $(src)/%.c,$(obj)/%.apispec.h,$(apispec-c-files)) +always-y += $(apispec-y) +targets += $(apispec-y) + +quiet_cmd_apispec = APISPEC $@ + cmd_apispec = PYTHONDONTWRITEBYTECODE=1 $(PYTHON3) $(KERNELDOC) -apispec \ + $(KDOCFLAGS) $< > $@ + +$(obj)/%.apispec.h: $(src)/%.c $(KERNELDOC) \ + $(wildcard $(srctree)/tools/lib/python/kdoc/*.py) FORCE + $(call if_changed,apispec) + +$(apispec-y:.apispec.h=.o): $(obj)/%.o: $(obj)/%.apispec.h +$(apispec-y:.apispec.h=.o): private c_flags += -include $(obj)/$*.apispec.h +endif + # Compile C sources (.c) # --------------------------------------------------------------------------- |
