]> Git — Sourcephile - haskell/symantic-base.git/blob - Makefile
impl: cleanup formatting a bit
[haskell/symantic-base.git] / Makefile
1 override GHCID_OPTIONS += --no-height-limit --reverse-errors
2 override REPL_OPTIONS += -ignore-dot-ghci
3
4 cabal := $(wildcard *.cabal)
5 package := $(notdir ./$(cabal:.cabal=))
6 version := $(shell sed -ne 's/^version: *\(.*\)/\1/p' $(cabal))
7 project := $(patsubst %.cabal,%,$(cabal))
8 cabal_builddir ?= dist-newstyle
9
10 all: build
11 build:
12 cabal build $(CABAL_BUILD_FLAGS)
13 clean c:
14 cabal clean
15 repl:
16 cabal repl $(CABAL_REPL_FLAGS) $(project)
17 ghcid:
18 ghcid $(GHCID_OPTIONS) --command 'cabal repl -fno-code $(CABAL_REPL_FLAGS) $(project) $(addprefix --repl-options ,$(REPL_OPTIONS))'
19
20 doc:
21 cabal haddock --haddock-css ocean --haddock-hyperlink-source
22
23 tag:
24 git tag --merged | grep -Fqx "$(package)-$(version)" || \
25 git tag -f -s -m "$(package) v$(version)" $(package)-$(version)
26
27 tar:
28 git diff --exit-code
29 reuse lint
30 cabal sdist
31 cabal haddock --haddock-for-hackage --enable-doc
32 upload: LANG=C
33 upload: tar tag
34 git push --follow-tags $(GIT_PUSH_FLAGS)
35 cabal upload $(CABAL_UPLOAD_FLAGS) "$(cabal_builddir)"/sdist/$(package)-$(version).tar.gz
36 cabal upload $(CABAL_UPLOAD_FLAGS) --documentation "$(cabal_builddir)"/$(package)-$(version)-docs.tar.gz
37 %/publish: CABAL_UPLOAD_FLAGS+=--publish
38 %/publish: %
39
40 publish: upload/publish
41
42 nix-build:
43 nix -L build
44 nix-relock:
45 nix flake update --recreate-lock-file
46 nix-repl:
47 nix -L develop --command cabal repl $(CABAL_REPL_FLAGS)
48 nix-shell:
49 nix -L develop
50
51 .hlint.yaml: $(shell find src -name '*.hs' -not -name 'HLint.hs')
52 sed -i -e '/^# BEGIN: generated hints/,/^# END: generated hints/d' $@
53 echo >>$@ '# BEGIN: generated hints'
54 hlint --find . | grep -- '- fixity:' | sort -u >>$@
55 echo >>$@ '# END: generated hints'
56
57 lint: .hlint.yaml
58 if hlint --quiet --report=hlint.html -XNoCPP $(HLINT_FLAGS) .; \
59 then rm -f hlint.html; \
60 else sensible-browser ./hlint.html & fi