2021-10-26 15:44:54 +03:00
|
|
|
PWD=$(CURDIR)
|
|
|
|
PREFIX="$(PWD)/.stack-work/prefix"
|
|
|
|
UNAME := $(shell uname)
|
2022-04-04 18:44:08 +03:00
|
|
|
HLINTQUIET :=
|
|
|
|
|
2022-05-23 17:20:02 +03:00
|
|
|
ORGFILES = $(shell find docs/org -type f -name '*.org')
|
|
|
|
MDFILES:=$(patsubst docs/org/%,docs/md/%,$(ORGFILES:.org=.md))
|
2022-07-06 15:23:13 +03:00
|
|
|
ASSETS = seating-mascot.051c86a.svg Seating_Tara_smiling.svg teaching-mascot.f828959.svg
|
2022-05-20 17:16:16 +03:00
|
|
|
|
2022-07-15 14:52:16 +03:00
|
|
|
EXAMPLEMILESTONE=examples/milestone
|
|
|
|
EXAMPLEHTMLOUTPUT=_docs/examples/html
|
|
|
|
EXAMPLES=ValidityPredicates/SimpleFungibleToken.juvix \
|
|
|
|
MiniTicTacToe/MiniTicTacToe.juvix \
|
|
|
|
Fibonacci/Fibonacci.juvix \
|
|
|
|
Collatz/Collatz.juvix
|
|
|
|
|
2022-05-20 17:16:16 +03:00
|
|
|
ORGTOMDPRG ?=pandoc
|
2022-05-23 17:20:02 +03:00
|
|
|
ORGOPTS=--from org --to markdown_strict -s -o $@
|
2022-05-20 17:16:16 +03:00
|
|
|
|
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:
|
2022-04-05 20:57:21 +03:00
|
|
|
make pre-commit
|
2021-10-30 12:51:42 +03:00
|
|
|
|
2022-07-19 19:43:16 +03:00
|
|
|
docs/md/README.md :
|
|
|
|
@mkdir -p docs/md
|
|
|
|
@${ORGTOMDPRG} README.org ${ORGOPTS}
|
|
|
|
|
2022-05-23 17:20:02 +03:00
|
|
|
docs/md/%.md : docs/org/%.org
|
|
|
|
@echo "Processing ... $@"
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
${ORGTOMDPRG} $? ${ORGOPTS}
|
|
|
|
|
2022-05-20 17:16:16 +03:00
|
|
|
.PHONY: markdown-docs
|
2022-07-19 19:43:16 +03:00
|
|
|
markdown-docs: docs/md/README.md $(MDFILES)
|
2022-07-06 15:23:13 +03:00
|
|
|
@echo "copying assets ..."
|
|
|
|
@mkdir -p docs/md/assets
|
|
|
|
@cp -v $(addprefix assets/,$(ASSETS)) docs/md/assets
|
2022-05-20 17:16:16 +03:00
|
|
|
mdbook build
|
|
|
|
|
|
|
|
.PHONY: serve-docs
|
2022-05-23 17:20:02 +03:00
|
|
|
serve-docs: $(MDFILES)
|
2022-05-20 17:16:16 +03:00
|
|
|
mdbook serve --open
|
|
|
|
|
2021-09-26 19:59:51 +03:00
|
|
|
.PHONY : checklines
|
|
|
|
checklines :
|
|
|
|
@grep '.\{81,\}' \
|
2022-05-20 17:16:16 +03:00
|
|
|
--exclude=*.org \
|
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 :
|
2022-04-05 20:57:21 +03:00
|
|
|
@hlint src app test ${HLINTQUIET}
|
2021-09-26 19:59:51 +03:00
|
|
|
|
2021-12-04 16:17:49 +03:00
|
|
|
.PHONY : haddock
|
|
|
|
haddock :
|
2022-03-18 12:43:31 +03:00
|
|
|
cabal --docdir=docs/ --htmldir=docs/ haddock --enable-documentation
|
2021-12-04 16:17:49 +03:00
|
|
|
|
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
|
|
|
|
2022-07-08 14:59:45 +03:00
|
|
|
.PHONY: ci
|
|
|
|
ci:
|
|
|
|
make ci-build
|
|
|
|
make install
|
|
|
|
make ci-test
|
|
|
|
make test-shell
|
|
|
|
|
2022-03-25 02:50:18 +03:00
|
|
|
.PHONY : build
|
|
|
|
build:
|
|
|
|
stack build --fast --jobs $(THREADS)
|
|
|
|
|
2022-05-05 17:21:04 +03:00
|
|
|
.PHONY : ci-build
|
|
|
|
ci-build:
|
|
|
|
stack build --fast --jobs $(THREADS) --pedantic
|
|
|
|
|
2022-03-25 02:50:18 +03:00
|
|
|
build-watch:
|
|
|
|
stack build --fast --file-watch
|
|
|
|
|
2021-11-11 22:08:49 +03:00
|
|
|
.PHONY : cabal
|
|
|
|
cabal :
|
2021-09-26 19:59:51 +03:00
|
|
|
cabal build all
|
|
|
|
|
2022-03-25 02:50:18 +03:00
|
|
|
clean:
|
|
|
|
cabal clean
|
|
|
|
stack clean
|
2021-10-26 15:44:54 +03:00
|
|
|
|
2022-03-25 02:50:18 +03:00
|
|
|
clean-full:
|
|
|
|
stack clean --full
|
2022-05-26 18:52:08 +03:00
|
|
|
rm -rf .hie
|
|
|
|
rm -rf _docs
|
2021-10-30 12:51:42 +03:00
|
|
|
|
2022-03-23 14:13:28 +03:00
|
|
|
.PHONY : test
|
2022-03-23 13:40:03 +03:00
|
|
|
test:
|
|
|
|
stack test --fast --jobs $(THREADS)
|
|
|
|
|
2022-05-05 17:21:04 +03:00
|
|
|
.PHONY : ci-test
|
|
|
|
ci-test:
|
|
|
|
stack test --fast --jobs $(THREADS) --pedantic
|
|
|
|
|
2022-05-05 16:12:17 +03:00
|
|
|
.PHONY : test-skip-slow
|
|
|
|
test-skip-slow:
|
|
|
|
stack test --fast --jobs $(THREADS) --ta '-p "! /slow tests/"'
|
|
|
|
|
2022-03-25 02:50:18 +03:00
|
|
|
.PHONY : test-watch
|
|
|
|
test-watch:
|
|
|
|
stack test --fast --jobs $(THREADS) --file-watch
|
|
|
|
|
2022-06-09 17:36:07 +03:00
|
|
|
.PHONY : install-shelltest
|
|
|
|
install-shelltest:
|
|
|
|
stack install shelltestrunner
|
|
|
|
|
|
|
|
.PHONY : test-shell
|
|
|
|
test-shell :
|
|
|
|
shelltest --color --diff -a -j8 tests
|
|
|
|
|
2022-03-25 02:50:18 +03:00
|
|
|
format:
|
2022-04-05 20:57:21 +03:00
|
|
|
@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 \;
|
2022-03-25 02:50:18 +03:00
|
|
|
|
2022-04-04 16:55:15 +03:00
|
|
|
.PHONY: check-ormolu
|
|
|
|
check-ormolu:
|
2022-04-05 20:57:21 +03:00
|
|
|
@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 \;
|
2022-04-04 16:55:15 +03:00
|
|
|
|
2022-03-23 14:13:28 +03:00
|
|
|
.PHONY : install
|
2022-03-23 13:40:03 +03:00
|
|
|
install:
|
|
|
|
stack install --fast --jobs $(THREADS)
|
|
|
|
|
2022-03-25 02:50:18 +03:00
|
|
|
.PHONY : install-watch
|
|
|
|
install-watch:
|
|
|
|
stack install --fast --jobs $(THREADS) --file-watch
|
2021-10-26 15:44:54 +03:00
|
|
|
|
2021-11-11 22:08:49 +03:00
|
|
|
repl:
|
2022-07-08 14:59:45 +03:00
|
|
|
stack ghci Juvix:lib
|
2021-10-26 15:44:54 +03:00
|
|
|
|
2022-07-15 14:52:16 +03:00
|
|
|
.PHONY: html-examples
|
|
|
|
html-examples: $(EXAMPLES)
|
|
|
|
|
|
|
|
$(EXAMPLES):
|
|
|
|
$(eval OUTPUTDIR=$(EXAMPLEHTMLOUTPUT)/$(dir $@))
|
|
|
|
mkdir -p ${OUTPUTDIR}
|
2022-07-15 18:20:31 +03:00
|
|
|
juvix html $(EXAMPLEMILESTONE)/$@ --recursive --output-dir=./../../../${OUTPUTDIR} --print-metadata
|
2022-07-15 14:52:16 +03:00
|
|
|
|
2022-04-05 20:57:21 +03:00
|
|
|
.PHONY : install-pre-commit
|
|
|
|
install-pre-commit:
|
|
|
|
pip install pre-commit
|
|
|
|
pre-commit install
|
|
|
|
|
|
|
|
.PHONY : pre-commit
|
|
|
|
pre-commit :
|
|
|
|
pre-commit run --all-files
|
2022-04-04 16:55:15 +03:00
|
|
|
|
|
|
|
.PHONY : update-submodules
|
|
|
|
update-submodules :
|
|
|
|
git submodule foreach git pull origin main
|
|
|
|
|
2022-07-08 14:59:45 +03:00
|
|
|
.PHONY : juvix-stdlib
|
|
|
|
juvix-stdlib:
|
|
|
|
git submodule update --init juvix-stdlib
|
2022-05-04 15:06:29 +03:00
|
|
|
|
|
|
|
.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
|