an overgeared makefile
This commit is contained in:
36
Makefile
36
Makefile
@@ -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 $@
|
||||
|
||||
Reference in New Issue
Block a user