4 hjugement-protocol/test: TEST_FLAGS:=
5 HS = $(shell find . -name '*.hs' -not -name 'HLint.hs')
6 cabal := $(shell find . -name '*.cabal' -print -quit)
7 QUICKCHECK_TESTS = 1000
8 QUICKCHECK_MAXSIZE = 100
9 TEST_FLAGS = --quickcheck-tests $(QUICKCHECK_TESTS) --quickcheck-max-size $(QUICKCHECK_MAXSIZE)
13 build: $(PKGS:=/build)
15 cd $* && stack $(STACK_FLAGS) build $(STACK_BUILD_FLAGS)
16 .PHONY: $(PKGS) $(foreach p,$(PKGS),$(eval $p: $p/build))
18 .PHONY: $(PKGS:=/test)
22 ! grep -q '^Test-Suite\>' $p/$p.cabal || \
23 { cd $p && stack $$(STACK_FLAGS) test --test-arguments "$$(TEST_FLAGS)" $$(STACK_TEST_FLAGS); }
25 $(foreach p,$(PKGS),$(eval $(call test)))
28 GHCID_TEST ?= ":main $(GHCID_TEST_ARGS)"
29 ghcid: $(PKGS:=/ghcid)
33 --command "stack $(STACK_FLAGS) $(GHCID_STACK_FLAGS) ghci $(GHCID_GHCI_FLAGS) \
34 $$(2>&1 stack ide targets | grep -v :test:) \
35 --ghci-options=-fobject-code" \
36 --test $(GHCID_TEST) \
39 clean: $(PKGS:=/clean)
40 cleaner: $(PKGS:=/cleaner)
42 cd $* && stack $(STACK_FLAGS) clean $(STACK_CLEAN_FLAGS)
44 cd $* && stack $(STACK_FLAGS) clean --full $(STACK_CLEAN_FLAGS)
46 %/quickcheck: override QUICKCHECK_TESTS=10000
47 %/quickcheck: override QUICKCHECK_MAXSIZE=1000
50 %/fast: override STACK_BUILD_FLAGS+=--fast
51 %/fast: override STACK_HADDOCK_FLAGS+=--fast
52 %/fast: override STACK_TEST_FLAGS+=--fast
53 %/fast: override QUICKCHECK_TESTS=100
54 %/fast: override QUICKCHECK_MAXSIZE=100
58 %/debug: override STACK_BUILD_FLAGS+=--flag $(cabal:.cabal=):debug
59 %/debug: override STACK_TEST_FLAGS+=--flag $(cabal:.cabal=):debug
63 %/accept: override STACK_TEST_ARGS+=--accept
69 cd $* && stack $(STACK_FLAGS) haddock $(STACK_HADDOCK_FLAGS)
71 markdown $*.md >$*.html
73 sensible-browser $*.html
76 sed -i -e '/^-- BEGIN: generated hints/,/^-- END: Generated by hlint/d' HLint.hs
77 echo '-- BEGIN: generated hints' >> HLint.hs
78 hlint $(foreach p,$(PKGS),--find $p) | grep '^'infix | sort -u >> HLint.hs
79 echo '-- END: generated hints' >> HLint.hs
81 lint: $(PKGS:=/lint) $(HS)
83 cd $* && if hlint --quiet --report=hlint.html -XNoCPP \
84 $(shell cabal-cargs --format=ghc --only=default_extensions --sourcefile=$*) $(HLINT_FLAGS) .; \
85 then rm -f hlint.html; \
86 else sensible-browser ./hlint.html & fi
91 name=$$(sed -ne 's/^name: *\(.*\)/\1/p' "$$cabal"); \
92 version=$$(sed -ne 's/^version: *\(.*\)/\1/p' "$$cabal"); \
93 git tag --merged | grep -Fqx "$$name-$$version" || \
94 git tag -f -s -m "$$name v$$version" $$name-$$version
98 cd $* && stack $(STACK_FLAGS) sdist $(STACK_SDIST_FLAGS)
99 upload: $(PKGS:=/upload)
101 cd $* && LANG=C stack $(STACK_FLAGS) upload $(STACK_UPLOAD_FLAGS) .
107 sensible-browser stats/index.html