--- /dev/null
+PANDOC ?= pandoc
+PD_FLAGS=--resource-path=$(CURDIR):src --template=uikit.html --toc
+PD_FORMAT=-f markdown -t html
+PD_STANDALONE=--standalone --embed-resources
+
+# SRC = $(wildcard ./lab*/*.md)
+SRC = $(wildcard ./lab*)
+SRC += Linux_labs_0_Introduction.md
+
+default: all
+
+all: build
+
+build: prerequisites
+
+standalone: prerequisites
+ ./build.sh "$(PANDOC)" "$(PD_FLAGS) $(PD_STANDALONE)" "$(PD_FORMAT)" $(SRC)
+
+clean:
+ rm -rf easy-pandoc-templates
+ rm -f ./*.html
+
+prerequisites: easy-pandoc-templates $(SRC)
+
+easy-pandoc-templates:
+ git clone https://github.com/ryangrose/easy-pandoc-templates
+
+sources:
+ @echo $(CURDIR):
+ @echo $(SRC)
+
+.PHONY: build standalone clean
--- /dev/null
+#! /bin/bash
+
+# USE: ./build.sh <pandoc> <pandoc_flags> <pandoc_format> [sources]
+
+pancompile="$1 $2 $3"
+panexec="$1"
+panflags="$2"
+panformat="$3"
+sources=${@:4}
+
+echo "using command <${pancompile}>"
+echo "for sources: ${sources}"
+
+for src in ${sources}; do
+ if [ -d ${src} ]; then
+ printf "\tfound dir: ${src}\n"
+
+ if [ "$(find ${src} -name '*.md' | wc -l)" != "1" ]; then
+ printf "\tToo many files in dir. Won't build. Skipping.\n"
+ continue
+ fi
+
+ indir_src="$(find ${src} -name '*.md')"
+ indir_out="${indir_src##*/}"
+ ${panexec} ${panflags} ${indir_src} ${panformat} -o ${indir_out%.*}.html
+
+ elif [ -f ${src} ] && [ "${src##*.}" == "md" ]; then
+ printf "\tfound md file: ${src}\n"
+
+ printf "\t${panexec} ${panflags} ${src} ${panformat} -o ${src%.*}.html"
+ ${panexec} ${panflags} ${src} ${panformat} -o ${src%.*}.html
+ else
+ echo "unknown source"
+ exit 1
+ fi
+done
+
+#for lab in $(find . -maxdepth 1 -name "lab*" -type d); do
+# echo "Found directory ${lab}"
+#done