]> Git — Sourcephile - haskell/symantic-parser.git/blob - Makefile
TemplateHaskell: why is PprSplice much faster than DumpSplice?
[haskell/symantic-parser.git] / Makefile
1 override RTS_OPTIONS += -L100
2 override TEST_OPTIONS += --color always --size-cutoff 1000000 $(addprefix -p ,$t)
3 override GHC_PROF_OPTIONS += -fprof-auto -fprof-auto-calls
4 override BENCHMARK_OPTIONS += --output benchmarks/html/$(version).html --match glob $b
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 parsers/repl:
19 cabal repl $(project):parsers
20
21 .PHONY: tests
22 tests:
23 cabal test $(CABAL_TEST_FLAGS) \
24 --test-show-details always --test-options "$(TEST_OPTIONS)"
25 tests/prof-time: $(project)-test.eventlog.json
26 tests/prof-heap: $(project)-test.eventlog.html
27 .PHONY: $(project)-test.eventlog
28 $(project)-test.eventlog $(project)-test.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/prof-th:
33 cabal v2-build lib:$(project) --enable-profiling $(GHC_PROF_OPTIONS) --write-ghc-environment-files=always
34 cabal test $(CABAL_TEST_FLAGS) \
35 --test-show-details always --test-options "$(TEST_OPTIONS) +RTS $(RTS_OPTIONS)" \
36 --enable-profiling $(GHC_PROF_OPTIONS) \
37 --ghc-options "$(addprefix -opti,+RTS $(RTS_OPTIONS))"
38 tests/repl:
39 cabal repl --enable-tests $(project)-test
40
41 %/accept: TEST_OPTIONS += --accept
42 %/accept: %
43
44 %/cover: CABAL_TEST_FLAGS += --enable-coverage
45 %/cover: %
46
47 %.eventlog.html: RTS_OPTIONS += -hy -l-au
48 %.eventlog.html: %.eventlog
49 eventlog2html $<
50 %.eventlog.json: RTS_OPTIONS += -p -l-au
51 %.eventlog.json: %.eventlog
52 hs-speedscope $<
53
54 .PHONY: benchmarks/html/$(version).html
55 b benchmarks: benchmarks/html/$(version).html
56 benchmarks/html/$(version).html:
57 mkdir -p benchmarks/html
58 cabal bench $(CABAL_BENCH_FLAGS) --benchmark-options "$(BENCHMARK_OPTIONS)"
59 benchmarks/repl:
60 cabal repl --enable-benchmarks $(project)-benchmark
61 benchmarks/prof-time: $(project)-benchmark.eventlog.json
62 benchmarks/prof-heap: $(project)-benchmark.eventlog.html
63 .PHONY: $(project)-benchmark.eventlog
64 $(project)-benchmark.eventlog $(project)-benchmark.prof:
65 cabal bench $(CABAL_BENCH_FLAGS) \
66 --benchmark-options "$(BENCHMARK_OPTIONS) +RTS $(RTS_OPTIONS)" \
67 --enable-profiling $(GHC_PROF_OPTIONS)
68 $(project)-benchmark.prof2:
69 cabal v2-build lib:$(project) --enable-profiling $(GHC_PROF_OPTIONS) --write-ghc-environment-files=always
70 cabal bench $(CABAL_BENCH_FLAGS) \
71 --benchmark-options "$(BENCHMARK_OPTIONS)" \
72 --enable-profiling $(GHC_PROF_OPTIONS) \
73 --ghc-options "$(addprefix -opti,+RTS $(RTS_OPTIONS))"
74
75 doc:
76 cabal haddock --haddock-css ocean --haddock-hyperlink-source
77
78 tag:
79 git tag --merged | grep -Fqx "$(package)-$(version)" || \
80 git tag -f -s -m "$(package) v$(version)" $(package)-$(version)
81
82 tar:
83 cabal sdist
84 cabal haddock --haddock-for-hackage --enable-doc
85 upload: LANG=C
86 upload: tar
87 cabal upload $(CABAL_UPLOAD_FLAGS) dist-newstyle/sdist/$(package)-$(version).tar.gz
88 cabal upload $(CABAL_UPLOAD_FLAGS) --documentation dist-newstyle/$(package)-$(version)-docs.tar.gz
89 %/publish: CABAL_UPLOAD_FLAGS+=--publish
90 %/publish: %
91
92 publish: upload/publish
93
94 nix-build:
95 nix -L build
96 nix-relock:
97 nix flake update --recreate-lock-file
98 nix-repl:
99 nix -L develop --command cabal repl
100 nix-shell:
101 nix -L develop