1
1
mirror of https://github.com/anoma/juvix.git synced 2024-11-10 15:06:54 +03:00
juvix/Makefile
Jonathan Cubides a4eb2124b2
Generic Errors and refactoring (#123)
* w.i.p adoption of generic error type

* harmonize

* Remove the use of Error effect for internal bugs

* add location information to expression atom list

* Add GenericError instance for PatternAtoms

* Remove Maybe GenericError occurrences

* [ci] fix draft job's condition

* minor changes

* [stack] macos support ghc-opts

* Fix reviewer's comments

* remove accidentally commited file

* refactor to avoid duplication

* fix

Co-authored-by: Jan Mas Rovira <janmasrovira@gmail.com>
2022-05-26 17:52:08 +02:00

142 lines
3.1 KiB
Makefile

PWD=$(CURDIR)
PREFIX="$(PWD)/.stack-work/prefix"
UNAME := $(shell uname)
HLINTQUIET :=
ORGFILES = $(shell find docs/org -type f -name '*.org')
MDFILES:=$(patsubst docs/org/%,docs/md/%,$(ORGFILES:.org=.md))
ORGTOMDPRG ?=pandoc
ORGOPTS=--from org --to markdown_strict -s -o $@
# ORGTOMDPRG ?=emacs
# ORGOPTS=--batch -f org-html-export-to-markdown
ifeq ($(UNAME), Darwin)
THREADS := $(shell sysctl -n hw.logicalcpu)
else ifeq ($(UNAME), Linux)
THREADS := $(shell nproc)
else
THREADS := $(shell echo %NUMBER_OF_PROCESSORS%)
endif
all:
make pre-commit
docs/md/%.md : docs/org/%.org
@echo "Processing ... $@"
@mkdir -p $(dir $@)
${ORGTOMDPRG} $? ${ORGOPTS}
.PHONY: markdown-docs
markdown-docs: $(MDFILES)
mdbook build
.PHONY: serve-docs
serve-docs: $(MDFILES)
mdbook serve --open
.PHONY : checklines
checklines :
@grep '.\{81,\}' \
--exclude=*.org \
-l --recursive src; \
status=$$?; \
if [ $$status = 0 ] ; \
then echo "Lines were found with more than 80 characters!" >&2 ; \
else echo "Succeed!"; \
fi
.PHONY : hlint
hlint :
@hlint src app test ${HLINTQUIET}
.PHONY : haddock
haddock :
cabal --docdir=docs/ --htmldir=docs/ haddock --enable-documentation
.PHONY : docs
docs :
cd docs ; \
sh conv.sh
.PHONY : build
build:
stack build --fast --jobs $(THREADS)
.PHONY : ci-build
ci-build:
stack build --fast --jobs $(THREADS) --pedantic
build-watch:
stack build --fast --file-watch
.PHONY : cabal
cabal :
cabal build all
clean:
cabal clean
stack clean
clean-full:
stack clean --full
rm -rf .hie
rm -rf _docs
.PHONY : test
test:
stack test --fast --jobs $(THREADS)
.PHONY : ci-test
ci-test:
stack test --fast --jobs $(THREADS) --pedantic
.PHONY : test-skip-slow
test-skip-slow:
stack test --fast --jobs $(THREADS) --ta '-p "! /slow tests/"'
.PHONY : test-watch
test-watch:
stack test --fast --jobs $(THREADS) --file-watch
format:
@find . -name "*.hs" -exec ormolu --mode inplace {} --ghc-opt -XStandaloneDeriving --ghc-opt -XUnicodeSyntax --ghc-opt -XDerivingStrategies --ghc-opt -XMultiParamTypeClasses --ghc-opt -XTemplateHaskell --ghc-opt -XImportQualifiedPost \;
.PHONY: check-ormolu
check-ormolu:
@find . -name "*.hs" -exec ormolu --mode check {} --ghc-opt -XStandaloneDeriving --ghc-opt -XUnicodeSyntax --ghc-opt -XDerivingStrategies --ghc-opt -XMultiParamTypeClasses --ghc-opt -XTemplateHaskell --ghc-opt -XImportQualifiedPost \;
.PHONY : install
install:
stack install --fast --jobs $(THREADS)
.PHONY : install-watch
install-watch:
stack install --fast --jobs $(THREADS) --file-watch
repl:
stack ghci MiniJuvix:lib
.PHONY : install-pre-commit
install-pre-commit:
pip install pre-commit
pre-commit install
.PHONY : pre-commit
pre-commit :
pre-commit run --all-files
.PHONY : update-submodules
update-submodules :
git submodule foreach git pull origin main
.PHONY : minijuvix-stdlib
minijuvix-stdlib:
git submodule update --init minijuvix-stdlib
.PHONY : get-changelog-updates
get-changelog-updates :
@github_changelog_generator --since-tag $(shell git describe --tags $(shell git rev-list --tags --max-count=1)) 1> /dev/null
pandoc CHANGELOG.md --from markdown --to org -o UPDATES-FOR-CHANGELOG.org