]> Git — Sourcephile - haskell/symantic-plaintext.git/blob - Makefile
copyright: comply with REUSE-3.0
[haskell/symantic-plaintext.git] / Makefile
1 override RTS_OPTIONS += -L100
2 override TEST_OPTIONS += --color always $(addprefix -p ,$t)
3 override GHC_PROF_OPTIONS += -fprof-auto -fprof-auto-calls
4 override REPL_OPTIONS += -ignore-dot-ghci
5
6 cabal := $(wildcard *.cabal)
7 package := $(notdir ./$(cabal:.cabal=))
8 version := $(shell sed -ne 's/^version: *\(.*\)/\1/p' $(cabal))
9 project := $(patsubst %.cabal,%,$(cabal))
10
11 all: build
12 build:
13 cabal build
14 clean c:
15 cabal clean
16 repl:
17 cabal repl $(project)
18 ghcid:
19 ghcid -c 'cabal repl $(project) --repl-options "$(REPL_OPTIONS)"' --reverse-errors
20
21 .PHONY: tests
22 t tests:
23 cabal test $(CABAL_TEST_FLAGS) \
24 --test-show-details always --test-options "$(TEST_OPTIONS)"
25 tests/prof-time: $(project)-tests.eventlog.json
26 tests/prof-heap: $(project)-tests.eventlog.html
27 .PHONY: $(project)-tests.eventlog
28 $(project)-tests.eventlog $(project)-tests.prof:
29 cabal test $(CABAL_TEST_FLAGS) \
30 --test-show-details always --test-options "$(TEST_OPTIONS) +RTS $(RTS_OPTIONS)" \
31 --enable-profiling $(GHC_PROF_OPTIONS) || true
32 tests/repl:
33 cabal repl --enable-tests $(project)-tests
34
35 %/accept: TEST_OPTIONS += --accept
36 %/accept: %
37
38 %/cover: CABAL_TEST_FLAGS += --enable-coverage
39 %/cover: %
40
41
42 doc:
43 cabal haddock --haddock-css ocean --haddock-hyperlink-source
44
45 tag:
46 git tag --merged | grep -Fqx "$(package)-$(version)" || \
47 git tag -f -s -m "$(package) v$(version)" $(package)-$(version)
48
49 tar:
50 cabal sdist
51 cabal haddock --haddock-for-hackage --enable-doc
52 upload: LANG=C
53 upload: tar
54 cabal upload $(CABAL_UPLOAD_FLAGS) dist-newstyle/sdist/$(package)-$(version).tar.gz
55 cabal upload $(CABAL_UPLOAD_FLAGS) --documentation dist-newstyle/$(package)-$(version)-docs.tar.gz
56 %/publish: CABAL_UPLOAD_FLAGS+=--publish
57 %/publish: %
58
59 publish: upload/publish
60
61 nix-build:
62 nix -L build
63 nix-relock:
64 nix flake update --recreate-lock-file
65 nix-repl:
66 nix -L develop --command cabal repl
67 nix-shell:
68 nix -L develop