1 cabal := $(wildcard *.cabal)
2 package := $(notdir ./$(cabal:.cabal=))
3 version := $(shell sed -ne 's/^version: *\(.*\)/\1/p' $(cabal))
4 project := $(patsubst %.cabal,%,$(cabal))
5 cabal_builddir ?= dist-newstyle
7 override REPL_OPTIONS += -ignore-dot-ghci
8 override GHCID_OPTIONS += --no-height-limit --reverse-errors --color=always --warnings --restart $(cabal)
12 cabal build $(CABAL_BUILD_FLAGS)
16 cabal repl $(CABAL_REPL_FLAGS) $(project)
18 ghcid $(GHCID_OPTIONS) --command 'cabal repl -fno-code $(CABAL_REPL_FLAGS) $(project) $(addprefix --repl-options ,$(REPL_OPTIONS))'
21 cabal haddock --haddock-css ocean --haddock-hyperlink-source
25 ! git tag --merged | grep -Fqx $(package)-$(version)
27 git tag -f $(package)-$(version)
28 git-chglog --output $@.new --tag-filter-pattern '$(package)-.*' $(package)-$(version)
32 git tag -d $(package)-$(version)
34 git commit -m 'doc: update `$@`'
35 tag: build ChangeLog.md
36 git tag -s -m $(package)-$(version) $(package)-$(version)
42 cabal haddock --haddock-for-hackage --enable-doc
45 git tag --merged | grep -Fqx $(package)-$(version)
46 git push --follow-tags $(GIT_PUSH_FLAGS)
47 cabal upload $(CABAL_UPLOAD_FLAGS) "$(cabal_builddir)"/sdist/$(package)-$(version).tar.gz
48 cabal upload $(CABAL_UPLOAD_FLAGS) --documentation "$(cabal_builddir)"/$(package)-$(version)-docs.tar.gz
49 %/publish: CABAL_UPLOAD_FLAGS+=--publish
52 publish: upload/publish
55 .hlint.yaml: $(shell find src -name '*.hs' -not -name 'HLint.hs')
56 sed -i -e '/^# BEGIN: generated hints/,/^# END: generated hints/d' $@
57 echo >>$@ '# BEGIN: generated hints'
58 hlint --find . | grep -- '- fixity:' | sort -u >>$@
59 echo >>$@ '# END: generated hints'
61 if hlint --quiet --report=hlint.html -XNoCPP $(HLINT_FLAGS) .; \
62 then rm -f hlint.html; \
63 else sensible-browser ./hlint.html & fi