stack_path != which stack binout = ./bin/countdown all: $(if $(stack_path),,install-stack) stack build ln -sfT $$(stack path --local-install-root)/bin ./bin .PHONY: all run install install-dev-tools deploy install: stack install $(binout): install run: all $(binout) install-dev-tools: stack install apply-refact hlint stylish-haskell hasktags hoogle become_root != [ "$$(id -u)" = 0 ] || echo sudo install-stack: ifneq (,$(shell which curl)) curl -sSL https://get.haskellstack.org/ | sh else ifneq (,$(shell which wget)) wget -qO- https://get.haskellstack.org/ | sh else ifneq (,$(shell which apt)) $(become_root) apt install haskell-stack else $(error No stack binary found; and no known means of installing (no curl, wget, or apt).\ Follow instructions at ) endif endif endif define prompt_user @bash -c \ 'read -p $(1) && printf "%s\n" "$${REPLY}" > "$$1"' \ bash \ "$@" endef deploy-target.url: $(call prompt_user, "Enter deploy target rsync URL: ") deploy: $(binout) deploy-target.url @read target < deploy-target.url && set -x && \ rsync -i4zaP $(binout) "$$target" %.html: %.md pandoc -f markdown -t html -o $@ $^