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