VERSION := $(shell grep version Cargo.toml | sed -e 's/.* = "//g;s/"$$//g') NAME := linescroll DOC := $(NAME) MDDATE := $(shell find $(DOC).md -printf "%Td %TB %TY\n") RELEASE := target/release/$(NAME) all: build test bintest doc build: cargo build --release doc: ( cat $(NAME).md | sed -e 's/^footer: \(\S\+\) \S\+$$/footer: \1 $(VERSION)/g' -e 's/^date:.*/date: $(MDDATE)/g' ) > $(NAME).md.tmp && mv $(NAME).md.tmp $(NAME).md cat $(NAME).md | sed -e 's,\([^ `-]\)--\([a-zA-Z]\),\1\\--\2,g' -e '/^|/s/\\n/\\\\n/g' -e '/^|/s/\\t/\\\\t/g' > $(NAME).man.md pandoc --standalone --ascii --to man $(NAME).man.md -o $(NAME).1 rm $(NAME).man.md test: cargo test bintest: install: all strip $(RELEASE) please install -m 0755 $(RELEASE) /usr/local/bin