From c35bb407534901f283787c9458c24c9ac6810858 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sun, 12 Aug 2012 15:31:17 -0400 Subject: Update build system. --- (limited to 'Makefile') diff --git a/Makefile b/Makefile index 0707f0b..5d102ae 100644 --- a/Makefile +++ b/Makefile @@ -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 -- cgit v0.9.1