aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-04-19 14:35:34 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-04-19 14:35:34 -0400
commit67fd3c725e6511adf70345f0733ec0b948477a11 (patch)
tree913d9f30d8ce3614a9ae3715281f8804323b24ff /Makefile
parent0974d632c3dda7874f01c58bfc342b73cd1634a4 (diff)
Make API documentation into YAML files and autogenerate markdown files
and manpages from those.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile18
1 files changed, 17 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 44179f7e..9d3da806 100644
--- a/Makefile
+++ b/Makefile
@@ -74,6 +74,8 @@ endif
COMPILER_OBJS=$(patsubst %.c,%.o,$(wildcard src/*.c))
STDLIB_OBJS=$(patsubst %.c,%.o,$(wildcard src/stdlib/*.c))
TESTS=$(patsubst test/%.tm,test/results/%.tm.testresult,$(wildcard test/*.tm))
+API_YAML=$(wildcard api/*.yaml)
+API_MD=$(patsubst %.yaml,%.md,$(API_YAML))
all: config.mk build/lib/$(LIB_FILE) build/lib/$(AR_FILE) build/bin/tomo
@@ -123,6 +125,19 @@ clean:
%: %.md
pandoc --lua-filter=docs/.pandoc/bold-code.lua -s $< -t man -o $@
+%.md: %.yaml scripts/api_gen.py
+ ./scripts/api_gen.py $< >$@
+
+api/api.md: $(API_YAML)
+ ./scripts/api_gen.py $^ >$@
+
+.PHONY: api-docs
+api-docs: $(API_MD) api/api.md
+
+.PHONY: manpages
+manpages: $(API_YAML)
+ ./scripts/mandoc_gen.py $^
+
examples:
./build/bin/tomo -qIL examples/log examples/ini examples/vectors examples/http examples/wrap examples/colorful
./build/bin/tomo -e examples/game/game.tm examples/http-server/http-server.tm \
@@ -156,7 +171,8 @@ install-files: build/bin/tomo build/lib/$(LIB_FILE) build/lib/$(AR_FILE)
cp -v build/lib/$(LIB_FILE) build/lib/$(AR_FILE) "$(PREFIX)/lib/"
rm -f "$(PREFIX)/bin/tomo"
cp -v build/bin/tomo "$(PREFIX)/bin/"
- cp -v docs/tomo.1 "$(PREFIX)/man/man1/"
+ cp -v man/man1/* "$(PREFIX)/man/man1/"
+ cp -v man/man3/* "$(PREFIX)/man/man3/"
install-libs: build/bin/tomo
./local-tomo -qIL lib/patterns lib/time lib/commands lib/shell lib/random lib/base64 lib/pthreads lib/uuid lib/core