machine: fix view and output
[haskell/symantic-parser.git] / Makefile
index 1c97c39c621045d0f259015b4b6f7d8b46a7a0dd..a88860925883c99a784c6a9fa09e3276ed5f7990 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,55 @@
+cabal = $(wildcard *.cabal)
+package = $(notdir ./$(cabal:.cabal=))
+version = $(shell sed -ne 's/^version: *\(.*\)/\1/p' $(cabal))
+all: build
+build:
+       cabal build
+clean c:
+       cabal clean
 repl:
        cabal repl
 
 t:
-       cabal test --enable-profiling --enable-library-coverage --enable-coverage --test-show-details always
-t/accept:
-       cabal test --test-show-details always --test-options --accept
+       cabal test $(TESTFLAGS) --test-show-details always --test-options "$(TESTOPTIONS) --color always --size-cutoff 1000000 $${p:+-p $$p}"
+%/accept: TESTOPTIONS+=--accept
+%/accept: %
+       
+%/cover: TESTFLAGS+=--enable-coverage
+%/cover: %
+       
+t/prof: OPTIFLAGS?=-xc
+t/prof:
+       cabal v2-build lib:symantic-parser --enable-profiling --write-ghc-environment-files=always
+       cabal test $(TESTFLAGS) --enable-profiling -fprof-auto -fprof-auto-calls \
+        --test-show-details always --test-options "$(TESTOPTIONS) $${p:+-p $$p}" \
+        --ghc-options "-opti+RTS -opti-p -opti-L100 -opti-ls $(addprefix -opti,$(OPTIFLAGS))"
+t/repl:
+       cabal repl --enable-tests symantic-parser-test
 
 doc:
        cabal haddock --haddock-css ocean --haddock-hyperlink-source
+
+tag:
+       git tag --merged | grep -Fqx "$(package)-$(version)" || \
+       git tag -f -s -m "$(package) v$(version)" $(package)-$(version)
+
+tar:
+       cabal sdist
+       cabal haddock --haddock-for-hackage --enable-doc
+upload: LANG=C
+upload: tar
+       cabal upload $(CABAL_UPLOAD_FLAGS) dist-newstyle/sdist/$(package)-$(version).tar.gz
+       cabal upload $(CABAL_UPLOAD_FLAGS) --documentation dist-newstyle/$(package)-$(version)-docs.tar.gz
+%/publish: CABAL_UPLOAD_FLAGS+=--publish
+%/publish: %
+       
+publish: upload/publish
+
+nix-build:
+       nix -L build
+nix-relock:
+       nix flake update --recreate-lock-file
+nix-repl:
+       nix -L develop --command cabal repl
+nix-shell:
+       nix -L develop