1 cabal := $(shell find . -name '*.cabal' -print -quit)
2 package := $(notdir ./$(cabal:.cabal=))
7 stack $(STACK_FLAGS) build $(STACK_BUILD_FLAGS)
11 ! grep -q '^Test-Suite\>' $(cabal) || \
12 { stack $(STACK_FLAGS) test $(STACK_TEST_FLAGS); }
14 QUICKCHECK_FLAGS ?= --quickcheck-tests 10000 --quickcheck-max-size 1000
15 %/quickcheck: STACK_TEST_FLAGS:=--test-arguments "$(QUICKCHECK_FLAGS)"
19 GHCID_TEST ?= "System.Environment.withArgs (words \"--color always\") main \`Control.Exception.finally\` putStrLn \"\x1b[m\""
23 --command "stack ghci \
25 $(package):$(package)-test \
26 --ghci-options=-fobject-code" \
30 stack $(STACK_FLAGS) clean $(STACK_CLEAN_FLAGS)
32 stack $(STACK_FLAGS) clean --full $(STACK_CLEAN_FLAGS)
34 %/fast: override STACK_BUILD_FLAGS+=--fast
35 %/fast: override STACK_HADDOCK_FLAGS+=--fast
36 %/fast: override STACK_TEST_FLAGS+=--fast
41 stack $(STACK_FLAGS) haddock $(STACK_HADDOCK_FLAGS)
43 markdown $*.md >$*.html
45 sensible-browser $*.html
47 HLint.hs: $(shell find . -name '*.hs' -not -name 'HLint.hs')
48 sed -i -e '/^-- BEGIN: generated hints/,/^-- END: Generated by hlint/d' HLint.hs
49 echo '-- BEGIN: generated hints' >> HLint.hs
50 hlint --find . | grep '^'infix | sort -u >> HLint.hs
51 echo '-- END: generated hints' >> HLint.hs
54 if hlint --quiet --report=hlint.html -XNoCPP \
55 $(shell cabal-cargs --format=ghc --only=default_extensions --sourcefile=$(cabal)) $(HLINT_FLAGS) .; \
56 then rm -f hlint.html; \
57 else sensible-browser hlint.html & fi
60 name=$$(sed -ne 's/^name: *\(.*\)/\1/p' $(cabal)); \
61 version=$$(sed -ne 's/^version: *\(.*\)/\1/p' $(cabal)); \
62 git tag --merged | grep -Fqx "$$name-$$version" || \
63 git tag -f -s -m "$$name v$$version" $$name-$$version
66 stack $(STACK_FLAGS) sdist $(STACK_SDIST_FLAGS)
68 LANG=C stack $(STACK_FLAGS) upload $(STACK_UPLOAD_FLAGS) .
74 sensible-browser stats/index.html