mirror of
https://github.com/typeable/rollbar-hs.git
synced 2024-09-11 05:35:27 +03:00
If we `make clean` outside of the nix shell, we can't necessarily get back in. Certainly, `make shell` doesn't work. But, building `default.nix` might not work if `hpack` doesn't exist.
61 lines
1.1 KiB
Makefile
61 lines
1.1 KiB
Makefile
CABAL ?= cabal
|
|
CABAL_FLAGS ?=
|
|
DIST ?= dist
|
|
GHCID ?= ghcid
|
|
GHCID_FLAGS ?= --ghc-options=-fno-code
|
|
HPACK ?= hpack
|
|
NIX_SHELL ?= nix-shell
|
|
NIX_SHELL_FLAGS ?=
|
|
PROJECT_NAME := rollbar-hs
|
|
|
|
CABAL_FILE := $(PROJECT_NAME).cabal
|
|
CONFIGURE := $(DIST)/setup-config
|
|
DOC_TEST := $(DIST)/build/doc-test/doc-test
|
|
|
|
.DEFAULT_GOAL := build
|
|
|
|
$(CABAL_FILE): package.yaml
|
|
$(HPACK)
|
|
|
|
$(CONFIGURE): $(CABAL_FILE)
|
|
$(CABAL) $(CABAL_FLAGS) configure --enable-tests
|
|
|
|
.PHONY: build
|
|
build $(DOC_TEST): $(CONFIGURE) default.nix
|
|
$(CABAL) $(CABAL_FLAGS) build
|
|
|
|
.PHONY: check
|
|
check: $(CABAL_FILE)
|
|
$(CABAL) $(CABAL_FLAGS) check
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
rm -f $(CABAL_FILE)
|
|
rm -fr $(DIST)
|
|
|
|
default.nix: $(CABAL_FILE)
|
|
cabal2nix . > $@
|
|
|
|
.PHONY: sdist
|
|
sdist: check
|
|
$(CABAL) $(CABAL_FLAGS) sdist
|
|
|
|
.PHONY: shell
|
|
shell:
|
|
$(NIX_SHELL) --pure $(NIX_SHELL_FLAGS)
|
|
|
|
.PHONY: test
|
|
test: test-doc-test
|
|
|
|
.PHONY: test-doc-test
|
|
test-doc-test: $(DOC_TEST)
|
|
$<
|
|
|
|
.PHONY: upload-hackage
|
|
upload-hackage: sdist
|
|
@ $(CABAL) $(CABAL_FLAGS) upload $(DIST)/$(PROJECT_NAME)-*.tar.gz
|
|
|
|
.PHONY: watch
|
|
watch: $(CONFIGURE)
|
|
$(GHCID) --command "cabal repl lib:$(PROJECT_NAME) $(GHCID_FLAGS)"
|