+override GHCID_OPTIONS += --no-height-limit --reverse-errors
override REPL_OPTIONS += -ignore-dot-ghci
-override GHCID_OPTIONS += --no-height-limit --reverse-errors
cabal := $(wildcard *.cabal)
package := $(notdir ./$(cabal:.cabal=))
version := $(shell sed -ne 's/^version: *\(.*\)/\1/p' $(cabal))
project := $(patsubst %.cabal,%,$(cabal))
+cabal_builddir ?= dist-newstyle
all: build
build:
repl:
cabal repl $(CABAL_REPL_FLAGS) $(project)
ghcid:
- ghcid $(GHCID_OPTIONS) -c 'cabal repl $(CABAL_REPL_FLAGS) $(project) $(addprefix --repl-options ,$(REPL_OPTIONS))'
+ ghcid $(GHCID_OPTIONS) --command 'cabal repl -fno-code $(CABAL_REPL_FLAGS) $(project) $(addprefix --repl-options ,$(REPL_OPTIONS))'
doc:
cabal haddock --haddock-css ocean --haddock-hyperlink-source
upload: LANG=C
upload: tar tag
git push --follow-tags $(GIT_PUSH_FLAGS)
- cabal upload $(CABAL_UPLOAD_FLAGS) dist-newstyle/sdist/$(package)-$(version).tar.gz
- cabal upload $(CABAL_UPLOAD_FLAGS) --documentation dist-newstyle/$(package)-$(version)-docs.tar.gz
+ cabal upload $(CABAL_UPLOAD_FLAGS) "$(cabal_builddir)"/sdist/$(package)-$(version).tar.gz
+ cabal upload $(CABAL_UPLOAD_FLAGS) --documentation "$(cabal_builddir)"/$(package)-$(version)-docs.tar.gz
%/publish: CABAL_UPLOAD_FLAGS+=--publish
%/publish: %
nix -L develop --command cabal repl $(CABAL_REPL_FLAGS)
nix-shell:
nix -L develop
+
+.hlint.yaml: $(shell find src -name '*.hs' -not -name 'HLint.hs')
+ sed -i -e '/^# BEGIN: generated hints/,/^# END: generated hints/d' $@
+ echo >>$@ '# BEGIN: generated hints'
+ hlint --find . | grep -- '- fixity:' | sort -u >>$@
+ echo >>$@ '# END: generated hints'
+
+lint: .hlint.yaml
+ if hlint --quiet --report=hlint.html -XNoCPP $(HLINT_FLAGS) .; \
+ then rm -f hlint.html; \
+ else sensible-browser ./hlint.html & fi