Makefile.title 589 B

123456789101112131415161718
  1. SHELL = /bin/bash
  2. COMMIT_DATE := $(shell date -u +'%F %T UTC' \
  3. -d "`git show --pretty=format:'%ci' | sed q`")
  4. GIT_HASH := $(shell git rev-parse HEAD)
  5. GIT_STATUS := $(shell [ -z "`git status -s -uno`" ] || echo +)
  6. .PHONY: title.ps
  7. title.ps: ../common/title.fig
  8. fig2dev -L ps $< | \
  9. sed -e "s|<TITLE-NAME>|$(TITLE_NAME)|" \
  10. -e "s/<DATE>/`date -u +'%F %T UTC'`/" \
  11. -e "s/<HEAD-HASH>/$(GIT_HASH)$(GIT_STATUS)/" \
  12. -e "s/<HEAD-DATE>/$(COMMIT_DATE)/" \
  13. -e "s|<TITLE-FILE>|$(TITLE_FILE)|" >$@; \
  14. [ "$${PIPESTATUS[*]}" = "0 0" ] || { rm -f $@ exit 1; }