4 hjugement-protocol/test: TEST_FLAGS:=
6 HS = $(shell find $(PKGS) -name '*.hs' -not -name 'HLint.hs')
7 cabal := $(shell find . -name '*.cabal' -print -quit)
8 QUICKCHECK_TESTS = 1000
9 QUICKCHECK_MAXSIZE = 100
10 TEST_FLAGS = --quickcheck-tests $(QUICKCHECK_TESTS) --quickcheck-max-size $(QUICKCHECK_MAXSIZE)
11 BENCH_HTML_FLAGS = --output benchmarks/html/$(shell sed -ne 's/^version: *\(.*\)/\1/p' $p/$p.cabal).html
15 build: $(PKGS:=/build)
17 cd $* && stack $(STACK_FLAGS) build $(STACK_BUILD_FLAGS)
18 .PHONY: $(PKGS) $(foreach p,$(PKGS),$(eval $p: $p/build))
23 ! grep -iq '^Test-Suite\>' $p/$p.cabal || \
24 { cd $p && stack $$(STACK_FLAGS) test --test-arguments "$$(TEST_FLAGS)" $$(STACK_TEST_FLAGS); }
26 $(foreach p,$(PKGS),$(eval $(call test)))
29 GHCID_TEST ?= ":main $(GHCID_TEST_ARGS)"
30 ghcid: $(PKGS:=/ghcid)
34 --command "stack $(STACK_FLAGS) $(GHCID_STACK_FLAGS) ghci $(GHCID_GHCI_FLAGS) \
35 $$(2>&1 stack ide targets | grep -v :test:) \
36 --ghci-options=-fobject-code" \
37 --test $(GHCID_TEST) \
40 bench: $(PKGS:=/bench)
43 mkdir -p $p/benchmarks/html
44 ! grep -iq '^Benchmark\>' $p/$p.cabal || \
45 { cd $p && stack $$(STACK_FLAGS) bench \
46 --benchmark-arguments "$(call BENCH_HTML_FLAGS) $$(BENCH_FLAGS)" \
47 $$(STACK_BENCH_FLAGS); }
49 $(foreach p,$(PKGS),$(eval $(call bench)))
51 clean: $(PKGS:=/clean)
52 cleaner: $(PKGS:=/cleaner)
54 cd $* && stack $(STACK_FLAGS) clean $(STACK_CLEAN_FLAGS)
56 cd $* && stack $(STACK_FLAGS) clean --full $(STACK_CLEAN_FLAGS)
58 %/quickcheck: override QUICKCHECK_TESTS=10000
59 %/quickcheck: override QUICKCHECK_MAXSIZE=1000
62 %/fast: override STACK_BUILD_FLAGS+=--fast
63 %/fast: override STACK_HADDOCK_FLAGS+=--fast
64 %/fast: override STACK_TEST_FLAGS+=--fast
65 %/fast: override QUICKCHECK_TESTS=100
66 %/fast: override QUICKCHECK_MAXSIZE=100
70 %/debug: override STACK_BUILD_FLAGS+=--flag $(cabal:.cabal=):debug
71 %/debug: override STACK_TEST_FLAGS+=--flag $(cabal:.cabal=):debug
75 %/accept: override STACK_TEST_ARGS+=--accept
81 cd $* && stack $(STACK_FLAGS) haddock $(STACK_HADDOCK_FLAGS)
83 markdown $*.md >$*.html
85 sensible-browser $*.html
88 sed -i -e '/^-- BEGIN: generated hints/,/^-- END: Generated by hlint/d' HLint.hs
89 echo '-- BEGIN: generated hints' >> HLint.hs
90 hlint $(foreach p,$(PKGS),--find $p) | sed -ne 's/^- infix: \(.*\)/\1/p' | sort -u >>HLint.hs
91 echo '-- END: generated hints' >> HLint.hs
93 lint: $(PKGS:=/lint) $(HS)
95 cd $* && if hlint --quiet --report=hlint.html -XNoCPP \
96 $(shell cabal-cargs --format=ghc --only=default_extensions --sourcefile=$*) $(HLINT_FLAGS) .; \
97 then rm -f hlint.html; \
98 else sensible-browser ./hlint.html & fi
103 name=$$(sed -ne 's/^name: *\(.*\)/\1/p' "$$cabal"); \
104 version=$$(sed -ne 's/^version: *\(.*\)/\1/p' "$$cabal"); \
105 git tag --merged | grep -Fqx "$$name-$$version" || \
106 git tag -f -s -m "$$name v$$version" $$name-$$version
110 cd $* && stack $(STACK_FLAGS) sdist $(STACK_SDIST_FLAGS)
111 upload: $(PKGS:=/upload)
113 cd $* && LANG=C stack $(STACK_FLAGS) upload $(STACK_UPLOAD_FLAGS) .
119 sensible-browser stats/index.html