5 hjugement-protocol/test: TEST_FLAGS:=
7 HS = $(shell find $(PKGS) -name '*.hs' -not -name 'HLint.hs')
8 cabal := $(shell find . -name '*.cabal' -print -quit)
9 QUICKCHECK_TESTS = 1000
10 QUICKCHECK_MAXSIZE = 100
11 TEST_FLAGS = --quickcheck-tests $(QUICKCHECK_TESTS) --quickcheck-max-size $(QUICKCHECK_MAXSIZE)
12 BENCH_HTML_FLAGS = --output benchmarks/html/$(shell sed -ne 's/^version: *\(.*\)/\1/p' $p/$p.cabal).html
16 build: $(PKGS:=/build)
18 cd $* && stack $(STACK_FLAGS) build $(STACK_BUILD_FLAGS)
19 .PHONY: $(PKGS) $(foreach p,$(PKGS),$(eval $p: $p/build))
24 ! grep -iq '^Test-Suite\>' $p/$p.cabal || \
25 { cd $p && stack $$(STACK_FLAGS) test --test-arguments "$$(TEST_FLAGS)" $$(STACK_TEST_FLAGS); }
27 $(foreach p,$(PKGS),$(eval $(call test)))
30 GHCID_TEST ?= ":main $(GHCID_TEST_ARGS)"
31 ghcid: $(PKGS:=/ghcid)
35 --command "stack $(STACK_FLAGS) $(GHCID_STACK_FLAGS) ghci $(GHCID_GHCI_FLAGS) \
36 $$(2>&1 stack ide targets | grep -v :test:) \
37 --ghci-options=-fobject-code" \
38 --test $(GHCID_TEST) \
41 bench: $(PKGS:=/bench)
44 mkdir -p $p/benchmarks/html
45 ! grep -iq '^Benchmark\>' $p/$p.cabal || \
46 { cd $p && stack $$(STACK_FLAGS) bench \
47 --benchmark-arguments "$(call BENCH_HTML_FLAGS) $$(BENCH_FLAGS)" \
48 $$(STACK_BENCH_FLAGS); }
50 $(foreach p,$(PKGS),$(eval $(call bench)))
52 clean: $(PKGS:=/clean)
53 cleaner: $(PKGS:=/cleaner)
55 cd $* && stack $(STACK_FLAGS) clean $(STACK_CLEAN_FLAGS)
57 cd $* && stack $(STACK_FLAGS) clean --full $(STACK_CLEAN_FLAGS)
59 %/quickcheck: override QUICKCHECK_TESTS=10000
60 %/quickcheck: override QUICKCHECK_MAXSIZE=1000
63 %/fast: override STACK_BUILD_FLAGS+=--fast
64 %/fast: override STACK_HADDOCK_FLAGS+=--fast
65 %/fast: override STACK_TEST_FLAGS+=--fast
66 %/fast: override QUICKCHECK_TESTS=100
67 %/fast: override QUICKCHECK_MAXSIZE=100
71 %/debug: override STACK_BUILD_FLAGS+=--flag $(cabal:.cabal=):debug
72 %/debug: override STACK_TEST_FLAGS+=--flag $(cabal:.cabal=):debug
76 %/accept: override STACK_TEST_ARGS+=--accept
82 cd $* && stack $(STACK_FLAGS) haddock $(STACK_HADDOCK_FLAGS)
84 markdown $*.md >$*.html
86 sensible-browser $*.html
89 sed -i -e '/^-- BEGIN: generated hints/,/^-- END: Generated by hlint/d' HLint.hs
90 echo '-- BEGIN: generated hints' >> HLint.hs
91 hlint $(foreach p,$(PKGS),--find $p) | sed -ne 's/^- infix: \(.*\)/\1/p' | sort -u >>HLint.hs
92 echo '-- END: generated hints' >> HLint.hs
94 lint: $(PKGS:=/lint) $(HS)
96 cd $* && if hlint --quiet --report=hlint.html -XNoCPP \
97 $(shell cabal-cargs --format=ghc --only=default_extensions --sourcefile=$*) $(HLINT_FLAGS) .; \
98 then rm -f hlint.html; \
99 else sensible-browser ./hlint.html & fi
104 name=$$(sed -ne 's/^name: *\(.*\)/\1/p' "$$cabal"); \
105 version=$$(sed -ne 's/^version: *\(.*\)/\1/p' "$$cabal"); \
106 git tag --merged | grep -Fqx "$$name-$$version" || \
107 git tag -f -s -m "$$name v$$version" $$name-$$version
111 cd $* && stack $(STACK_FLAGS) sdist $(STACK_SDIST_FLAGS)
112 upload: $(PKGS:=/upload)
114 cd $* && LANG=C stack $(STACK_FLAGS) upload $(STACK_UPLOAD_FLAGS) .
120 sensible-browser stats/index.html