Skip to content

Instantly share code, notes, and snippets.

@tobbe11
Last active June 15, 2016 12:32
Show Gist options
  • Select an option

  • Save tobbe11/b164131cf2611034792c142e2d45ab30 to your computer and use it in GitHub Desktop.

Select an option

Save tobbe11/b164131cf2611034792c142e2d45ab30 to your computer and use it in GitHub Desktop.
Simple Makefile for markdown
# in your Makefile include H:\prj\inc.makefile
# in Vim set makeprg=d:/path/to/bin/mingw32-make
PANDOC_PATH = D:\prg\Pandoc
PANDOC = $(PANDOC_PATH)\pandoc.exe
PP = D:\prg\pp\pp.exe
PLANTUML = java -jar "D:\prg\plantuml\plantuml.jar"
include H:\prj\inc.makefile
SOURCES = $(wildcard *.md)
TARGETS = $(patsubst %.pu,%.png,$(wildcard *.pu))
TARGETS += $(patsubst %.md,%.html,$(SOURCES))
DOCPATH = \\networkpath\doc
.PHONY: all clean install
all: ${TARGETS}
install: ${TARGETS}
copy /y *.html ${DOCPATH}
%.png: %.pu
${PLANTUML} $<
%.html: %.md
type $< | ${PP} | \
$(PANDOC) -o $@ --template ${PANDOC_PATH}/templates/bootstrap.html \
--css ${PANDOC_PATH}/templates/bootstrap.css --self-contained --toc --toc-depth 2
.PHONY: clean
clean:
-del ${TARGETS}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment