diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-10-27 22:57:37 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-10-27 22:57:37 -0700 |
commit | b193033728ad421c9e0a37ec6438d98dc1adefee (patch) | |
tree | f606f23d0e6299e425b36964178ca21bc5e325c4 | |
parent | df762b986c5fdf80dda6768020f3c710aae9fc6e (diff) |
Cleaned up Makefile a bit.
-rw-r--r-- | Makefile | 30 |
1 files changed, 17 insertions, 13 deletions
@@ -7,9 +7,11 @@ PROG?=./cmark JSMODULES=$(wildcard js/lib/*.js) PREFIX?=/usr/local SPEC=spec.txt +SITE=_site SPECVERSION=$(shell grep version: $(SPEC) | sed -e 's/version: *//') +VERSIONS=$(shell cd $(SITE); ls -d -1 0.* | sort -r -g) -.PHONY: all spec leakcheck clean fuzztest dingus upload jshint test testjs benchjs +.PHONY: all spec leakcheck clean fuzztest dingus upload jshint test testjs benchjs update-site upload-site all: $(SRCDIR)/case_fold_switch.inc $(PROG) libcmark.so @@ -89,29 +91,31 @@ fuzztest: for i in `seq 1 10`; do \ time cat /dev/urandom | head -c 100000 | iconv -f latin1 -t utf-8 | $(PROG) >/dev/null; done -_site/spec.html: spec.txt +$(SITE)/spec.html: spec.txt (echo "% CommonMark Spec\n";\ - for vers in $(shell cd _site; ls -d -1 0.* | sort -r -g) ; do \ + for vers in $(VERSIONS); do \ if [ "$$vers" != "$(SPECVERSION)" ]; then \ - perl -p -i -e 's/<div id="watermark">.*?<\/div>/<div id="watermark" style="background-color:black">This is an older version of the spec. For the most recent version, see <a href="http:\/\/spec.commonmark.org">http:\/\/spec.commonmark.org<\/a>.<\/div>/' _site/$$vers/index.html ; \ + perl -p -i -e 's/<div id="watermark">.*?<\/div>/<div id="watermark" style="background-color:black">This is an older version of the spec. For the most recent version, see <a href="http:\/\/spec.commonmark.org">http:\/\/spec.commonmark.org<\/a>.<\/div>/' $(SITE)/$$vers/index.html ; \ fi; \ echo "- [Version $$vers](/$$vers/)" ; \ done) | \ pandoc --template template.html -S -s -t html5 -o $@ -_site/index.html: _site/spec.html +$(SITE)/index.html: $(SITE)/spec.html cp $< $@ -_site/$(SPECVERSION)/index.html: spec.html - mkdir -p _site/$(SPECVERSION) +$(SITE)/$(SPECVERSION)/index.html: spec.html + mkdir -p $(SITE)/$(SPECVERSION) cp $< $@ - cd _site; git add $(SPECVERSION)/index.html; git commit -a -m "Added version $(SPECVERSION) of spec"; cd .. + cd $(SITE); git add $(SPECVERSION)/index.html; git commit -a -m "Added version $(SPECVERSION) of spec"; cd .. -update-site: spec.html js/commonmark.js _site/index.html _site/$(SPECVERSION)/index.html _site/spec.html - cp dingus.html _site/ - cp js/commonmark.js _site/js/ - cp js/LICENSE _site/js/ - (cd _site ; git pull ; git commit -a -m "Updated site for latest spec, js" ; git push; cd ..) +$(SITE)/%: % + cp $< $@ + +update-site: $(SITE)/dingus.html $(SITE)/js/commonmark.js $(SITE)/index.html $(SITE)/$(SPECVERSION)/index.html $(SITE)/spec.html $(SITE)/js/LICENSE + +upload-site: + cd $(SITE) ; git pull; git commit -a -m "Updated site for latest spec, js" ; git push; cd .. clean: -rm -f test $(SRCDIR)/*.o $(SRCDIR)/scanners.c $(SRCDIR)/html/*.o libcmark.so |