#!/usr/bin/make -f
# The role of this Makefile is to make the commands accessible to the
# developer that may not know Jekyll that well.
# ---
# Here are the commands the developer should use:
#
# — Preview (run a local webserver and update automatically when a change is
#   made to view the modifications before pushing them to the server).
# — Build (just build to install the thing).

all: -all-build
preview prev: -all-watch

# ---
# Internal rules.
# ---

 BUNDLE := bundle
 JEK  := $(BUNDLE) exec jekyll

# Prepare the build by installing the modules that aren't installed to
# the local `vendor/` folder to avoid conflicts.

 -prepare:
	$(BUNDLE) check || $(BUNDLE) install --path vendor/bundle
	$(BUNDLE) update

# Make the website for different contexts.

 -all-watch: -prepare
	$(JEK) serve --drafts --watch
 -all-build: -prepare
	$(JEK) build

.PHONY: preview prev show
.PHONY: -prepare -all -all-watch

# End of file.
