diff options
| author | Mark Brown <broonie@kernel.org> | 2026-10-13 18:42:34 +0100 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-10-13 18:42:34 +0100 |
| commit | b11660ffaee5ab7d225de04bf83673f959188917 (patch) | |
| tree | 5e4f08f35aded783f06e7ee87ae543a8f61ed73d /scripts | |
| parent | 6e73b00a581c3b8ec8c2117b409e7f8f17aa29ea (diff) | |
| parent | ef777ef05ebcc5ea5393b4bd5af6fc3ad1b3aec9 (diff) | |
| download | linux-next-b11660ffaee5ab7d225de04bf83673f959188917.tar.gz linux-next-b11660ffaee5ab7d225de04bf83673f959188917.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) # --------------------------------------------------------------------------- |
