override GHCID_OPTIONS += --no-height-limit --reverse-errors override REPL_OPTIONS += -ignore-dot-ghci cabal := $(wildcard *.cabal) package := $(notdir ./$(cabal:.cabal=)) version := $(shell sed -ne 's/^version: *\(.*\)/\1/p' $(cabal)) project := $(patsubst %.cabal,%,$(cabal)) cabal_builddir ?= dist-newstyle all: build build: cabal build $(CABAL_BUILD_FLAGS) clean c: cabal clean repl: cabal repl $(CABAL_REPL_FLAGS) $(project) ghcid: ghcid $(GHCID_OPTIONS) --command 'cabal repl -fno-code $(CABAL_REPL_FLAGS) $(project) $(addprefix --repl-options ,$(REPL_OPTIONS))' .PHONY: tests t tests: cabal test $(CABAL_TEST_FLAGS) \ --test-show-details always --test-options "$(TEST_OPTIONS)" tests/prof-time: $(project)-test.eventlog.json tests/prof-heap: $(project)-test.eventlog.html .PHONY: $(project)-test.eventlog $(project)-test.eventlog $(project)-test.prof: cabal test $(CABAL_TEST_FLAGS) \ --test-show-details always --test-options "$(TEST_OPTIONS) +RTS $(RTS_OPTIONS)" \ --enable-profiling $(addprefix --ghc-options ,$(GHC_PROF_OPTIONS)) || true t/repl tests/repl: cabal repl $(CABAL_REPL_FLAGS) $(CABAL_TEST_FLAGS) --enable-tests $(project)-test t/ghcid tests/ghcid: ghcid $(GHCID_OPTIONS) --command 'cabal repl $(CABAL_REPL_FLAGS) $(CABAL_TEST_FLAGS) $(project):tests' --test ":main $(TEST_OPTIONS)" %/accept: TEST_OPTIONS += --accept %/accept: % %/cover: CABAL_TEST_FLAGS += --enable-coverage %/cover: % %.eventlog.html: RTS_OPTIONS += -hy -l-au %.eventlog.html: %.eventlog eventlog2html $< %.eventlog.json: RTS_OPTIONS += -p -l-au %.eventlog.json: %.eventlog hs-speedscope $< doc: cabal haddock --haddock-css ocean --haddock-hyperlink-source tag: git tag --merged | grep -Fqx "$(package)-$(version)" || \ git tag -f -s -m "$(package) v$(version)" $(package)-$(version) tar: git diff --exit-code reuse lint cabal sdist cabal haddock --haddock-for-hackage --enable-doc upload: LANG=C upload: tar tag git push --follow-tags $(GIT_PUSH_FLAGS) cabal upload $(CABAL_UPLOAD_FLAGS) "$(cabal_builddir)"/sdist/$(package)-$(version).tar.gz cabal upload $(CABAL_UPLOAD_FLAGS) --documentation "$(cabal_builddir)"/$(package)-$(version)-docs.tar.gz %/publish: CABAL_UPLOAD_FLAGS+=--publish %/publish: % publish: upload/publish nix-build: nix -L build nix-relock: nix flake update --recreate-lock-file nix-repl: nix -L develop --command cabal repl $(CABAL_REPL_FLAGS) nix-shell: nix -L develop .PHONY: .hlint.yaml .hlint.yaml: $(shell find src -name '*.hs' -not -name 'HLint.hs') sed -i -e '/^# BEGIN: generated hints/,/^# END: generated hints/d' $@ echo >>$@ '# BEGIN: generated hints' hlint --find . | grep -- '- fixity:' | sort -u >>$@ echo >>$@ '# END: generated hints' lint: .hlint.yaml if hlint --quiet --report=hlint.html -XNoCPP $(HLINT_FLAGS) .; \ then rm -f hlint.html; \ else sensible-browser ./hlint.html & fi