]> Git — Sourcephile - comptalang.git/blob - GNUmakefile
Remove cli/
[comptalang.git] / GNUmakefile
1 PKGS := lib lcc # ledger cli web
2 HS := $(shell find $(PKGS) -name '*.hs')
3
4 all: build
5
6 build: $(PKGS:=/build)
7 %/build:
8 cd $*; stack $(STACK_FLAGS) build $(STACK_BUILD_FLAGS)
9 .PHONY: $(PKGS) $(foreach p,$(PKGS),$(eval $p: $p/build))
10
11 test: $(PKGS:=/test)
12 %/test:
13 ! grep -q '^Test-Suite\>' $*/$*.cabal || \
14 { cd $*; stack $(STACK_FLAGS) test $(STACK_TEST_FLAGS); }
15
16 clean: $(PKGS:=/clean)
17 cleaner: $(PKGS:=/cleaner)
18 %/clean:
19 cd $*; stack $(STACK_FLAGS) clean $(STACK_CLEAN_FLAGS)
20 %/cleaner:
21 cd $*; stack $(STACK_FLAGS) clean --full $(STACK_CLEAN_FLAGS)
22
23 %/fast: override STACK_BUILD_FLAGS+=--fast
24 %/fast: override STACK_HADDOCK_FLAGS+=--fast
25 %/fast: override STACK_TEST_FLAGS+=--fast
26 %/fast: %
27
28
29 doc: $(PKGS:=/doc)
30 %/doc:
31 cd $*; stack $(STACK_FLAGS) haddock $(STACK_HADDOCK_FLAGS)
32
33 HLint.hs: $(HS)
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
38
39 lint: $(PKGS:=/lint) $(HS)
40 %/lint: HLint.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
45
46 tag: $(PKGS:=/tag)
47 %/tag:
48 cabal=$*/$*.cabal; \
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
53
54 upload: $(PKGS:=/upload)
55 %/upload:
56 cd $*; LANG=C stack $(STACK_FLAGS) sdist --sign
57 cd $*; LANG=C stack $(STACK_FLAGS) upload .
58
59 .PHONY: stats
60 stats:
61 gitstats . $@
62 stats/view: stats
63 sensible-browser stats/index.html