an overgeared makefile

This commit is contained in:
2026-01-14 12:38:09 +05:30
parent 72568a4adf
commit 6cfc82b3c6
3 changed files with 36 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
.POSIX:
.PHONY: build docs
NAME := args
ifneq "$(wildcard src/*.h)" ''
HEADERS = $(wildcard src/*.h)
endif
define DOCS
$(subst docs/, build/man/,
$(patsubst
%.md, %,
$(wildcard docs/*.md)
)
)
endef
build: build/ $(NAME)
$(NAME): src/main.c $(HEADERS)
cc -o $(NAME) $^
test:
$(error testing using `make' not supported; use `just')
docs:
make $(strip $(DOCS))
build/man/%: docs/%.md build/man/ docs/
pandoc --from markdown --to man \
$< $@
%/:
@mkdir -p $@

View File