diff options
author | P. J. McDermott <pjm@nac.net> | 2012-08-12 15:31:17 (EDT) |
---|---|---|
committer | P. J. McDermott <pjm@nac.net> | 2012-08-12 15:31:17 (EDT) |
commit | c35bb407534901f283787c9458c24c9ac6810858 (patch) | |
tree | 986d2f8fd3ed90d5b72337e920ceecdd2122f047 | |
parent | b2b307a2b170755a7218703cb4f761f58270a973 (diff) |
Update build system.
-rw-r--r-- | Makefile | 34 |
1 files changed, 17 insertions, 17 deletions
@@ -1,23 +1,23 @@ -.SUFFIXES: -.SUFFIXES: .txt .html +BOOKS = inclusion +FORMATS = html txt -SRCS = -OBJS = $(SRCS:.txt=.html) +# Default format in case a book target is called without FORMAT=* +FORMAT = html -.PHONY: all -all: $(OBJS) +all: $(FORMATS) -$(OBJS): - @printf ' RENDER %s\n' '$@' - @title=$$(sed -n 's/^ Title: \(.*\)$$/\1/p' $*.txt | \ - head -n 1); \ - sed "s#@TITLE@#$$title#" include/header.html > $@ - @markdown $*.txt >> $@ - @cat include/footer.html >> $@ +books: $(BOOKS) + +$(FORMATS): + @make 'FORMAT=$@' books + +$(BOOKS): + @printf ' RENDER %s as %s\n' '$@' '$(FORMAT)' + @PERL5LIB=scripts scripts/markdownbook.pl $(FORMAT) 'policies/$@' -.PHONY: clean clean: - @for obj in $(OBJS); do \ - printf ' RM %s\n' "$${obj}"; \ - rm -f $${obj}; \ + @for book in $(BOOKS); do \ + printf ' CLEAN %s\n' "$${book}"; \ + rm -f "policies/$${book}/"*.html; \ + rm -f "policies/$${book}/"*.txt; \ done |