]> Git — Sourcephile - haskell/symantic-parser.git/blob - Makefile
change ShowLetName into HideableName
[haskell/symantic-parser.git] / Makefile
1 override BENCHMARK_OPTIONS += --output benchmarks/html/$(version).html --match glob $b
2 override GHCID_OPTIONS += --no-height-limit --reverse-errors --warnings
3 override GHC_PROF_OPTIONS += -eventlog -fprof-auto -fprof-cafs
4 #-fprof-auto-calls
5 override REPL_OPTIONS += -ignore-dot-ghci
6 override RTS_OPTIONS += -L100
7 override TEST_OPTIONS += --color always --size-cutoff 1000000 $(addprefix -p ,$t)
8 override CABAL_TEST_FLAGS += -j
9
10 cabal := $(wildcard *.cabal)
11 package := $(notdir ./$(cabal:.cabal=))
12 version := $(shell sed -ne 's/^version: *\(.*\)/\1/p' $(cabal))
13 project := $(patsubst %.cabal,%,$(cabal))
14
15 all: build
16 build:
17 cabal build $(CABAL_BUILD_FLAGS)
18 clean c:
19 cabal clean
20 repl:
21 cabal repl $(CABAL_REPL_FLAGS) $(project)
22 ghcid:
23 ghcid $(GHCID_OPTIONS) --command 'cabal repl -fno-code $(CABAL_REPL_FLAGS) $(project) $(addprefix --repl-options ,$(REPL_OPTIONS))'
24 .PHONY: parsers
25 parsers:
26 cabal build $(CABAL_BUILD_FLAGS) $(project):parsers
27 parsers/repl:
28 cabal repl $(CABAL_REPL_FLAGS) $(project):parsers
29 parsers/ghcid:
30 ghcid $(GHCID_OPTIONS) --command 'cabal repl -fno-code $(CABAL_REPL_FLAGS) $(project):parsers $(addprefix --repl-options ,$(REPL_OPTIONS))'
31 parsers/prof-th:
32 cabal v2-build lib:$(project) --enable-profiling $(addprefix --ghc-options ,$(GHC_PROF_OPTIONS)) --write-ghc-environment-files=always
33 cabal build $(CABAL_BUILD_FLAGS) $(project):parsers \
34 --enable-profiling $(addprefix --ghc-options ,$(GHC_PROF_OPTIONS)) \
35 --ghc-options "$(addprefix -opti,+RTS $(RTS_OPTIONS))"
36
37 .PHONY: tests
38 t tests:
39 cabal test $(CABAL_TEST_FLAGS) \
40 --test-show-details always --test-options "$(TEST_OPTIONS)"
41 tests/prof-time: $(project)-test.eventlog.json
42 tests/prof-heap: $(project)-test.eventlog.html
43 .PHONY: $(project)-test.eventlog
44 $(project)-test.eventlog $(project)-test.prof:
45 cabal test $(CABAL_TEST_FLAGS) \
46 --test-show-details always --test-options "$(TEST_OPTIONS) +RTS $(RTS_OPTIONS)" \
47 --enable-profiling $(addprefix --ghc-options ,$(GHC_PROF_OPTIONS)) || true
48 tests/prof-th:
49 cabal v2-build lib:$(project) --enable-profiling $(addprefix --ghc-options ,$(GHC_PROF_OPTIONS)) --write-ghc-environment-files=always
50 cabal test $(CABAL_TEST_FLAGS) \
51 --test-show-details always --test-options "$(TEST_OPTIONS) +RTS $(RTS_OPTIONS)" \
52 --enable-profiling $(addprefix --ghc-options ,$(GHC_PROF_OPTIONS)) \
53 --ghc-options "$(addprefix -opti,+RTS $(RTS_OPTIONS))"
54 t/repl tests/repl:
55 cabal repl $(CABAL_REPL_FLAGS) $(CABAL_TEST_FLAGS) --enable-tests $(project)-test
56 t/ghcid tests/ghcid:
57 ghcid $(GHCID_OPTIONS) --command 'cabal repl $(CABAL_REPL_FLAGS) $(CABAL_TEST_FLAGS) $(project):tests' --test ":main $(TEST_OPTIONS)"
58
59 %/accept: TEST_OPTIONS += --accept
60 %/accept: %
61
62 %/cover: CABAL_TEST_FLAGS += --enable-coverage
63 %/cover: %
64
65 %.eventlog.html: RTS_OPTIONS += -hy -l-au
66 %.eventlog.html: %.eventlog
67 eventlog2html $<
68 %.eventlog.json: RTS_OPTIONS += -p -l-au
69 %.eventlog.json: %.eventlog
70 hs-speedscope $<
71
72 .PHONY: benchmarks/html/$(version).html
73 b benchmarks: benchmarks/html/$(version).html
74 benchmarks/html/$(version).html:
75 mkdir -p benchmarks/html
76 cabal bench $(CABAL_BENCH_FLAGS) --benchmark-options "$(BENCHMARK_OPTIONS)"
77 benchmarks/repl:
78 cabal repl $(CABAL_REPL_FLAGS) --enable-benchmarks $(project)-benchmark
79 benchmarks/prof-time: $(project)-benchmark.eventlog.json
80 benchmarks/prof-heap: $(project)-benchmark.eventlog.html
81 .PHONY: $(project)-benchmark.eventlog
82 $(project)-benchmark.eventlog $(project)-benchmark.prof:
83 @echo "$$(tput setaf 1)WARNING: benchmarking with --enable-profiling can create significant biases$$(tput sgr0)"
84 cabal bench $(CABAL_BENCH_FLAGS) \
85 --benchmark-options "$(BENCHMARK_OPTIONS) +RTS $(RTS_OPTIONS)" \
86 --enable-profiling $(GHC_PROF_OPTIONS)
87 $(project)-benchmark.prof2:
88 cabal v2-build lib:$(project) --enable-profiling $(GHC_PROF_OPTIONS) --write-ghc-environment-files=always
89 cabal bench $(CABAL_BENCH_FLAGS) \
90 --benchmark-options "$(BENCHMARK_OPTIONS)" \
91 --enable-profiling $(GHC_PROF_OPTIONS) \
92 --ghc-options "$(addprefix -opti,+RTS $(RTS_OPTIONS))"
93
94 doc:
95 cabal haddock --haddock-css ocean --haddock-hyperlink-source
96
97 tag:
98 git tag --merged | grep -Fqx "$(package)-$(version)" || \
99 git tag -f -s -m "$(package) v$(version)" $(package)-$(version)
100
101 tar:
102 cabal sdist
103 cabal haddock --haddock-for-hackage --enable-doc
104 upload: LANG=C
105 upload: tar
106 cabal upload $(CABAL_UPLOAD_FLAGS) dist-newstyle/sdist/$(package)-$(version).tar.gz
107 cabal upload $(CABAL_UPLOAD_FLAGS) --documentation dist-newstyle/$(package)-$(version)-docs.tar.gz
108 %/publish: CABAL_UPLOAD_FLAGS+=--publish
109 %/publish: %
110
111 publish: upload/publish
112
113 nix-build:
114 nix -L build
115 nix-relock:
116 nix flake update --recreate-lock-file
117 nix-repl:
118 nix -L develop --command cabal repl $(CABAL_REPL_FLAGS)
119 nix-shell:
120 nix -L develop