9 HS = $(shell find . -name '*.hs' -not -name 'HLint.hs')
10 cabal := $(shell find . -name '*.cabal' -print -quit)
14 build: $(PKGS:=/build)
16 cd $* && stack $(STACK_FLAGS) build $(STACK_BUILD_FLAGS)
17 .PHONY: $(PKGS) $(foreach p,$(PKGS),$(eval $p: $p/build))
19 .PHONY: $(PKGS:=/test)
23 ! grep -q '^Test-Suite\>' $p/$p.cabal || \
24 { cd $p && stack $$(STACK_FLAGS) test $$(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 clean: $(PKGS:=/clean)
41 cleaner: $(PKGS:=/cleaner)
43 cd $* && stack $(STACK_FLAGS) clean $(STACK_CLEAN_FLAGS)
45 cd $* && stack $(STACK_FLAGS) clean --full $(STACK_CLEAN_FLAGS)
47 %/fast: override STACK_BUILD_FLAGS+=--fast
48 %/fast: override STACK_HADDOCK_FLAGS+=--fast
49 %/fast: override STACK_TEST_FLAGS+=--fast
53 %/debug: override STACK_BUILD_FLAGS+=--flag $(cabal:.cabal=):debug
54 %/debug: override STACK_TEST_FLAGS+=--flag $(cabal:.cabal=):debug
58 %/accept: override STACK_TEST_ARGS+=--accept
64 cd $* && stack $(STACK_FLAGS) haddock $(STACK_HADDOCK_FLAGS)
66 markdown $*.md >$*.html
68 sensible-browser $*.html
71 sed -i -e '/^-- BEGIN: generated hints/,/^-- END: Generated by hlint/d' HLint.hs
72 echo '-- BEGIN: generated hints' >> HLint.hs
73 hlint $(foreach p,$(PKGS),--find $p) | grep '^'infix | sort -u >> HLint.hs
74 echo '-- END: generated hints' >> HLint.hs
76 lint: $(PKGS:=/lint) $(HS)
78 cd $* && if hlint --quiet --report=hlint.html -XNoCPP \
79 $(shell cabal-cargs --format=ghc --only=default_extensions --sourcefile=$*) $(HLINT_FLAGS) .; \
80 then rm -f hlint.html; \
81 else sensible-browser ./hlint.html & fi
86 name=$$(sed -ne 's/^name: *\(.*\)/\1/p' "$$cabal"); \
87 version=$$(sed -ne 's/^version: *\(.*\)/\1/p' "$$cabal"); \
88 git tag --merged | grep -Fqx "$$name-$$version" || \
89 git tag -f -s -m "$$name v$$version" $$name-$$version
93 cd $* && stack $(STACK_FLAGS) sdist $(STACK_SDIST_FLAGS)
94 upload: $(PKGS:=/upload)
96 cd $* && LANG=C stack $(STACK_FLAGS) upload $(STACK_UPLOAD_FLAGS) .
102 sensible-browser stats/index.html