2018-07-29 20:10:11 +03:00
|
|
|
CABAL ?= cabal
|
2018-08-09 17:51:17 +03:00
|
|
|
CABAL_FLAGS ?=
|
2018-07-29 20:10:11 +03:00
|
|
|
DIST ?= dist
|
2018-08-09 17:51:17 +03:00
|
|
|
GHCID ?= ghcid
|
|
|
|
GHCID_FLAGS ?= --ghc-options=-fno-code
|
|
|
|
HPACK ?= hpack
|
|
|
|
NIX_SHELL ?= nix-shell
|
|
|
|
NIX_SHELL_FLAGS ?=
|
|
|
|
PROJECT_NAME := rollbar-hs
|
2018-07-27 15:03:47 +03:00
|
|
|
|
|
|
|
CABAL_FILE := $(PROJECT_NAME).cabal
|
2018-08-09 17:51:17 +03:00
|
|
|
CONFIGURE := $(DIST)/setup-config
|
2018-07-29 22:19:06 +03:00
|
|
|
DOC_TEST := $(DIST)/build/doc-test/doc-test
|
2018-07-25 09:07:03 +03:00
|
|
|
|
2018-07-29 22:26:42 +03:00
|
|
|
.DEFAULT_GOAL := build
|
2018-07-25 09:07:03 +03:00
|
|
|
|
2018-07-29 20:10:11 +03:00
|
|
|
$(CABAL_FILE): package.yaml
|
2018-08-09 17:51:17 +03:00
|
|
|
$(HPACK)
|
2018-07-29 22:19:06 +03:00
|
|
|
|
2018-08-09 17:51:17 +03:00
|
|
|
$(CONFIGURE): $(CABAL_FILE)
|
|
|
|
$(CABAL) $(CABAL_FLAGS) configure --enable-tests
|
2018-07-29 22:19:06 +03:00
|
|
|
|
2018-08-09 17:51:17 +03:00
|
|
|
.PHONY: build
|
|
|
|
build $(DOC_TEST): $(CONFIGURE) default.nix
|
|
|
|
$(CABAL) $(CABAL_FLAGS) build
|
2018-07-25 09:07:03 +03:00
|
|
|
|
2018-08-09 17:51:17 +03:00
|
|
|
.PHONY: check
|
|
|
|
check: $(CABAL_FILE)
|
|
|
|
$(CABAL) $(CABAL_FLAGS) check
|
2018-07-27 15:03:47 +03:00
|
|
|
|
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 $(DIST)
|
2018-08-09 17:51:17 +03:00
|
|
|
|
|
|
|
default.nix: $(CABAL_FILE)
|
|
|
|
cabal2nix . > $@
|
2018-07-25 09:07:03 +03:00
|
|
|
|
2018-07-27 15:03:47 +03:00
|
|
|
.PHONY: sdist
|
2018-08-09 17:51:17 +03:00
|
|
|
sdist: check
|
|
|
|
$(CABAL) $(CABAL_FLAGS) sdist
|
|
|
|
|
|
|
|
.PHONY: shell
|
|
|
|
shell:
|
|
|
|
$(NIX_SHELL) --pure $(NIX_SHELL_FLAGS)
|
2018-07-27 15:03:47 +03:00
|
|
|
|
2018-07-25 09:07:03 +03:00
|
|
|
.PHONY: test
|
2018-08-09 17:51:17 +03:00
|
|
|
test: test-doc-test
|
2018-07-29 23:07:43 +03:00
|
|
|
|
|
|
|
.PHONY: test-doc-test
|
|
|
|
test-doc-test: $(DOC_TEST)
|
|
|
|
$<
|
2018-07-25 09:07:03 +03:00
|
|
|
|
2018-07-27 15:03:47 +03:00
|
|
|
.PHONY: upload-hackage
|
|
|
|
upload-hackage: sdist
|
2018-08-09 17:51:17 +03:00
|
|
|
@ $(CABAL) $(CABAL_FLAGS) upload $(DIST)/$(PROJECT_NAME)-*.tar.gz
|
2018-07-27 15:03:47 +03:00
|
|
|
|
2018-07-25 09:07:03 +03:00
|
|
|
.PHONY: watch
|
2018-08-09 17:51:17 +03:00
|
|
|
watch: $(CONFIGURE)
|
|
|
|
$(GHCID) --command "cabal repl lib:$(PROJECT_NAME) $(GHCID_FLAGS)"
|