test: save
[haskell/symantic-parser.git] / Makefile
index 62f21e119de2dc0e2ebc23447b6d9db3953265a3..8369082c2c3832cf05a2c02ed9c70e61b70a0ccc 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,28 +1,49 @@
+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 --test-show-details always --test-options "--color always --size-cutoff 100000"
-t/repl:
-       cabal repl --enable-tests symantic-parser-test
-t/prof:
-       cabal test --enable-profiling --enable-library-coverage --enable-coverage --test-show-details always
+       cabal test -fdump-splices --test-show-details always --test-options "--color always --size-cutoff 100000"
 t/accept:
        cabal test --test-show-details always --test-options "--accept --color always --size-cutoff 100000"
+t/prof:
+       cabal test --enable-profiling --enable-library-coverage --enable-coverage --test-show-details always
+t/repl:
+       cabal repl --enable-tests symantic-parser-test
+t/splices: t
+       shopt -s globstar; $$EDITOR dist-newstyle/build/**/t/**/*.dump-splices
 
 doc:
        cabal haddock --haddock-css ocean --haddock-hyperlink-source
 
 tag:
-       name=$$(sed -ne 's/^name: *\(.*\)/\1/p' "$(cabal)"); \
-       version=$$(sed -ne 's/^version: *\(.*\)/\1/p' "$(cabal)"); \
-       git tag --merged | grep -Fqx "$$name-$$version" || \
-       git tag -f -s -m "$$name v$$version" $$name-$$version
+       git tag --merged | grep -Fqx "$(package)-$(version)" || \
+       git tag -f -s -m "$(package) v$(version)" $(package)-$(version)
 
 tar:
        cabal sdist
-upload:
-       LANG=C cabal upload .
+       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