BOOKS = inclusion FORMATS = html txt # Default format in case a book target is called without FORMAT=* FORMAT = html all: $(FORMATS) books: $(BOOKS) $(FORMATS): @make 'FORMAT=$@' books $(BOOKS): @printf ' RENDER %s as %s\n' '$@' '$(FORMAT)' @PERL5LIB=scripts scripts/markdownbook.pl '$(FORMAT)' 'policies/$@' @[ '$(FORMAT)' = 'html' ] && \ ln -sf '../../include/main.css' 'policies/$@/main.css' || true clean: @for book in $(BOOKS); do \ printf ' CLEAN %s\n' "$${book}"; \ rm -f "policies/$${book}/"*.html; \ rm -f "policies/$${book}/"*.txt; \ rm -f "policies/$${book}/"main.css; \ done