From 41c979e41b9a54d03af861062aa04443b0fc2066 Mon Sep 17 00:00:00 2001 From: kamkow1 Date: Sun, 15 Mar 2026 23:34:51 +0100 Subject: [PATCH] Generate docs for apps --- aux/compiledb.sh | 1 + aux/docs.sh | 2 +- ce/.gitignore | 3 +++ ce/walloc.h | 2 ++ docs/.gitignore | 2 ++ init/.gitignore | 3 +++ libfat/Makefile | 2 +- make/apps.mk | 8 +++++++- make/user.mk | 20 +++++++++++++++++++- spin/.gitignore | 3 +++ 10 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 docs/.gitignore diff --git a/aux/compiledb.sh b/aux/compiledb.sh index 511ae82..16a1827 100755 --- a/aux/compiledb.sh +++ b/aux/compiledb.sh @@ -15,3 +15,4 @@ make -B all_compiledb_libioutil make -B all_compiledb_libmath make -B all_compiledb_libfat make -B all_compiledb_libdebugconsole +make -B compiledb_apps diff --git a/aux/docs.sh b/aux/docs.sh index 0cb0577..b618fed 100755 --- a/aux/docs.sh +++ b/aux/docs.sh @@ -16,5 +16,5 @@ make -B docs_libioutil make -B docs_libmath make -B docs_libfat make -B docs_libdebugconsole - +make -B docs_apps mkdocs build diff --git a/ce/.gitignore b/ce/.gitignore index 2c156f6..1444bed 100644 --- a/ce/.gitignore +++ b/ce/.gitignore @@ -1,2 +1,5 @@ *.o +*.json +docs/ +.cache/ ce diff --git a/ce/walloc.h b/ce/walloc.h index 076f776..cc3b3dc 100644 --- a/ce/walloc.h +++ b/ce/walloc.h @@ -1,6 +1,8 @@ #ifndef _WALLOC_H #define _WALLOC_H +#include + void* wmalloc (void* ctx, size_t size); void* wrealloc (void* ctx, void* mem, size_t old, size_t new); diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 0000000..fc5fe4e --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1,2 @@ +libs/** +apps/** diff --git a/init/.gitignore b/init/.gitignore index 808d629..5fcba09 100644 --- a/init/.gitignore +++ b/init/.gitignore @@ -1,2 +1,5 @@ *.o +*.json +docs/ +.cache/ init diff --git a/libfat/Makefile b/libfat/Makefile index 8281c51..4624931 100644 --- a/libfat/Makefile +++ b/libfat/Makefile @@ -5,7 +5,7 @@ $(eval $(call add_include,libstring)) cflags += -D"FAT_PRINTF(a)" -DOCS_COLLECT = $$(git ls-files '*.c' '*.h' ':!_fat.*' ':!_fatctx.h') +DOCS_COLLECT = $$(git ls-files '*.c' '*.h' ':!\_fat.c' ':!\_fat.h' ':!\_fatctx.h') libname := libfat diff --git a/make/apps.mk b/make/apps.mk index 5078c0b..d322ed8 100644 --- a/make/apps.mk +++ b/make/apps.mk @@ -12,4 +12,10 @@ clean_apps: format_apps: @for d in $(apps); do make -C $$d platform=$(platform) format; done -.PHONY: all_apps clean_apps format_apps +docs_apps: + @for d in $(apps); do make -C $$d platform=$(platform) docs; done + +compiledb_apps: + @for d in $(apps); do make -C $$d platform=$(platform) compiledb; done + +.PHONY: all_apps clean_apps format_apps docs_apps compiledb_apps diff --git a/make/user.mk b/make/user.mk index fd8452c..2227024 100644 --- a/make/user.mk +++ b/make/user.mk @@ -13,6 +13,18 @@ include ../$(platform)/flags.mk FORMAT ?= clang-format -i $$(git ls-files '*.c' '*.h') +DOCS_COLLECT ?= $$(git ls-files '*.c' '*.h') + +DOCS ?= \ + rm -rf docs; \ + clang-doc --format=md --output docs -p . $(DOCS_COLLECT); \ + for f in ./docs/GlobalNamespace/*.md; \ + do sed -i '/^\# Global Namespace/d' "$$f"; \ + done; \ + rm -rf ../docs/apps/$(app); \ + mkdir -p ../docs/apps/$(app); \ + cp ./docs/GlobalNamespace/*.md ../docs/apps/$(app); + all: $(app) $(app): $(extra_deps) $(o) @@ -30,4 +42,10 @@ clean: format: $(FORMAT) -.PHONY: all clean format +docs: + $(DOCS) + +compiledb: + bear --output compile_commands.json -- make platform=$(platform) all + +.PHONY: all clean format docs compiledb diff --git a/spin/.gitignore b/spin/.gitignore index 8aaa5a2..5ae9319 100644 --- a/spin/.gitignore +++ b/spin/.gitignore @@ -1,2 +1,5 @@ *.o +*.json +docs/ +.cache/ spin