1 PKGS := lib lcc # ledger cli web
2 HS := $(shell find $(PKGS) -name '*.hs')
8 cd $*; stack $(STACK_FLAGS) build $(STACK_BUILD_FLAGS)
9 .PHONY: $(PKGS) $(foreach p,$(PKGS),$(eval $p: $p/build))
13 ! grep -q '^Test-Suite\>' $*/$*.cabal || \
14 { cd $*; stack $(STACK_FLAGS) test $(STACK_TEST_FLAGS); }
16 clean: $(PKGS:=/clean)
17 cleaner: $(PKGS:=/cleaner)
19 cd $*; stack $(STACK_FLAGS) clean $(STACK_CLEAN_FLAGS)
21 cd $*; stack $(STACK_FLAGS) clean --full $(STACK_CLEAN_FLAGS)
23 %/fast: override STACK_BUILD_FLAGS+=--fast
24 %/fast: override STACK_HADDOCK_FLAGS+=--fast
25 %/fast: override STACK_TEST_FLAGS+=--fast
31 cd $*; stack $(STACK_FLAGS) haddock $(STACK_HADDOCK_FLAGS)
34 sed -i -e '/^-- BEGIN: generated hints/,/^-- END: Generated by hlint/d' HLint.hs
35 echo '-- BEGIN: generated hints' >> HLint.hs
36 hlint $(foreach p,$(PKGS),--find $p) | grep '^'infix | sort -u >> HLint.hs
37 echo '-- END: generated hints' >> HLint.hs
39 lint: $(PKGS:=/lint) $(HS)
41 cd $*; if hlint --quiet --report=hlint.html -XNoCPP \
42 $(shell cabal-cargs --format=ghc --only=default_extensions --sourcefile=$*) $(HLINT_FLAGS) .; \
43 then rm -f hlint.html; \
44 else sensible-browser hlint.html & fi
49 name=$$(sed -ne 's/^name: *\(.*\)/\1/p' "$$cabal"); \
50 version=$$(sed -ne 's/^version: *\(.*\)/\1/p' "$$cabal"); \
51 git tag --merged | grep -Fqx "$$name-$$version" || \
52 git tag -f -s -m "$$name v$$version" $$name-$$version
54 upload: $(PKGS:=/upload)
56 cd $*; LANG=C stack $(STACK_FLAGS) sdist --sign
57 cd $*; LANG=C stack $(STACK_FLAGS) upload .
63 sensible-browser stats/index.html