@@ -1,4 +1,9 @@
1+PROJECT_NAME := rollbar-hs
5+CABAL_FILE := $(PROJECT_NAME).cabal
2EMPTY := .make
7EMPTY := .make
3GHCID := $(BIN)/ghcid
8GHCID := $(BIN)/ghcid
4STACK := stack
9STACK := stack
@@ -6,30 +11,55 @@ STACK_WORK := .stack-work
7.DEFAULT_GOAL := build
12.DEFAULT_GOAL := build
10− mkdir $@
21+ mkdir -p $@
12$(EMPTY)/stack-setup: | $(EMPTY)
23$(EMPTY)/stack-setup: | $(EMPTY)
13 $(STACK) setup
24 $(STACK) setup
16−$(GHCID): $(EMPTY)/stack-setup
27+$(GHCID): $(EMPTY)/stack-setup | $(BIN)
17 $(STACK) install ghcid --local-bin-path $(BIN)
28 $(STACK) install ghcid --local-bin-path $(BIN)
31+ # `stack` has no way to run `hpack` directly.
32+ # We can run `hpack` indirectly with little overhead.
33+ $(STACK) build --dry-run
19.PHONY: build
35.PHONY: build
20build: $(EMPTY)/stack-setup
36build: $(EMPTY)/stack-setup
21 $(STACK) build --no-run-tests --test
37 $(STACK) build --no-run-tests --test
40+cabal-check: $(CABAL_FILE)
23.PHONY: clean
43.PHONY: clean
25− rm -f $(BIN)/*
46+ rm -fr $(BIN)
26− rm -f $(EMPTY)/*
48+ rm -fr $(EMPTY)
27 rm -fr $(STACK_WORK)
49 rm -fr $(STACK_WORK)
52+sdist: cabal-check | $(DIST)
29.PHONY: test
55.PHONY: test
30test: build
56test: build
31 $(STACK) test
57 $(STACK) test
59+.PHONY: upload-hackage
61+ @ $(CABAL) upload $(DIST)/$(PROJECT_NAME)-*.tar.gz
33.PHONY: watch
63.PHONY: watch
34watch: $(GHCID)
64watch: $(GHCID)