@@ -0,0 +1,73 @@
5+PROJECT_NAME ?= rollbar-hs
7+STACK_WORK ?= .stack-work
10+CABAL_FILE := $(PROJECT_NAME).cabal
11+DOC_TEST := $(DIST)/build/doc-test/doc-test
13+STACK_FLAGS := --verbosity $(VERBOSITY)
15+.DEFAULT_GOAL := build
17+$(BIN) $(DIST) $(EMPTY):
20+$(CABAL_FILE): package.yaml
21+ # `stack` has no way to run `hpack` directly.
22+ # We can run `hpack` indirectly with little overhead.
23+ $(STACK) $(STACK_FLAGS) build --dry-run
27+ $(MAKE) $(EMPTY)/build
29+$(EMPTY)/build: $(EMPTY)/stack-setup README.md Setup.hs package.yaml stack.yaml src/**/*.hs test/**/*.hs | $(DIST)
30+ $(STACK) $(STACK_FLAGS) build --no-run-tests --test
31+ cp -R $$($(STACK) $(STACK_FLAGS) path --dist-dir)/build $(DIST)
34+$(EMPTY)/stack-setup: | $(EMPTY)
35+ $(STACK) $(STACK_FLAGS) setup
38+$(GHCID): $(EMPTY)/stack-setup | $(BIN)
39+ $(STACK) $(STACK_FLAGS) install ghcid --local-bin-path $(BIN)
45+cabal-check: $(CABAL_FILE)
57+sdist: cabal-check | $(DIST)
61+test: $(EMPTY)/build test-doc-test
64+test-doc-test: $(DOC_TEST)
67+.PHONY: upload-hackage
69+ @ $(CABAL) upload $(DIST)/$(PROJECT_NAME)-*.tar.gz