1 cabal := $(shell find . -name '*.cabal' -print -quit)
2 package := $(notdir ./$(cabal:.cabal=))
3 QUICKCHECK_TESTS = 1000
4 QUICKCHECK_MAXSIZE = 100
5 TEST_FLAGS = --quickcheck-tests $(QUICKCHECK_TESTS) --quickcheck-max-size $(QUICKCHECK_MAXSIZE)
10 stack $(STACK_FLAGS) build $(STACK_BUILD_FLAGS)
14 ! grep -q '^Test-Suite\>' $(cabal) || \
15 { stack $(STACK_FLAGS) test --test-arguments "$(TEST_FLAGS)" $(STACK_TEST_FLAGS); }
17 %/quickcheck: override QUICKCHECK_TESTS=10000
18 %/quickcheck: override QUICKCHECK_MAXSIZE=1000
22 GHCID_TEST ?= System.Environment.withArgs (words "--color always") main `Control.Exception.finally` putStrLn "\x1b[m"
26 --command "stack ghci \
28 $(package):$(package)-test \
29 --ghci-options=-fobject-code" \
30 --test '$(GHCID_TEST)'
33 stack $(STACK_FLAGS) clean $(STACK_CLEAN_FLAGS)
35 stack $(STACK_FLAGS) clean --full $(STACK_CLEAN_FLAGS)
37 %/fast: override STACK_BUILD_FLAGS+=--fast
38 %/fast: override STACK_HADDOCK_FLAGS+=--fast
39 %/fast: override STACK_TEST_FLAGS+=--fast
40 %/fast: override QUICKCHECK_TESTS=100
41 %/fast: override QUICKCHECK_MAXSIZE=100
46 stack $(STACK_FLAGS) haddock $(STACK_HADDOCK_FLAGS)
48 markdown $*.md >$*.html
50 sensible-browser $*.html
52 HLint.hs: $(shell find . -name '*.hs' -not -name 'HLint.hs')
53 sed -i -e '/^-- BEGIN: generated hints/,/^-- END: Generated by hlint/d' HLint.hs
54 echo '-- BEGIN: generated hints' >> HLint.hs
55 hlint --find . | grep '^'infix | sort -u >> HLint.hs
56 echo '-- END: generated hints' >> HLint.hs
59 if hlint --quiet --report=hlint.html -XNoCPP \
60 $(shell cabal-cargs --format=ghc --only=default_extensions --sourcefile=$(cabal)) $(HLINT_FLAGS) .; \
61 then rm -f hlint.html; \
62 else sensible-browser hlint.html & fi
65 name=$$(sed -ne 's/^name: *\(.*\)/\1/p' $(cabal)); \
66 version=$$(sed -ne 's/^version: *\(.*\)/\1/p' $(cabal)); \
67 git tag --merged | grep -Fqx "$$name-$$version" || \
68 git tag -f -s -m "$$name v$$version" $$name-$$version
71 stack $(STACK_FLAGS) sdist $(STACK_SDIST_FLAGS)
73 LANG=C stack $(STACK_FLAGS) upload $(STACK_UPLOAD_FLAGS) .
79 sensible-browser stats/index.html