]> Git — Sourcephile - haskell/symantic.git/blob - GNUmakefile
Remove need for space after infix operator.
[haskell/symantic.git] / GNUmakefile
1 PKGS := symantic-grammar symantic-document symantic symantic-lib
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 %.html: %.md
33 markdown $*.md >$*.html
34 %.html/view: %.html
35 sensible-browser $*.html
36
37 HLint.hs: $(HS)
38 sed -i -e '/^-- BEGIN: generated hints/,/^-- END: Generated by hlint/d' HLint.hs
39 echo '-- BEGIN: generated hints' >> HLint.hs
40 hlint $(foreach p,$(PKGS),--find $p) | grep '^'infix | sort -u >> HLint.hs
41 echo '-- END: generated hints' >> HLint.hs
42
43 lint: $(PKGS:=/lint) $(HS)
44 %/lint: HLint.hs
45 cd $*; if hlint --quiet --report=hlint.html -XNoCPP \
46 $(shell cabal-cargs --format=ghc --only=default_extensions --sourcefile=$*) $(HLINT_FLAGS) .; \
47 then rm -f hlint.html; \
48 else sensible-browser hlint.html & fi
49
50 tag: $(PKGS:=/tag)
51 %/tag:
52 cabal=$*/$*.cabal; \
53 name=$$(sed -ne 's/^name: *\(.*\)/\1/p' "$$cabal"); \
54 version=$$(sed -ne 's/^version: *\(.*\)/\1/p' "$$cabal"); \
55 git tag --merged | grep -Fqx "$$name-$$version" || \
56 git tag -f -s -m "$$name v$$version" $$name-$$version
57
58 tar: $(PKGS:=/tar)
59 %/tar:
60 cd $*; stack $(STACK_FLAGS) sdist $(STACK_SDIST_FLAGS)
61 upload: $(PKGS:=/upload)
62 %/upload:
63 cd $*; LANG=C stack $(STACK_FLAGS) upload $(STACK_UPLOAD_FLAGS) .
64
65 .PHONY: stats
66 stats:
67 gitstats . $@
68 stats/view: stats
69 sensible-browser stats/index.html