From 87c512278255d6739b57598becffa494cb1050a0 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Wed, 2 Oct 2019 23:22:32 -0400 Subject: [PATCH] add local test server option --- Makefile | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 96d10a4..2dcd27d 100644 --- a/Makefile +++ b/Makefile @@ -10,14 +10,17 @@ DEST_EPUB_FILES := $(ISSUES:./issues/%=$(DEST_DIR)/issue-%.epub) # deps PANDOC != command -v pandoc 2> /dev/null XELATEX != command -v xelatex 2> /dev/null +PHP != command -v php 2> /dev/null # default target help: $(info all - build all formats) - $(info pdf - generate all issues as pdf) + $(info pdf - generate all issues as pdf - requires xelatex) $(info html - generate all issues as html) $(info epub - generate all issues as epub) $(info clean - remove build artifacts) + $(info serve - start local php test server - requires php) + $(info note: all builds require pandoc) all: dep-pandoc pdf html epub @@ -73,7 +76,11 @@ $(DEST_DIR)/issue-%.epub: issues/% clean: $(info removing build artifacts) - @rm $(DEST_DIR)/*.{pdf,html,epub} + @rm $(DEST_DIR)/issue-* + +serve: dep-php + $(info starting local php server) + @$(PHP) -S localhost:9000 -t $(DEST_DIR) dep-pandoc: ifndef PANDOC @@ -85,5 +92,10 @@ ifndef XELATEX $(error missing dependency 'xelatex'. please install and try again) endif -.PHONY: clean help dep-pandoc dep-xelatex +dep-php: +ifndef PHP + $(error missing dependency 'php'. please install and try again) +endif + +.PHONY: clean serve help dep-pandoc dep-xelatex dep-php