1 cabal := $(shell find . -name '*.cabal' -print -quit)
2 package := $(notdir ./$(cabal:.cabal=))
3 #package := $(shell 2>&1 stack ide packages)
9 stack $(STACK_FLAGS) build $(STACK_BUILD_FLAGS)
13 ! grep -q '^Test-Suite\>' $(cabal) || \
14 { stack $(STACK_FLAGS) test $(STACK_TEST_FLAGS) --test-arguments "$(STACK_TEST_ARGS)"; }
17 GHCID_TEST ?= ":main --color always $(GHCID_TEST_ARGS)"
19 ghcid --color=always \
21 --command "stack $(STACK_FLAGS) $(GHCID_STACK_FLAGS) ghci $(GHCID_GHCI_FLAGS) --test \
22 $(shell 2>&1 stack ide targets) \
23 --ghci-options=-fobject-code" \
24 --test $(GHCID_TEST) \
28 stack $(STACK_FLAGS) clean $(STACK_CLEAN_FLAGS)
30 stack $(STACK_FLAGS) clean --full $(STACK_CLEAN_FLAGS)
32 %/fast: override STACK_BUILD_FLAGS+=--fast
33 %/fast: override STACK_HADDOCK_FLAGS+=--fast
34 %/fast: override STACK_TEST_FLAGS+=--fast
38 %/debug: override STACK_BUILD_FLAGS+=--flag $(cabal:.cabal=):debug
39 %/debug: override STACK_TEST_FLAGS+=--flag $(cabal:.cabal=):debug
43 %/accept: override STACK_TEST_ARGS+=--accept
48 stack $(STACK_FLAGS) haddock $(STACK_HADDOCK_FLAGS)
50 markdown $*.md >$*.html
52 sensible-browser $*.html
54 HLint.hs: $(shell find . -name '*.hs' -not -name 'HLint.hs')
55 sed -i -e '/^-- BEGIN: generated hints/,/^-- END: Generated by hlint/d' HLint.hs
56 echo '-- BEGIN: generated hints' >> HLint.hs
57 hlint --find . | sed -ne 's/^- infix: \(.*\)/\1/p' | sort -u >>HLint.hs
58 echo '-- END: generated hints' >> HLint.hs
61 if hlint --quiet --report=hlint.html -XNoCPP \
62 $(shell cabal-cargs --format=ghc --only=default_extensions --sourcefile=$(cabal)) $(HLINT_FLAGS) .; \
63 then rm -f hlint.html; \
64 else sensible-browser ./hlint.html & fi
67 name=$$(sed -ne 's/^name: *\(.*\)/\1/p' "$(cabal)"); \
68 version=$$(sed -ne 's/^version: *\(.*\)/\1/p' "$(cabal)"); \
69 git tag --merged | grep -Fqx "$$name-$$version" || \
70 git tag -f -s -m "$$name v$$version" $$name-$$version
73 stack $(STACK_FLAGS) sdist $(STACK_SDIST_FLAGS)
75 LANG=C stack $(STACK_FLAGS) upload $(STACK_UPLOAD_FLAGS) .
81 sensible-browser stats/index.html