9 HS = $(shell find $(PKGS) -name '*.hs' -not -name 'HLint.hs')
10 cabal := $(shell find . -name '*.cabal' -print -quit)
11 QUICKCHECK_TESTS = 1000
12 QUICKCHECK_MAXSIZE = 100
13 TEST_FLAGS = --quickcheck-tests $(QUICKCHECK_TESTS) --quickcheck-max-size $(QUICKCHECK_MAXSIZE)
17 build: $(PKGS:=/build)
19 cd $* && stack $(STACK_FLAGS) build $(STACK_BUILD_FLAGS)
20 .PHONY: $(PKGS) $(foreach p,$(PKGS),$(eval $p: $p/build))
22 .PHONY: $(PKGS:=/test)
26 ! grep -q '^Test-Suite\>' $p/$p.cabal || \
27 { cd $p && stack $$(STACK_FLAGS) test --test-arguments "$$(TEST_FLAGS)" $$(STACK_TEST_FLAGS); }
29 $(foreach p,$(PKGS),$(eval $(call test)))
32 GHCID_TEST ?= ":main $(GHCID_TEST_ARGS)"
33 ghcid: $(PKGS:=/ghcid)
37 --command "stack $(STACK_FLAGS) $(GHCID_STACK_FLAGS) ghci $(GHCID_GHCI_FLAGS) \
38 $$(2>&1 stack ide targets | grep -v :test:) \
39 --ghci-options=-fobject-code" \
40 --test $(GHCID_TEST) \
43 clean: $(PKGS:=/clean)
44 cleaner: $(PKGS:=/cleaner)
46 cd $* && stack $(STACK_FLAGS) clean $(STACK_CLEAN_FLAGS)
48 cd $* && stack $(STACK_FLAGS) clean --full $(STACK_CLEAN_FLAGS)
50 %/quickcheck: override QUICKCHECK_TESTS=10000
51 %/quickcheck: override QUICKCHECK_MAXSIZE=1000
54 %/fast: override STACK_BUILD_FLAGS+=--fast
55 %/fast: override STACK_HADDOCK_FLAGS+=--fast
56 %/fast: override STACK_TEST_FLAGS+=--fast
57 %/fast: override QUICKCHECK_TESTS=100
58 %/fast: override QUICKCHECK_MAXSIZE=100
62 %/debug: override STACK_BUILD_FLAGS+=--flag $(cabal:.cabal=):debug
63 %/debug: override STACK_TEST_FLAGS+=--flag $(cabal:.cabal=):debug
67 %/accept: override STACK_TEST_ARGS+=--accept
73 cd $* && stack $(STACK_FLAGS) haddock $(STACK_HADDOCK_FLAGS)
75 markdown $*.md >$*.html
77 sensible-browser $*.html
80 sed -i -e '/^-- BEGIN: generated hints/,/^-- END: Generated by hlint/d' HLint.hs
81 echo '-- BEGIN: generated hints' >> HLint.hs
82 hlint $(foreach p,$(PKGS),--find $p) | sed -ne 's/^- infix: \(.*\)/\1/p' | sort -u >>HLint.hs
83 echo '-- END: generated hints' >> HLint.hs
85 lint: $(PKGS:=/lint) $(HS)
87 cd $* && if hlint --quiet --report=hlint.html -XNoCPP \
88 $(shell cabal-cargs --format=ghc --only=default_extensions --sourcefile=$*) $(HLINT_FLAGS) .; \
89 then rm -f hlint.html; \
90 else sensible-browser ./hlint.html & fi
95 name=$$(sed -ne 's/^name: *\(.*\)/\1/p' "$$cabal"); \
96 version=$$(sed -ne 's/^version: *\(.*\)/\1/p' "$$cabal"); \
97 git tag --merged | grep -Fqx "$$name-$$version" || \
98 git tag -f -s -m "$$name v$$version" $$name-$$version
102 cd $* && stack $(STACK_FLAGS) sdist $(STACK_SDIST_FLAGS)
103 upload: $(PKGS:=/upload)
105 cd $* && LANG=C stack $(STACK_FLAGS) upload $(STACK_UPLOAD_FLAGS) .
111 sensible-browser stats/index.html