]> Git — Sourcephile - haskell/symantic-http.git/blob - GNUmakefile
Add symantic-http-doc
[haskell/symantic-http.git] / GNUmakefile
1 PKGS := \
2 symantic-http \
3 symantic-http-server \
4 symantic-http-client \
5 symantic-http-doc \
6 symantic-http-pipes \
7 symantic-http-test \
8 symantic-http-demo
9 HS = $(shell find . -name '*.hs' -not -name 'HLint.hs')
10 cabal := $(shell find . -name '*.cabal' -print -quit)
11
12 all: build
13
14 build: $(PKGS:=/build)
15 %/build:
16 cd $* && stack $(STACK_FLAGS) build $(STACK_BUILD_FLAGS)
17 .PHONY: $(PKGS) $(foreach p,$(PKGS),$(eval $p: $p/build))
18
19 .PHONY: $(PKGS:=/test)
20 test: $(PKGS:=/test)
21 define test
22 $p/test:
23 ! grep -q '^Test-Suite\>' $p/$p.cabal || \
24 { cd $p && stack $$(STACK_FLAGS) test $$(STACK_TEST_FLAGS); }
25 endef
26 $(foreach p,$(PKGS),$(eval $(call test)))
27
28 GHCID_TEST_ARGS ?=
29 GHCID_TEST ?= ":main $(GHCID_TEST_ARGS)"
30 ghcid: $(PKGS:=/ghcid)
31 %/ghcid:
32 cd $* && ghcid \
33 --warnings \
34 --command "stack $(STACK_FLAGS) $(GHCID_STACK_FLAGS) ghci $(GHCID_GHCI_FLAGS) \
35 $$(2>&1 stack ide targets | grep -v :test:) \
36 --ghci-options=-fobject-code" \
37 --test $(GHCID_TEST) \
38 $(GHCID_FLAGS)
39
40 clean: $(PKGS:=/clean)
41 cleaner: $(PKGS:=/cleaner)
42 %/clean:
43 cd $* && stack $(STACK_FLAGS) clean $(STACK_CLEAN_FLAGS)
44 %/cleaner:
45 cd $* && stack $(STACK_FLAGS) clean --full $(STACK_CLEAN_FLAGS)
46
47 %/fast: override STACK_BUILD_FLAGS+=--fast
48 %/fast: override STACK_HADDOCK_FLAGS+=--fast
49 %/fast: override STACK_TEST_FLAGS+=--fast
50 %/fast: %
51
52
53 %/debug: override STACK_BUILD_FLAGS+=--flag $(cabal:.cabal=):debug
54 %/debug: override STACK_TEST_FLAGS+=--flag $(cabal:.cabal=):debug
55 %/debug: %
56
57
58 %/accept: override STACK_TEST_ARGS+=--accept
59 %/accept: %
60
61
62 doc: $(PKGS:=/doc)
63 %/doc:
64 cd $* && stack $(STACK_FLAGS) haddock $(STACK_HADDOCK_FLAGS)
65 %.html: %.md
66 markdown $*.md >$*.html
67 %.html/view: %.html
68 sensible-browser $*.html
69
70 HLint.hs: $(HS)
71 sed -i -e '/^-- BEGIN: generated hints/,/^-- END: Generated by hlint/d' HLint.hs
72 echo '-- BEGIN: generated hints' >> HLint.hs
73 hlint $(foreach p,$(PKGS),--find $p) | grep '^'infix | sort -u >> HLint.hs
74 echo '-- END: generated hints' >> HLint.hs
75
76 lint: $(PKGS:=/lint) $(HS)
77 %/lint: HLint.hs
78 cd $* && if hlint --quiet --report=hlint.html -XNoCPP \
79 $(shell cabal-cargs --format=ghc --only=default_extensions --sourcefile=$*) $(HLINT_FLAGS) .; \
80 then rm -f hlint.html; \
81 else sensible-browser ./hlint.html & fi
82
83 tag: $(PKGS:=/tag)
84 %/tag:
85 cabal=$*/$*.cabal; \
86 name=$$(sed -ne 's/^name: *\(.*\)/\1/p' "$$cabal"); \
87 version=$$(sed -ne 's/^version: *\(.*\)/\1/p' "$$cabal"); \
88 git tag --merged | grep -Fqx "$$name-$$version" || \
89 git tag -f -s -m "$$name v$$version" $$name-$$version
90
91 tar: $(PKGS:=/tar)
92 %/tar:
93 cd $* && stack $(STACK_FLAGS) sdist $(STACK_SDIST_FLAGS)
94 upload: $(PKGS:=/upload)
95 %/upload:
96 cd $* && LANG=C stack $(STACK_FLAGS) upload $(STACK_UPLOAD_FLAGS) .
97
98 .PHONY: stats
99 stats:
100 gitstats . $@
101 stats/view: stats
102 sensible-browser stats/index.html