2018-07-27 15:03:47 +03:00
|
|
|
PROJECT_NAME := rollbar-hs
|
|
|
|
|
2018-07-25 09:07:03 +03:00
|
|
|
BIN := bin
|
2018-07-27 15:03:47 +03:00
|
|
|
CABAL := cabal
|
|
|
|
CABAL_FILE := $(PROJECT_NAME).cabal
|
|
|
|
DIST := dist
|
2018-07-25 09:07:03 +03:00
|
|
|
EMPTY := .make
|
|
|
|
GHCID := $(BIN)/ghcid
|
|
|
|
STACK := stack
|
|
|
|
STACK_WORK := .stack-work
|
|
|
|
|
|
|
|
.DEFAULT_GOAL := build
|
|
|
|
|
2018-07-27 15:03:47 +03:00
|
|
|
$(BIN):
|
|
|
|
mkdir -p $@
|
|
|
|
|
|
|
|
$(DIST):
|
|
|
|
mkdir -p $@
|
|
|
|
|
2018-07-25 09:07:03 +03:00
|
|
|
$(EMPTY):
|
2018-07-27 15:03:47 +03:00
|
|
|
mkdir -p $@
|
2018-07-25 09:07:03 +03:00
|
|
|
|
|
|
|
$(EMPTY)/stack-setup: | $(EMPTY)
|
|
|
|
$(STACK) setup
|
|
|
|
touch $@
|
|
|
|
|
2018-07-27 15:03:47 +03:00
|
|
|
$(GHCID): $(EMPTY)/stack-setup | $(BIN)
|
2018-07-25 09:07:03 +03:00
|
|
|
$(STACK) install ghcid --local-bin-path $(BIN)
|
|
|
|
|
2018-07-27 15:03:47 +03:00
|
|
|
$(CABAL_FILE):
|
|
|
|
# `stack` has no way to run `hpack` directly.
|
|
|
|
# We can run `hpack` indirectly with little overhead.
|
|
|
|
$(STACK) build --dry-run
|
|
|
|
|
2018-07-25 09:07:03 +03:00
|
|
|
.PHONY: build
|
|
|
|
build: $(EMPTY)/stack-setup
|
|
|
|
$(STACK) build --no-run-tests --test
|
|
|
|
|
2018-07-27 15:03:47 +03:00
|
|
|
.PHONY: cabal-check
|
|
|
|
cabal-check: $(CABAL_FILE)
|
|
|
|
$(CABAL) check
|
|
|
|
|
2018-07-25 09:07:03 +03:00
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
2018-07-27 15:03:47 +03:00
|
|
|
rm -f $(CABAL_FILE)
|
|
|
|
rm -fr $(BIN)
|
|
|
|
rm -fr $(DIST)
|
|
|
|
rm -fr $(EMPTY)
|
2018-07-25 09:07:03 +03:00
|
|
|
rm -fr $(STACK_WORK)
|
|
|
|
|
2018-07-27 15:03:47 +03:00
|
|
|
.PHONY: sdist
|
|
|
|
sdist: cabal-check | $(DIST)
|
|
|
|
$(CABAL) sdist
|
|
|
|
|
2018-07-25 09:07:03 +03:00
|
|
|
.PHONY: test
|
|
|
|
test: build
|
|
|
|
$(STACK) test
|
|
|
|
|
2018-07-27 15:03:47 +03:00
|
|
|
.PHONY: upload-hackage
|
|
|
|
upload-hackage: sdist
|
|
|
|
@ $(CABAL) upload $(DIST)/$(PROJECT_NAME)-*.tar.gz
|
|
|
|
|
2018-07-25 09:07:03 +03:00
|
|
|
.PHONY: watch
|
|
|
|
watch: $(GHCID)
|
|
|
|
$(GHCID)
|