4 HS = $(shell find . -name '*.hs' -not -name 'HLint.hs')
5 cabal := $(shell find . -name '*.cabal' -print -quit)
6 QUICKCHECK_TESTS = 1000
7 QUICKCHECK_MAXSIZE = 100
8 TEST_FLAGS = --quickcheck-tests $(QUICKCHECK_TESTS) --quickcheck-max-size $(QUICKCHECK_MAXSIZE)
12 build: $(PKGS:=/build)
14 cd $* && stack $(STACK_FLAGS) build $(STACK_BUILD_FLAGS)
15 .PHONY: $(PKGS) $(foreach p,$(PKGS),$(eval $p: $p/build))
17 .PHONY: $(PKGS:=/test)
21 ! grep -q '^Test-Suite\>' $p/$p.cabal || \
22 { cd $p && stack $$(STACK_FLAGS) test --test-arguments "$$(TEST_FLAGS)" $$(STACK_TEST_FLAGS); }
24 $(foreach p,$(PKGS),$(eval $(call test)))
27 GHCID_TEST ?= ":main $(GHCID_TEST_ARGS)"
28 ghcid: $(PKGS:=/ghcid)
32 --command "stack $(STACK_FLAGS) $(GHCID_STACK_FLAGS) ghci $(GHCID_GHCI_FLAGS) \
33 $$(2>&1 stack ide targets | grep -v :test:) \
34 --ghci-options=-fobject-code" \
35 --test $(GHCID_TEST) \
38 clean: $(PKGS:=/clean)
39 cleaner: $(PKGS:=/cleaner)
41 cd $* && stack $(STACK_FLAGS) clean $(STACK_CLEAN_FLAGS)
43 cd $* && stack $(STACK_FLAGS) clean --full $(STACK_CLEAN_FLAGS)
45 %/quickcheck: override QUICKCHECK_TESTS=10000
46 %/quickcheck: override QUICKCHECK_MAXSIZE=1000
49 %/fast: override STACK_BUILD_FLAGS+=--fast
50 %/fast: override STACK_HADDOCK_FLAGS+=--fast
51 %/fast: override STACK_TEST_FLAGS+=--fast
52 %/fast: override QUICKCHECK_TESTS=100
53 %/fast: override QUICKCHECK_MAXSIZE=100
57 %/debug: override STACK_BUILD_FLAGS+=--flag $(cabal:.cabal=):debug
58 %/debug: override STACK_TEST_FLAGS+=--flag $(cabal:.cabal=):debug
62 %/accept: override STACK_TEST_ARGS+=--accept
68 cd $* && stack $(STACK_FLAGS) haddock $(STACK_HADDOCK_FLAGS)
70 markdown $*.md >$*.html
72 sensible-browser $*.html
75 sed -i -e '/^-- BEGIN: generated hints/,/^-- END: Generated by hlint/d' HLint.hs
76 echo '-- BEGIN: generated hints' >> HLint.hs
77 hlint $(foreach p,$(PKGS),--find $p) | grep '^'infix | sort -u >> HLint.hs
78 echo '-- END: generated hints' >> HLint.hs
80 lint: $(PKGS:=/lint) $(HS)
82 cd $* && if hlint --quiet --report=hlint.html -XNoCPP \
83 $(shell cabal-cargs --format=ghc --only=default_extensions --sourcefile=$*) $(HLINT_FLAGS) .; \
84 then rm -f hlint.html; \
85 else sensible-browser ./hlint.html & fi
90 name=$$(sed -ne 's/^name: *\(.*\)/\1/p' "$$cabal"); \
91 version=$$(sed -ne 's/^version: *\(.*\)/\1/p' "$$cabal"); \
92 git tag --merged | grep -Fqx "$$name-$$version" || \
93 git tag -f -s -m "$$name v$$version" $$name-$$version
97 cd $* && stack $(STACK_FLAGS) sdist $(STACK_SDIST_FLAGS)
98 upload: $(PKGS:=/upload)
100 cd $* && LANG=C stack $(STACK_FLAGS) upload $(STACK_UPLOAD_FLAGS) .
106 sensible-browser stats/index.html