Files
args/Makefile

48 lines
688 B
Makefile

.POSIX:
.PHONY: build docs
NAME := args
ifneq "$(wildcard src/*.h)" ''
HEADERS = $(wildcard src/*.h)
endif
ifeq "$(shell id -u)" '0'
PREFIX := /usr/local
else
PREFIX := $(HOME)/.local
endif
define DOCS
$(subst docs/, man/,
$(patsubst
%.md, %,
$(wildcard docs/*.md)
)
)
endef
build: build/ build/$(NAME)
build/$(NAME): src/main.c $(HEADERS)
cc -o $@ $<
install:
install -CDm0755 -t $(PREFIX)/bin/ build/$(NAME)
install -CDm0644 -t $(PREFIX)/share/man/man1 man/$(NAME).1
test:
$(error testing using `make' not supported; use `just')
docs:
make $(strip $(DOCS))
man/%: docs/%.md man/
pandoc --to man \
--standalone \
--output $@ \
$<
%/:
@mkdir -p $@