Skip to content

Instantly share code, notes, and snippets.

@rhowardiv
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rhowardiv/bb19895617fe0487781d to your computer and use it in GitHub Desktop.
Save rhowardiv/bb19895617fe0487781d to your computer and use it in GitHub Desktop.
generic Makefile for markdown work
export SHELL := /bin/bash
.PHONY: default pdf html view clean
SRC = $(wildcard *.txt)
PDFS=$(SRC:.txt=.pdf)
HTML=$(SRC:.txt=.html)
default: pdf html
pdf: $(PDFS)
%.pdf : %.txt
@pandoc -o $@ $<
html : $(HTML)
%.html : %.txt
@pandoc -o $@ $<
view : $(PDFS)
@if [[ "$$(uname)" == "Linux" ]]; then \
evince $< & \
else open -a Preview $< & \
fi
clean :
@rm $(PDFS) $(HTML)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment