1 override BENCHMARK_OPTIONS += --output benchmarks/html/$(version).html --match glob $b
 
   2 override GHCID_OPTIONS += --no-height-limit --reverse-errors --warnings
 
   3 override GHC_PROF_OPTIONS += -eventlog -fprof-auto -fprof-cafs
 
   5 override REPL_OPTIONS += -ignore-dot-ghci
 
   6 override RTS_OPTIONS += -L100
 
   7 override TEST_OPTIONS += --color always --size-cutoff 1000000 $(addprefix -p ,$t)
 
   8 override CABAL_TEST_FLAGS += -j
 
  10 cabal := $(wildcard *.cabal)
 
  11 package := $(notdir ./$(cabal:.cabal=))
 
  12 version := $(shell sed -ne 's/^version: *\(.*\)/\1/p' $(cabal))
 
  13 project := $(patsubst %.cabal,%,$(cabal))
 
  17         cabal build $(CABAL_BUILD_FLAGS)
 
  21         cabal repl $(CABAL_REPL_FLAGS) $(project)
 
  23         ghcid $(GHCID_OPTIONS) --command 'cabal repl -fno-code $(CABAL_REPL_FLAGS) $(project) $(addprefix --repl-options ,$(REPL_OPTIONS))'
 
  26         cabal build $(CABAL_BUILD_FLAGS) $(project):parsers
 
  28         cabal repl $(CABAL_REPL_FLAGS) $(project):parsers
 
  30         ghcid $(GHCID_OPTIONS) --command 'cabal repl -fno-code $(CABAL_REPL_FLAGS) $(project):parsers $(addprefix --repl-options ,$(REPL_OPTIONS))'
 
  32         cabal v2-build lib:$(project) --enable-profiling $(addprefix --ghc-options ,$(GHC_PROF_OPTIONS)) --write-ghc-environment-files=always
 
  33         cabal build $(CABAL_BUILD_FLAGS) $(project):parsers \
 
  34          --enable-profiling $(addprefix --ghc-options ,$(GHC_PROF_OPTIONS)) \
 
  35          --ghc-options "$(addprefix -opti,+RTS $(RTS_OPTIONS))"
 
  39         cabal test $(CABAL_TEST_FLAGS) \
 
  40          --test-show-details always --test-options "$(TEST_OPTIONS)"
 
  41 tests/prof-time: $(project)-test.eventlog.json
 
  42 tests/prof-heap: $(project)-test.eventlog.html
 
  43 .PHONY: $(project)-test.eventlog
 
  44 $(project)-test.eventlog $(project)-test.prof:
 
  45         cabal test $(CABAL_TEST_FLAGS) \
 
  46          --test-show-details always --test-options "$(TEST_OPTIONS) +RTS $(RTS_OPTIONS)" \
 
  47          --enable-profiling $(addprefix --ghc-options ,$(GHC_PROF_OPTIONS)) || true
 
  49         cabal v2-build lib:$(project) --enable-profiling $(addprefix --ghc-options ,$(GHC_PROF_OPTIONS)) --write-ghc-environment-files=always
 
  50         cabal test $(CABAL_TEST_FLAGS) \
 
  51          --test-show-details always --test-options "$(TEST_OPTIONS) +RTS $(RTS_OPTIONS)" \
 
  52          --enable-profiling $(addprefix --ghc-options ,$(GHC_PROF_OPTIONS)) \
 
  53          --ghc-options "$(addprefix -opti,+RTS $(RTS_OPTIONS))"
 
  55         cabal repl $(CABAL_REPL_FLAGS) $(CABAL_TEST_FLAGS) --enable-tests $(project)-test
 
  57         ghcid $(GHCID_OPTIONS) --command 'cabal repl $(CABAL_REPL_FLAGS) $(CABAL_TEST_FLAGS) $(project):tests' --test ":main $(TEST_OPTIONS)"
 
  59 %/accept: TEST_OPTIONS += --accept
 
  62 %/cover: CABAL_TEST_FLAGS += --enable-coverage
 
  65 %.eventlog.html: RTS_OPTIONS += -hy -l-au
 
  66 %.eventlog.html: %.eventlog
 
  68 %.eventlog.json: RTS_OPTIONS += -p -l-au
 
  69 %.eventlog.json: %.eventlog
 
  72 .PHONY: benchmarks/html/$(version).html
 
  73 b benchmarks: benchmarks/html/$(version).html
 
  74 benchmarks/html/$(version).html:
 
  75         mkdir -p benchmarks/html
 
  76         cabal bench $(CABAL_BENCH_FLAGS) --benchmark-options "$(BENCHMARK_OPTIONS)"
 
  78         cabal repl $(CABAL_REPL_FLAGS) --enable-benchmarks $(project)-benchmark
 
  79 benchmarks/prof-time: $(project)-benchmark.eventlog.json
 
  80 benchmarks/prof-heap: $(project)-benchmark.eventlog.html
 
  81 .PHONY: $(project)-benchmark.eventlog
 
  82 $(project)-benchmark.eventlog $(project)-benchmark.prof:
 
  83         @echo "$$(tput setaf 1)WARNING: benchmarking with --enable-profiling can create significant biases$$(tput sgr0)"
 
  84         cabal bench $(CABAL_BENCH_FLAGS) \
 
  85          --benchmark-options "$(BENCHMARK_OPTIONS) +RTS $(RTS_OPTIONS)" \
 
  86          --enable-profiling $(GHC_PROF_OPTIONS)
 
  87 $(project)-benchmark.prof2:
 
  88         cabal v2-build lib:$(project) --enable-profiling $(GHC_PROF_OPTIONS) --write-ghc-environment-files=always
 
  89         cabal bench $(CABAL_BENCH_FLAGS) \
 
  90          --benchmark-options "$(BENCHMARK_OPTIONS)" \
 
  91          --enable-profiling $(GHC_PROF_OPTIONS) \
 
  92          --ghc-options "$(addprefix -opti,+RTS $(RTS_OPTIONS))"
 
  95         cabal haddock --haddock-css ocean --haddock-hyperlink-source
 
  98         git tag --merged | grep -Fqx "$(package)-$(version)" || \
 
  99         git tag -f -s -m "$(package) v$(version)" $(package)-$(version)
 
 103         cabal haddock --haddock-for-hackage --enable-doc
 
 106         cabal upload $(CABAL_UPLOAD_FLAGS) dist-newstyle/sdist/$(package)-$(version).tar.gz
 
 107         cabal upload $(CABAL_UPLOAD_FLAGS) --documentation dist-newstyle/$(package)-$(version)-docs.tar.gz
 
 108 %/publish: CABAL_UPLOAD_FLAGS+=--publish
 
 111 publish: upload/publish
 
 116         nix flake update --recreate-lock-file
 
 118         nix -L develop --command cabal repl $(CABAL_REPL_FLAGS)