8 HS = $(shell find . -name '*.hs' -not -name 'HLint.hs')
9 cabal := $(shell find . -name '*.cabal' -print -quit)
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 $$(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 %/fast: override STACK_BUILD_FLAGS+=--fast
47 %/fast: override STACK_HADDOCK_FLAGS+=--fast
48 %/fast: override STACK_TEST_FLAGS+=--fast
52 %/debug: override STACK_BUILD_FLAGS+=--flag $(cabal:.cabal=):debug
53 %/debug: override STACK_TEST_FLAGS+=--flag $(cabal:.cabal=):debug
57 %/accept: override STACK_TEST_ARGS+=--accept
63 cd $* && stack $(STACK_FLAGS) haddock $(STACK_HADDOCK_FLAGS)
65 markdown $*.md >$*.html
67 sensible-browser $*.html
70 sed -i -e '/^-- BEGIN: generated hints/,/^-- END: Generated by hlint/d' HLint.hs
71 echo '-- BEGIN: generated hints' >> HLint.hs
72 hlint $(foreach p,$(PKGS),--find $p) | grep '^'infix | sort -u >> HLint.hs
73 echo '-- END: generated hints' >> HLint.hs
75 lint: $(PKGS:=/lint) $(HS)
77 cd $* && if hlint --quiet --report=hlint.html -XNoCPP \
78 $(shell cabal-cargs --format=ghc --only=default_extensions --sourcefile=$*) $(HLINT_FLAGS) .; \
79 then rm -f hlint.html; \
80 else sensible-browser ./hlint.html & fi
85 name=$$(sed -ne 's/^name: *\(.*\)/\1/p' "$$cabal"); \
86 version=$$(sed -ne 's/^version: *\(.*\)/\1/p' "$$cabal"); \
87 git tag --merged | grep -Fqx "$$name-$$version" || \
88 git tag -f -s -m "$$name v$$version" $$name-$$version
92 cd $* && stack $(STACK_FLAGS) sdist $(STACK_SDIST_FLAGS)
93 upload: $(PKGS:=/upload)
95 cd $* && LANG=C stack $(STACK_FLAGS) upload $(STACK_UPLOAD_FLAGS) .
101 sensible-browser stats/index.html