/
Makefile
75 lines (58 loc) · 2.3 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
include config.mk
IDR_SRC = $(shell find ./src/ -name '*.idr')
LIB_SRC = $(shell find ./cairolib/ -name '*.idr')
# Builds the idrisToCairo compiler
$(IDRISCAIRO) : $(IDR_SRC) $(PACKAGE)
$(IDRIS) --build $(PACKAGE)
# Builds the skyroToCairo compiler
$(SKYROCAIRO) : $(IDR_SRC) $(PACKAGE_SKYRO)
$(IDRIS) --build $(PACKAGE_SKYRO)
.PHONY: clean
clean: clean-lib
$(IDRIS) --clean $(PACKAGE)
$(IDRIS) --clean $(PACKAGE_SKYRO)
${MAKE} -C tests clean
.PHONY: build
build : $(IDRISCAIRO) # $(SKYROCAIRO)
# Skyro library
.PHONY: build-lib
build-lib : build $(LIB_SRC) ./cairolib/cairolib.ipkg
$(IDRISCAIRO) --build ./cairolib/cairolib.ipkg
.PHONY: install-lib
install-lib : build-lib
$(IDRISCAIRO) --install ./cairolib/cairolib.ipkg
.PHONY: clean-lib
clean-lib :
$(IDRIS) --clean ./cairolib/cairolib.ipkg
# Tests
.PHONY: build-test
build-test:
@${MAKE} -C tests build
.PHONY: run-example
run-example: install-lib Example.idr
[ -f ~/cairo_venv/bin/activate ] && source ~/cairo_venv/bin/activate ; \
$(IDRISCAIRO) --no-prelude -p cairolib --cg cairo --directive verbose Example.idr -o Example.cairo_unformatted && \
cairo-format $(BUILDDIR)/Example.cairo_unformatted > $(BUILDDIR)/Example.cairo && \
cairo-compile $(BUILDDIR)/Example.cairo --cairo_path ./skyro-runtime --output $(BUILDDIR)/Example_compile.json && \
cairo-run --program=$(BUILDDIR)/Example_compile.json --print_output --print_info --layout=small
#.PHONY: run-example
run-example-skyro: install-lib Example.skyro
[ -f ~/cairo_venv/bin/activate ] && source ~/cairo_venv/bin/activate ; \
$(SKYROCAIRO) --verbose --input Example.skyro --output $(BUILDDIR)/Example.cairo_unformatted && \
cairo-format $(BUILDDIR)/Example.cairo_unformatted > $(BUILDDIR)/Example.cairo && \
cairo-compile $(BUILDDIR)/Example.cairo --cairo_path ./skyro-runtime --output $(BUILDDIR)/Example_compile.json && \
cairo-run --program=$(BUILDDIR)/Example_compile.json --print_output --print_info --layout=small
# run like: `make test only=test002`
.PHONY: test-only
test-only:
${MAKE} -C tests only=$(only)
.PHONY: test
test: $(IDRISCAIRO) $(SKYROCAIRO) install-lib build-test test-only
test: $(IDRISCAIRO) install-lib build-test test-only
int-tests:
cd tests/idris-integer-types; \
pytest -vrPA test_intX_opt.py
docs:
idris2 --mkdoc idrisToCairo.ipkg
docker-build:
docker build . -t skyro