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
7 cabal := $(wildcard *.cabal)
8 package := $(notdir ./$(cabal:.cabal=))
9 version := $(shell sed -ne 's/^version: *\(.*\)/\1/p' $(cabal))
10 project := $(patsubst %.cabal,%,$(cabal))
20 ghcid -c 'cabal repl $(project) --repl-options "$(REPL_OPTIONS)"' --reverse-errors
23 cabal build $(project):parsers
25 cabal repl $(project):parsers
27 ghcid -c 'cabal repl $(project):parsers --repl-options "$(REPL_OPTIONS)"' --reverse-errors
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))"
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
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))"
52 cabal repl --enable-tests $(project)-test
54 ghcid -c 'cabal repl $(project):tests --test-options "$(TEST_OPTIONS)"' --reverse-errors
56 %/accept: TEST_OPTIONS += --accept
59 %/cover: CABAL_TEST_FLAGS += --enable-coverage
62 %.eventlog.html: RTS_OPTIONS += -hy -l-au
63 %.eventlog.html: %.eventlog
65 %.eventlog.json: RTS_OPTIONS += -p -l-au
66 %.eventlog.json: %.eventlog
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)"
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))"
92 cabal haddock --haddock-css ocean --haddock-hyperlink-source
95 git tag --merged | grep -Fqx "$(package)-$(version)" || \
96 git tag -f -s -m "$(package) v$(version)" $(package)-$(version)
100 cabal haddock --haddock-for-hackage --enable-doc
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
108 publish: upload/publish
113 nix flake update --recreate-lock-file
115 nix -L develop --command cabal repl
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
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
126 sed $< >$@ -e '1,/^ ======>/d;' -e '4s/^/parser = /' -e 's/\x00//g'
128 ormolu -m stdout >$@ -o -XBangPatterns -o -XUnboxedTuples -o -XMagicHash -o -XTypeApplications -o -XUnboxedTuples <$<
129 #sed -i $@ -e 'N;s/\n\s*#)/ #)/;P;D'
131 ormolu -m stdout >$@ -o -XBangPatterns -o -XUnboxedTuples -o -XMagicHash -o -XTypeApplications -o -XUnboxedTuples <$<
132 #sed -i $@ -e 'N;s/\n\s*#)/ #)/;P;D'