1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-03 09:41:10 +03:00
juvix/Makefile

177 lines
4.0 KiB
Makefile
Raw Normal View History

PWD=$(CURDIR)
PREFIX="$(PWD)/.stack-work/prefix"
UNAME := $(shell uname)
2022-04-04 18:44:08 +03:00
HLINTQUIET :=
ORGFILES = $(shell find docs/org -type f -name '*.org')
MDFILES:=$(patsubst docs/org/%,docs/md/%,$(ORGFILES:.org=.md))
ASSETS = seating-mascot.051c86a.svg Seating_Tara_smiling.svg teaching-mascot.f828959.svg
EXAMPLEMILESTONE=examples/milestone
EXAMPLEHTMLOUTPUT=_docs/examples/html
EXAMPLES=ValidityPredicates/SimpleFungibleToken.juvix \
MiniTicTacToe/MiniTicTacToe.juvix \
Fibonacci/Fibonacci.juvix \
Collatz/Collatz.juvix
ORGTOMDPRG ?=pandoc
ORGOPTS=--from org --to markdown_strict -s -o $@
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:
2022-04-05 20:57:21 +03:00
make pre-commit
docs/md/README.md :
@mkdir -p docs/md
@${ORGTOMDPRG} README.org ${ORGOPTS}
docs/md/%.md : docs/org/%.org
@echo "Processing ... $@"
@mkdir -p $(dir $@)
${ORGTOMDPRG} $? ${ORGOPTS}
.PHONY: markdown-docs
markdown-docs: docs/md/README.md $(MDFILES)
@echo "copying assets ..."
@mkdir -p docs/md/assets
@cp -v $(addprefix assets/,$(ASSETS)) docs/md/assets
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 :
2022-04-05 20:57:21 +03:00
@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: ci
ci:
make ci-build
make install
make ci-test
make test-shell
.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
2022-03-23 14:13:28 +03:00
.PHONY : test
test:
stack test --fast --jobs $(THREADS)
.PHONY : ci-test
ci-test:
stack test --fast --jobs $(THREADS) --pedantic
Add C code generation backend (#68) * [cbackend] Adds an AST for C This should cover enough C to implement the microjuvix backend. * [cbackend] Add C serializer using language-c library We may decide to write our own serializer for the C AST but this demonstrates that the C AST is sufficient at least. * [cbackend] Declarations will always be typed * [cbackend] Add CPP support to AST * [cbackend] Rename some names for clarity * [cbackend] Add translation of InductiveDef to C * [cbackend] Add CLI for C backend * [cbackend] Add stdbool.h to file header * [cbackend] Allow Cpp and Verbatim code inline * [cbackend] Add a newline after printing C * [cbackend] Support foreign blocks * [cbackend] Add support for axioms * [cbackend] Remove code examples * [cbackend] wip FunctionDef including Expressions * [parser] Support esacping '}' inside a foreign block * [cbackend] Add support for patterns in functions * [cbackend] Add foreign C support to HelloWorld.mjuvix * hlint fixes * More hlint fixes not picked up by pre-commit * [cbackend] Remove CompileStatement from MonoJuvix * [cbackend] Add support for compile blocks * [cbackend] Move compileInfo extraction to MonoJuvixResult * [minihaskell] Fix compile block support * [chore] Remove ununsed isBackendSupported function * [chore] Remove unused imports * [cbackend] Use a Reader for pattern bindings * [cbackend] Fix compiler warnings * [cbackend] Add support for nested patterns * [cbackend] Use functions to instantiate argument names * [cbackend] Add non-exhaustive pattern error message * [cbackend] Adds test for c to WASM compile and execution * [cbackend] Add links to test dependencies in quickstart * [cbackend] Add test with inductive types and patterns * [cbackend] Fix indentation * [cbackend] Remove ExpressionTyped case https://github.com/heliaxdev/minijuvix/issues/79 * [lexer] Fix lexing of \ inside a foreign block * [cbackend] PR review fixes * [chore] Remove unused import * [cbackend] Rename CJuvix to MiniC * [cbackend] Rename MonoJuvixToC to MonoJuvixToMiniC * [cbackend] Add test for polymorphic function * [cbackend] Add module for string literals
2022-05-05 16:12:17 +03:00
.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
.PHONY : install-shelltest
install-shelltest:
stack install shelltestrunner
.PHONY : test-shell
test-shell :
shelltest --color --diff -a -j8 tests
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 \;
.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-03-23 14:13:28 +03:00
.PHONY : install
install:
stack install --fast --jobs $(THREADS)
.PHONY : install-watch
install-watch:
stack install --fast --jobs $(THREADS) --file-watch
repl:
stack ghci Juvix:lib
.PHONY: html-examples
html-examples: $(EXAMPLES)
$(EXAMPLES):
$(eval OUTPUTDIR=$(EXAMPLEHTMLOUTPUT)/$(dir $@))
mkdir -p ${OUTPUTDIR}
juvix html $(EXAMPLEMILESTONE)/$@ --recursive --output-dir=./../../../${OUTPUTDIR} --print-metadata
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
.PHONY : update-submodules
update-submodules :
git submodule foreach git pull origin main
.PHONY : juvix-stdlib
juvix-stdlib:
git submodule update --init juvix-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