]> Git — Sourcephile - haskell/literate-accounting.git/blob - Makefile
next
[haskell/literate-accounting.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: run
11 run:
12 cabal run $(CABAL_RUN_FLAGS)
13 build:
14 cabal build $(CABAL_BUILD_FLAGS)
15 clean c:
16 cabal clean
17 repl:
18 cabal repl $(CABAL_REPL_FLAGS) $(project)
19 ghcid:
20 ghcid $(GHCID_OPTIONS) --command 'cabal repl -fno-code $(CABAL_REPL_FLAGS) $(project) $(addprefix --repl-options ,$(REPL_OPTIONS))'
21
22 doc:
23 cabal haddock --haddock-css ocean --haddock-hyperlink-source
24
25 .PHONY: ChangeLog.md
26 ChangeLog.md:
27 ! git tag --merged | grep -Fqx $(package)-$(version)
28 git diff --exit-code
29 git tag -f $(package)-$(version)
30 git-chglog --output $@.new --tag-filter-pattern '$(package)-.*' $(package)-$(version)
31 touch $@
32 cat $@ >>$@.new
33 mv -f $@.new $@
34 git tag -d $(package)-$(version)
35 git add '$@'
36 git commit -m 'doc: update `$@`'
37 tag: ChangeLog.md
38 git tag -s -m $(package)-$(version) $(package)-$(version)
39
40 tar:
41 git diff --exit-code
42 reuse lint
43 cabal sdist
44 cabal haddock --haddock-for-hackage --enable-doc
45 upload: LANG=C
46 upload: tar tag
47 git push --follow-tags $(GIT_PUSH_FLAGS)
48 cabal upload $(CABAL_UPLOAD_FLAGS) "$(cabal_builddir)"/sdist/$(package)-$(version).tar.gz
49 cabal upload $(CABAL_UPLOAD_FLAGS) --documentation "$(cabal_builddir)"/$(package)-$(version)-docs.tar.gz
50 %/publish: CABAL_UPLOAD_FLAGS+=--publish
51 %/publish: %
52
53 publish: upload/publish
54
55 .PHONY: .hlint.yaml
56 .hlint.yaml: $(shell find src -name '*.hs' -not -name 'HLint.hs')
57 sed -i -e '/^# BEGIN: generated hints/,/^# END: generated hints/d' $@
58 echo >>$@ '# BEGIN: generated hints'
59 hlint --find . | grep -- '- fixity:' | sort -u >>$@
60 echo >>$@ '# END: generated hints'
61 lint: .hlint.yaml
62 if hlint --quiet --report=hlint.html -XNoCPP $(HLINT_FLAGS) .; \
63 then rm -f hlint.html; \
64 else sensible-browser ./hlint.html & fi
65
66 doctest:
67 cd src; time doctest --verbose --fast Symantic/Compta/Demo.hs \
68 -Wno-missing-methods \
69 -XBangPatterns \
70 -XBlockArguments \
71 -XDataKinds \
72 -XDeriveAnyClass \
73 -XDeriveFunctor \
74 -XDeriveGeneric \
75 -XDerivingStrategies \
76 -XFlexibleContexts \
77 -XFlexibleInstances \
78 -XGADTs \
79 -XGeneralizedNewtypeDeriving \
80 -XLambdaCase \
81 -XMultiParamTypeClasses \
82 -XNamedFieldPuns \
83 -XNoMonomorphismRestriction\
84 -XRankNTypes \
85 -XRebindableSyntax \
86 -XRecordWildCards \
87 -XScopedTypeVariables \
88 -XStandaloneDeriving \
89 -XTupleSections \
90 -XTypeApplications \
91 -XTypeFamilies \
92 -XTypeOperators