Skip to content

Instantly share code, notes, and snippets.

@uhooi
Last active February 8, 2020 15:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uhooi/febe61b04690dd74fff96373bbb6f4bf to your computer and use it in GitHub Desktop.
Save uhooi/febe61b04690dd74fff96373bbb6f4bf to your computer and use it in GitHub Desktop.
Makefile for Re:VIEW
REVIEW_VERSION := 4.0
REVIEW_CONFIG_FILE ?= config.yml
REVIEW_OUTPUT_TYPE ?= pdf
REVIEW_BOOKNAME := Foo
.DEFAULT_GOAL := help
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?# .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":[^#]*? #| #"}; {printf "%-18s%s\n", $$1 $$3, $$2}'
.PHONY: build-paper
build-paper: # Build Re:VIEW file for paper
$(MAKE) build
.PHONY: build-ebook
build-ebook: # Build Re:VIEW file for E-book
$(MAKE) build REVIEW_CONFIG_FILE=config-ebook.yml
.PHONY: build-epub
build-epub: # Build Re:VIEW file for EPUB
$(MAKE) build REVIEW_OUTPUT_TYPE=epub
.PHONY: build
build:
docker run -t --rm -v ${PWD}:/book vvakame/review:${REVIEW_VERSION} /bin/bash -ci "cd /book && ./setup.sh && REVIEW_CONFIG_FILE=${REVIEW_CONFIG_FILE} npm run ${REVIEW_OUTPUT_TYPE}"
$(MAKE) open
.PHONY: open
open:
open ./articles/${REVIEW_BOOKNAME}.${REVIEW_OUTPUT_TYPE}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment