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