From a53fe52f0930e572fb41fa70980958e31b2a87e8 Mon Sep 17 00:00:00 2001 From: joneshf Date: Tue, 24 Jul 2018 23:07:03 -0700 Subject: [PATCH] Add a Makefile We can make things easier on contributors if we setup a build system. We can also make CI easier if we use Make. --- .gitignore | 2 ++ Makefile | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index a7b9ebe..216ecdf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ ### Project specific ### *.cabal +.make +bin # Created by https://www.gitignore.io/api/vim,osx,linux,macos,emacs,windows,haskell,visualstudiocode diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0012009 --- /dev/null +++ b/Makefile @@ -0,0 +1,35 @@ +BIN := bin +EMPTY := .make +GHCID := $(BIN)/ghcid +STACK := stack +STACK_WORK := .stack-work + +.DEFAULT_GOAL := build + +$(EMPTY): + mkdir $@ + +$(EMPTY)/stack-setup: | $(EMPTY) + $(STACK) setup + touch $@ + +$(GHCID): $(EMPTY)/stack-setup + $(STACK) install ghcid --local-bin-path $(BIN) + +.PHONY: build +build: $(EMPTY)/stack-setup + $(STACK) build --no-run-tests --test + +.PHONY: clean +clean: + rm -f $(BIN)/* + rm -f $(EMPTY)/* + rm -fr $(STACK_WORK) + +.PHONY: test +test: build + $(STACK) test + +.PHONY: watch +watch: $(GHCID) + $(GHCID)