1 override GHCID_OPTIONS += --no-height-limit --reverse-errors --color=always
 
   2 override REPL_OPTIONS += -ignore-dot-ghci
 
   4 cabal := $(wildcard *.cabal)
 
   5 package := $(notdir ./$(cabal:.cabal=))
 
   6 version := $(shell sed -ne 's/^version: *\(.*\)/\1/p' $(cabal))
 
   7 project := $(patsubst %.cabal,%,$(cabal))
 
   8 cabal_builddir ?= dist-newstyle
 
  12         cabal build $(CABAL_BUILD_FLAGS)
 
  16         cabal repl $(CABAL_REPL_FLAGS) $(project)
 
  18         ghcid $(GHCID_OPTIONS) --command 'cabal repl -fno-code $(CABAL_REPL_FLAGS) $(project) $(addprefix --repl-options ,$(REPL_OPTIONS))'
 
  22         cabal test $(CABAL_TEST_FLAGS) \
 
  23          --test-show-details always --test-options "$(TEST_OPTIONS)"
 
  24 tests/prof-time: $(project)-tests.eventlog.json
 
  25 tests/prof-heap: $(project)-tests.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 $(addprefix --ghc-options ,$(GHC_PROF_OPTIONS)) || true
 
  32         cabal repl $(CABAL_REPL_FLAGS) $(CABAL_TEST_FLAGS) --enable-tests $(project)-tests
 
  34         ghcid $(GHCID_OPTIONS) --command 'cabal repl $(CABAL_REPL_FLAGS) $(CABAL_TEST_FLAGS) $(project):tests' --test ":main $(TEST_OPTIONS)"
 
  36 %/accept: TEST_OPTIONS += --accept
 
  39 %/cover: CABAL_TEST_FLAGS += --enable-coverage
 
  42 %.eventlog.html: RTS_OPTIONS += -hy -l-au
 
  43 %.eventlog.html: %.eventlog
 
  45 %.eventlog.json: RTS_OPTIONS += -p -l-au
 
  46 %.eventlog.json: %.eventlog
 
  50         cabal haddock --haddock-css ocean --haddock-hyperlink-source
 
  54         ! git tag --merged | grep -Fqx $(package)-$(version)
 
  56         git tag -f $(package)-$(version)
 
  57         git-chglog --output $@.new --tag-filter-pattern '$(package)-.*' $(package)-$(version)
 
  61         git tag -d $(package)-$(version)
 
  63         git commit -m 'doc: update `$@`'
 
  65         git tag -s -m $(package)-$(version) $(package)-$(version)
 
  71         cabal haddock --haddock-for-hackage --enable-doc
 
  74         git push --follow-tags $(GIT_PUSH_FLAGS)
 
  75         cabal upload $(CABAL_UPLOAD_FLAGS) "$(cabal_builddir)"/sdist/$(package)-$(version).tar.gz
 
  76         cabal upload $(CABAL_UPLOAD_FLAGS) --documentation "$(cabal_builddir)"/$(package)-$(version)-docs.tar.gz
 
  77 %/publish: CABAL_UPLOAD_FLAGS+=--publish
 
  80 publish: upload/publish
 
  83 .hlint.yaml: $(shell find src -name '*.hs' -not -name 'HLint.hs')
 
  84         sed -i -e '/^# BEGIN: generated hints/,/^# END: generated hints/d' $@
 
  85         echo >>$@ '# BEGIN: generated hints'
 
  86         hlint --find . | grep -- '- fixity:' | sort -u >>$@
 
  87         echo >>$@ '# END: generated hints'
 
  89         if hlint --quiet --report=hlint.html -XNoCPP $(HLINT_FLAGS) .; \
 
  90         then rm -f hlint.html; \
 
  91         else sensible-browser ./hlint.html & fi