3 HS = $(shell find . -name '*.hs' -not -name 'HLint.hs')
4 cabal := $(shell find . -name '*.cabal' -print -quit)
5 QUICKCHECK_TESTS = 1000
6 QUICKCHECK_MAXSIZE = 100
7 TEST_FLAGS = --quickcheck-tests $(QUICKCHECK_TESTS) --quickcheck-max-size $(QUICKCHECK_MAXSIZE)
11 build: $(PKGS:=/build)
13 cd $* && stack $(STACK_FLAGS) build $(STACK_BUILD_FLAGS)
14 .PHONY: $(PKGS) $(foreach p,$(PKGS),$(eval $p: $p/build))
16 .PHONY: $(PKGS:=/test)
20 ! grep -q '^Test-Suite\>' $p/$p.cabal || \
21 { cd $p && stack $$(STACK_FLAGS) test --test-arguments "$$(TEST_FLAGS)" $$(STACK_TEST_FLAGS); }
23 $(foreach p,$(PKGS),$(eval $(call test)))
26 GHCID_TEST ?= ":main $(GHCID_TEST_ARGS)"
27 ghcid: $(PKGS:=/ghcid)
31 --command "stack $(STACK_FLAGS) $(GHCID_STACK_FLAGS) ghci $(GHCID_GHCI_FLAGS) \
32 $$(2>&1 stack ide targets | grep -v :test:) \
33 --ghci-options=-fobject-code" \
34 --test $(GHCID_TEST) \
37 clean: $(PKGS:=/clean)
38 cleaner: $(PKGS:=/cleaner)
40 cd $* && stack $(STACK_FLAGS) clean $(STACK_CLEAN_FLAGS)
42 cd $* && stack $(STACK_FLAGS) clean --full $(STACK_CLEAN_FLAGS)
44 %/quickcheck: override QUICKCHECK_TESTS=10000
45 %/quickcheck: override QUICKCHECK_MAXSIZE=1000
48 %/fast: override STACK_BUILD_FLAGS+=--fast
49 %/fast: override STACK_HADDOCK_FLAGS+=--fast
50 %/fast: override STACK_TEST_FLAGS+=--fast
51 %/fast: override QUICKCHECK_TESTS=100
52 %/fast: override QUICKCHECK_MAXSIZE=100
56 %/debug: override STACK_BUILD_FLAGS+=--flag $(cabal:.cabal=):debug
57 %/debug: override STACK_TEST_FLAGS+=--flag $(cabal:.cabal=):debug
61 %/accept: override STACK_TEST_ARGS+=--accept
67 cd $* && stack $(STACK_FLAGS) haddock $(STACK_HADDOCK_FLAGS)
69 markdown $*.md >$*.html
71 sensible-browser $*.html
74 sed -i -e '/^-- BEGIN: generated hints/,/^-- END: Generated by hlint/d' HLint.hs
75 echo '-- BEGIN: generated hints' >> HLint.hs
76 hlint $(foreach p,$(PKGS),--find $p) | grep '^'infix | sort -u >> HLint.hs
77 echo '-- END: generated hints' >> HLint.hs
79 lint: $(PKGS:=/lint) $(HS)
81 cd $* && if hlint --quiet --report=hlint.html -XNoCPP \
82 $(shell cabal-cargs --format=ghc --only=default_extensions --sourcefile=$*) $(HLINT_FLAGS) .; \
83 then rm -f hlint.html; \
84 else sensible-browser ./hlint.html & fi
89 name=$$(sed -ne 's/^name: *\(.*\)/\1/p' "$$cabal"); \
90 version=$$(sed -ne 's/^version: *\(.*\)/\1/p' "$$cabal"); \
91 git tag --merged | grep -Fqx "$$name-$$version" || \
92 git tag -f -s -m "$$name v$$version" $$name-$$version
96 cd $* && stack $(STACK_FLAGS) sdist $(STACK_SDIST_FLAGS)
97 upload: $(PKGS:=/upload)
99 cd $* && LANG=C stack $(STACK_FLAGS) upload $(STACK_UPLOAD_FLAGS) .
105 sensible-browser stats/index.html