1 override BENCHMARK_OPTIONS += --output benchmarks/html/$(version).html --match glob $b
2 override GHCID_OPTIONS += --no-height-limit --reverse-errors
3 override GHC_PROF_OPTIONS += -eventlog -fprof-auto -fprof-auto-calls
4 override REPL_OPTIONS += -ignore-dot-ghci
5 override RTS_OPTIONS += -L100
6 override TEST_OPTIONS += --color always --size-cutoff 1000000 $(addprefix -p ,$t)
8 cabal := $(wildcard *.cabal)
9 package := $(notdir ./$(cabal:.cabal=))
10 version := $(shell sed -ne 's/^version: *\(.*\)/\1/p' $(cabal))
11 project := $(patsubst %.cabal,%,$(cabal))
15 cabal build $(CABAL_BUILD_FLAGS)
19 cabal repl $(CABAL_REPL_FLAGS) $(project)
21 ghcid $(GHCID_OPTIONS) -c 'cabal repl $(CABAL_REPL_FLAGS) $(project) $(addprefix --repl-options ,$(REPL_OPTIONS))'
24 cabal build $(CABAL_BUILD_FLAGS) $(project):parsers
26 cabal repl $(CABAL_REPL_FLAGS) $(project):parsers
28 ghcid $(GHCID_OPTIONS) -c 'cabal repl $(CABAL_REPL_FLAGS) $(project):parsers $(addprefix --repl-options ,$(REPL_OPTIONS))'
30 cabal v2-build lib:$(project) --enable-profiling $(GHC_PROF_OPTIONS) --write-ghc-environment-files=always
31 cabal build $(CABAL_BUILD_FLAGS) $(project):parsers \
32 --enable-profiling $(GHC_PROF_OPTIONS) \
33 --ghc-options "$(addprefix -opti,+RTS $(RTS_OPTIONS))"
37 cabal test $(CABAL_TEST_FLAGS) \
38 --test-show-details always --test-options "$(TEST_OPTIONS)"
39 tests/prof-time: $(project)-test.eventlog.json
40 tests/prof-heap: $(project)-test.eventlog.html
41 .PHONY: $(project)-test.eventlog
42 $(project)-test.eventlog $(project)-test.prof:
43 cabal test $(CABAL_TEST_FLAGS) \
44 --test-show-details always --test-options "$(TEST_OPTIONS) +RTS $(RTS_OPTIONS)" \
45 --enable-profiling $(GHC_PROF_OPTIONS) || true
47 cabal v2-build lib:$(project) --enable-profiling $(GHC_PROF_OPTIONS) --write-ghc-environment-files=always
48 cabal test $(CABAL_TEST_FLAGS) \
49 --test-show-details always --test-options "$(TEST_OPTIONS) +RTS $(RTS_OPTIONS)" \
50 --enable-profiling $(GHC_PROF_OPTIONS) \
51 --ghc-options "$(addprefix -opti,+RTS $(RTS_OPTIONS))"
53 cabal repl $(CABAL_REPL_FLAGS) --enable-tests $(project)-test
55 ghcid $(GHCID_OPTIONS) -c 'cabal repl $(CABAL_REPL_FLAGS) $(project):tests --test-options "$(TEST_OPTIONS)"'
57 %/accept: TEST_OPTIONS += --accept
60 %/cover: CABAL_TEST_FLAGS += --enable-coverage
63 %.eventlog.html: RTS_OPTIONS += -hy -l-au
64 %.eventlog.html: %.eventlog
66 %.eventlog.json: RTS_OPTIONS += -p -l-au
67 %.eventlog.json: %.eventlog
70 .PHONY: benchmarks/html/$(version).html
71 b benchmarks: benchmarks/html/$(version).html
72 benchmarks/html/$(version).html:
73 mkdir -p benchmarks/html
74 cabal bench $(CABAL_BENCH_FLAGS) --benchmark-options "$(BENCHMARK_OPTIONS)"
76 cabal repl $(CABAL_REPL_FLAGS) --enable-benchmarks $(project)-benchmark
77 benchmarks/prof-time: $(project)-benchmark.eventlog.json
78 benchmarks/prof-heap: $(project)-benchmark.eventlog.html
79 .PHONY: $(project)-benchmark.eventlog
80 $(project)-benchmark.eventlog $(project)-benchmark.prof:
81 @echo "$$(tput setaf 1)WARNING: benchmarking with --enable-profiling can create significant biases$$(tput sgr0)"
82 cabal bench $(CABAL_BENCH_FLAGS) \
83 --benchmark-options "$(BENCHMARK_OPTIONS) +RTS $(RTS_OPTIONS)" \
84 --enable-profiling $(GHC_PROF_OPTIONS)
85 $(project)-benchmark.prof2:
86 cabal v2-build lib:$(project) --enable-profiling $(GHC_PROF_OPTIONS) --write-ghc-environment-files=always
87 cabal bench $(CABAL_BENCH_FLAGS) \
88 --benchmark-options "$(BENCHMARK_OPTIONS)" \
89 --enable-profiling $(GHC_PROF_OPTIONS) \
90 --ghc-options "$(addprefix -opti,+RTS $(RTS_OPTIONS))"
93 cabal haddock --haddock-css ocean --haddock-hyperlink-source
96 git tag --merged | grep -Fqx "$(package)-$(version)" || \
97 git tag -f -s -m "$(package) v$(version)" $(package)-$(version)
101 cabal haddock --haddock-for-hackage --enable-doc
104 cabal upload $(CABAL_UPLOAD_FLAGS) dist-newstyle/sdist/$(package)-$(version).tar.gz
105 cabal upload $(CABAL_UPLOAD_FLAGS) --documentation dist-newstyle/$(package)-$(version)-docs.tar.gz
106 %/publish: CABAL_UPLOAD_FLAGS+=--publish
109 publish: upload/publish
114 nix flake update --recreate-lock-file
116 nix -L develop --command cabal repl $(CABAL_REPL_FLAGS)