2021-10-26 15:44:54 +03:00
|
|
|
PWD=$(CURDIR)
|
|
|
|
PREFIX="$(PWD)/.stack-work/prefix"
|
|
|
|
UNAME := $(shell uname)
|
|
|
|
|
2021-10-30 12:51:42 +03:00
|
|
|
AGDA_FILES := $(wildcard ./src/MiniJuvix/Syntax/*.agda)
|
|
|
|
GEN_HS := $(patsubst %.agda, %.hs, $(AGDA_FILES))
|
|
|
|
|
2021-10-26 15:44:54 +03:00
|
|
|
ifeq ($(UNAME), Darwin)
|
|
|
|
THREADS := $(shell sysctl -n hw.logicalcpu)
|
|
|
|
else ifeq ($(UNAME), Linux)
|
|
|
|
THREADS := $(shell nproc)
|
|
|
|
else
|
|
|
|
THREADS := $(shell echo %NUMBER_OF_PROCESSORS%)
|
|
|
|
endif
|
2021-09-26 19:59:51 +03:00
|
|
|
|
2021-10-30 12:51:42 +03:00
|
|
|
all:
|
|
|
|
make prepare-push
|
|
|
|
|
2021-09-26 19:59:51 +03:00
|
|
|
.PHONY : checklines
|
|
|
|
checklines :
|
|
|
|
@grep '.\{81,\}' \
|
2021-10-30 12:51:42 +03:00
|
|
|
--exclude=*.agda \
|
2021-09-26 19:59:51 +03:00
|
|
|
-l --recursive src; \
|
|
|
|
status=$$?; \
|
|
|
|
if [ $$status = 0 ] ; \
|
2021-12-30 17:56:58 +03:00
|
|
|
then echo "Lines were found with more than 80 characters!" >&2 ; \
|
2021-09-26 19:59:51 +03:00
|
|
|
else echo "Succeed!"; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
.PHONY : hlint
|
|
|
|
hlint :
|
|
|
|
hlint src
|
|
|
|
|
2021-12-04 16:17:49 +03:00
|
|
|
.PHONY : haddock
|
|
|
|
haddock :
|
|
|
|
cabal --docdir=docs/ --htmldir=docs/ haddock --enable-documentation
|
|
|
|
|
2021-12-04 15:25:15 +03:00
|
|
|
.PHONY : docs
|
|
|
|
docs :
|
2021-12-04 16:17:49 +03:00
|
|
|
cd docs ; \
|
|
|
|
sh conv.sh
|
2021-09-26 19:59:51 +03:00
|
|
|
|
2021-11-11 22:08:49 +03:00
|
|
|
.PHONY : cabal
|
|
|
|
cabal :
|
2021-09-26 19:59:51 +03:00
|
|
|
cabal build all
|
|
|
|
|
|
|
|
.PHONY : stan
|
|
|
|
stan :
|
2021-10-26 15:44:54 +03:00
|
|
|
stan check --include --filter-all --directory=src
|
|
|
|
|
2021-10-30 12:51:42 +03:00
|
|
|
setup:
|
|
|
|
stack build --only-dependencies --jobs $(THREADS)
|
|
|
|
|
2021-11-11 22:08:49 +03:00
|
|
|
stack:
|
2021-10-26 15:44:54 +03:00
|
|
|
stack build --fast --jobs $(THREADS)
|
|
|
|
|
|
|
|
stack-build-watch:
|
|
|
|
stack build --fast --file-watch
|
|
|
|
|
2021-11-11 22:08:49 +03:00
|
|
|
repl:
|
2021-11-06 02:46:28 +03:00
|
|
|
stack ghci MiniJuvix:lib
|
2021-10-26 15:44:54 +03:00
|
|
|
|
|
|
|
clean:
|
|
|
|
cabal clean
|
|
|
|
stack clean
|
|
|
|
|
|
|
|
clean-full:
|
2021-10-30 12:51:42 +03:00
|
|
|
stack clean --full
|
|
|
|
|
|
|
|
format:
|
|
|
|
find ./src/ -name "*.hs" -exec ormolu --mode inplace {} --ghc-opt -XStandaloneDeriving --ghc-opt -XUnicodeSyntax --ghc-opt -XDerivingStrategies --ghc-opt -XMultiParamTypeClasses \;
|
|
|
|
|
|
|
|
prepare-push:
|
|
|
|
make checklines && make hlint && make format
|
2021-11-11 22:08:49 +03:00
|
|
|
|
|
|
|
.PHONY: install-agda
|
|
|
|
install-agda:
|
|
|
|
git clone https://github.com/agda/agda.git
|
|
|
|
cd agda
|
|
|
|
cabal update
|
|
|
|
cabal install --overwrite-policy=always --ghc-options='-O2 +RTS -M6G -RTS' alex-3.2.6
|
|
|
|
cabal install --overwrite-policy=always --ghc-options='-O2 +RTS -M6G -RTS' happy-1.19.12
|
|
|
|
pwd
|
|
|
|
cabal install --overwrite-policy=always --ghc-options='-O2 +RTS -M6G -RTS' -foptimise-heavily
|
|
|
|
|
|
|
|
.PHONY : install-agda2hs
|
|
|
|
install-agda2hs:
|
|
|
|
git clone https://github.com/agda/agda2hs.git
|
|
|
|
cd agda2hs && cabal new-install --overwrite-policy=always
|
|
|
|
mkdir -p .agda/
|
|
|
|
touch .agda/libraries
|
|
|
|
echo "agda2hs/agda2hs.agda-lib" > ~/.agda/libraries
|
|
|
|
|
|
|
|
.PHONY : agda
|
2021-12-04 15:25:15 +03:00
|
|
|
agda :
|
2021-11-11 22:08:49 +03:00
|
|
|
agda2hs ./src/MiniJuvix/Syntax/Core.agda -o src -XUnicodeSyntax -XStandaloneDeriving -XDerivingStrategies -XMultiParamTypeClasses
|
|
|
|
agda2hs ./src/MiniJuvix/Syntax/Eval.agda -o src -XUnicodeSyntax -XStandaloneDeriving -XDerivingStrategies -XMultiParamTypeClasses
|