2021-03-19 19:36:09 +03:00
|
|
|
help : Makefile
|
|
|
|
@sed -n 's/^#> //p' $<
|
2020-08-07 18:37:28 +03:00
|
|
|
|
2021-04-03 20:31:33 +03:00
|
|
|
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
|
|
|
|
2020-05-13 15:17:19 +03:00
|
|
|
##########################################
|
|
|
|
# Dependencies
|
|
|
|
##########################################
|
2020-04-20 09:35:22 +03:00
|
|
|
|
2020-08-07 18:37:28 +03:00
|
|
|
EXECUTABLES = man2html virtualenv python3 colordiff
|
2020-05-13 15:53:53 +03:00
|
|
|
K := $(foreach exec,$(EXECUTABLES),\
|
|
|
|
$(if $(shell which $(exec)),some string,$(warning [WARNING] No "$(exec)" executable found. \
|
|
|
|
Please install this executable for everything to work smoothly)))
|
|
|
|
|
2021-04-02 18:57:44 +03:00
|
|
|
# The Zarith dependency is fixed because of https://github.com/janestreet/zarith_stubs_js/pull/8
|
2020-12-21 20:15:53 +03:00
|
|
|
dependencies-ocaml:
|
2020-04-17 14:02:15 +03:00
|
|
|
opam install \
|
2021-01-09 23:03:32 +03:00
|
|
|
ocamlformat ANSITerminal sedlex menhir menhirLib dune cmdliner obelisk \
|
2021-04-02 18:57:44 +03:00
|
|
|
re obelisk unionfind bindlib zarith.1.11 zarith_stubs_js.v0.14.0 ocamlgraph \
|
2021-01-20 18:06:04 +03:00
|
|
|
js_of_ocaml-compiler js_of_ocaml js_of_ocaml-ppx calendar camomile \
|
2021-04-04 17:57:59 +03:00
|
|
|
visitors benchmark
|
2020-04-26 19:42:42 +03:00
|
|
|
|
2020-05-13 15:20:15 +03:00
|
|
|
init-submodules:
|
2020-04-17 14:02:15 +03:00
|
|
|
git submodule update --init
|
|
|
|
|
2021-03-11 16:41:14 +03:00
|
|
|
#> dependencies : Install the Catala OCaml and Git dependencies
|
2020-12-21 20:15:53 +03:00
|
|
|
dependencies: dependencies-ocaml init-submodules
|
2020-05-13 15:20:15 +03:00
|
|
|
|
|
|
|
|
2020-05-13 15:17:19 +03:00
|
|
|
##########################################
|
|
|
|
# Catala compiler rules
|
|
|
|
##########################################
|
|
|
|
|
2020-04-20 09:35:22 +03:00
|
|
|
format:
|
2021-02-28 20:18:01 +03:00
|
|
|
dune build @fmt --auto-promote 2> /dev/null | true
|
2020-04-20 09:35:22 +03:00
|
|
|
|
2021-03-05 21:16:56 +03:00
|
|
|
#> build : Builds the Catala compiler
|
2020-04-25 20:22:53 +03:00
|
|
|
build:
|
2021-03-15 13:12:24 +03:00
|
|
|
dune build @update-parser-messages --auto-promote | true
|
2020-12-21 20:26:01 +03:00
|
|
|
@$(MAKE) --no-print-directory format
|
2021-02-01 22:09:16 +03:00
|
|
|
dune build src/catala/catala.exe
|
2020-04-19 17:30:18 +03:00
|
|
|
|
2021-03-05 21:16:56 +03:00
|
|
|
#> js_build : Builds the Web-compatible JS version of the Catala compiler
|
2021-01-16 20:06:22 +03:00
|
|
|
js_build:
|
2021-02-01 22:09:16 +03:00
|
|
|
dune build src/catala/catala_web.bc.js --profile release
|
2021-01-05 16:35:04 +03:00
|
|
|
|
2021-03-05 21:16:56 +03:00
|
|
|
#> doc : Generates the HTML OCaml documentation
|
2021-02-01 22:24:50 +03:00
|
|
|
doc:
|
2020-05-23 00:02:48 +03:00
|
|
|
dune build @doc
|
2020-12-14 20:09:38 +03:00
|
|
|
ln -sf $(PWD)/_build/default/_doc/_html/index.html doc/odoc.html
|
2020-05-23 00:02:48 +03:00
|
|
|
|
2020-12-14 20:09:38 +03:00
|
|
|
install:
|
2021-01-05 16:35:04 +03:00
|
|
|
dune build @install
|
2020-04-16 18:47:35 +03:00
|
|
|
|
2020-05-13 15:17:19 +03:00
|
|
|
##########################################
|
2020-08-19 00:16:27 +03:00
|
|
|
# Syntax highlighting rules
|
2020-05-13 15:17:19 +03:00
|
|
|
##########################################
|
2020-03-08 05:30:37 +03:00
|
|
|
|
2020-04-27 10:57:13 +03:00
|
|
|
SYNTAX_HIGHLIGHTING_FR=${CURDIR}/syntax_highlighting/fr
|
|
|
|
SYNTAX_HIGHLIGHTING_EN=${CURDIR}/syntax_highlighting/en
|
2020-04-17 13:29:30 +03:00
|
|
|
|
2021-02-28 20:18:01 +03:00
|
|
|
pygmentize_fr: $(SYNTAX_HIGHLIGHTING_FR)/set_up_pygments.sh
|
2020-04-26 21:48:51 +03:00
|
|
|
chmod +x $<
|
2021-03-02 20:27:39 +03:00
|
|
|
sudo $<
|
2020-04-17 13:29:30 +03:00
|
|
|
|
2021-02-28 20:18:01 +03:00
|
|
|
pygmentize_en: $(SYNTAX_HIGHLIGHTING_EN)/set_up_pygments.sh
|
2020-04-19 17:30:18 +03:00
|
|
|
chmod +x $<
|
2021-03-02 20:27:39 +03:00
|
|
|
sudo $<
|
2020-04-19 17:30:18 +03:00
|
|
|
|
2021-03-05 21:16:56 +03:00
|
|
|
#> pygments : Extends your pygmentize executable with Catala lexers
|
2021-02-28 20:18:01 +03:00
|
|
|
pygments: pygmentize_fr pygmentize_en
|
2020-04-26 21:48:51 +03:00
|
|
|
|
2020-04-27 10:57:13 +03:00
|
|
|
atom_fr: ${CURDIR}/syntax_highlighting/fr/setup_atom.sh
|
2020-04-26 21:48:51 +03:00
|
|
|
chmod +x $<
|
|
|
|
$<
|
2020-04-20 09:35:22 +03:00
|
|
|
|
2020-04-27 10:57:13 +03:00
|
|
|
atom_en: ${CURDIR}/syntax_highlighting/en/setup_atom.sh
|
2020-04-26 21:59:04 +03:00
|
|
|
chmod +x $<
|
|
|
|
$<
|
|
|
|
|
2020-08-08 20:07:28 +03:00
|
|
|
atom_nv: ${CURDIR}/syntax_highlighting/nv/setup_atom.sh
|
|
|
|
chmod +x $<
|
|
|
|
$<
|
|
|
|
|
2021-03-05 21:16:56 +03:00
|
|
|
#> atom : Installs Catala syntax highlighting for Atom
|
2020-08-08 20:07:28 +03:00
|
|
|
atom: atom_fr atom_en atom_nv
|
2020-04-26 21:59:04 +03:00
|
|
|
|
2020-08-19 00:16:27 +03:00
|
|
|
vscode_fr: ${CURDIR}/syntax_highlighting/fr/setup_vscode.sh
|
|
|
|
chmod +x $<
|
|
|
|
$<
|
|
|
|
|
|
|
|
vscode_en: ${CURDIR}/syntax_highlighting/en/setup_vscode.sh
|
|
|
|
chmod +x $<
|
|
|
|
$<
|
|
|
|
|
|
|
|
vscode_nv: ${CURDIR}/syntax_highlighting/nv/setup_vscode.sh
|
|
|
|
chmod +x $<
|
|
|
|
$<
|
|
|
|
|
2021-03-05 21:16:56 +03:00
|
|
|
#> vscode : Installs Catala syntax highlighting for VSCode
|
2020-08-19 00:16:27 +03:00
|
|
|
vscode: vscode_fr vscode_en vscode_nv
|
|
|
|
|
2020-05-13 15:17:19 +03:00
|
|
|
##########################################
|
|
|
|
# Examples-related rules
|
|
|
|
##########################################
|
2020-04-17 13:29:30 +03:00
|
|
|
|
2020-04-20 10:02:08 +03:00
|
|
|
EXAMPLES_DIR=examples
|
|
|
|
ALLOCATIONS_FAMILIALES_DIR=$(EXAMPLES_DIR)/allocations_familiales
|
2020-07-03 21:30:17 +03:00
|
|
|
CODE_GENERAL_IMPOTS_DIR=$(EXAMPLES_DIR)/code_general_impots
|
2020-05-25 20:07:55 +03:00
|
|
|
US_TAX_CODE_DIR=$(EXAMPLES_DIR)/us_tax_code
|
2020-12-24 13:37:11 +03:00
|
|
|
TUTORIAL_EN_DIR=$(EXAMPLES_DIR)/tutorial_en
|
|
|
|
TUTORIEL_FR_DIR=$(EXAMPLES_DIR)/tutoriel_fr
|
|
|
|
|
2020-04-20 10:02:08 +03:00
|
|
|
|
2021-03-02 20:27:39 +03:00
|
|
|
literate_allocations_familiales: build
|
2020-12-10 20:21:48 +03:00
|
|
|
$(MAKE) -C $(ALLOCATIONS_FAMILIALES_DIR) allocations_familiales.tex
|
|
|
|
$(MAKE) -C $(ALLOCATIONS_FAMILIALES_DIR) allocations_familiales.html
|
2020-04-25 15:21:26 +03:00
|
|
|
|
2021-03-02 20:27:39 +03:00
|
|
|
literate_code_general_impots: build
|
2020-12-10 20:21:48 +03:00
|
|
|
$(MAKE) -C $(CODE_GENERAL_IMPOTS_DIR) code_general_impots.tex
|
|
|
|
$(MAKE) -C $(CODE_GENERAL_IMPOTS_DIR) code_general_impots.html
|
2020-07-03 21:30:17 +03:00
|
|
|
|
2021-03-02 20:27:39 +03:00
|
|
|
literate_us_tax_code: build
|
2020-12-10 20:21:48 +03:00
|
|
|
$(MAKE) -C $(US_TAX_CODE_DIR) us_tax_code.tex
|
|
|
|
$(MAKE) -C $(US_TAX_CODE_DIR) us_tax_code.html
|
2020-05-17 19:51:00 +03:00
|
|
|
|
2021-03-02 20:27:39 +03:00
|
|
|
literate_tutorial_en: build
|
2020-12-24 13:37:11 +03:00
|
|
|
$(MAKE) -C $(TUTORIAL_EN_DIR) tutorial_en.tex
|
|
|
|
$(MAKE) -C $(TUTORIAL_EN_DIR) tutorial_en.html
|
|
|
|
|
2021-03-02 20:27:39 +03:00
|
|
|
literate_tutoriel_fr: build
|
2020-12-24 13:37:11 +03:00
|
|
|
$(MAKE) -C $(TUTORIEL_FR_DIR) tutoriel_fr.tex
|
|
|
|
$(MAKE) -C $(TUTORIEL_FR_DIR) tutoriel_fr.html
|
2020-04-19 17:30:18 +03:00
|
|
|
|
2021-03-11 16:41:14 +03:00
|
|
|
#> literate_examples : Builds the .tex and .html versions of the examples code. Needs pygments to be installed and patched with Catala.
|
2021-03-05 21:16:56 +03:00
|
|
|
literate_examples: literate_allocations_familiales literate_code_general_impots \
|
2020-12-24 13:37:11 +03:00
|
|
|
literate_us_tax_code literate_tutorial_en literate_tutoriel_fr
|
2020-04-17 13:29:30 +03:00
|
|
|
|
2020-08-07 18:37:28 +03:00
|
|
|
##########################################
|
|
|
|
# Execute test suite
|
|
|
|
##########################################
|
|
|
|
|
|
|
|
.FORCE:
|
|
|
|
|
2020-12-10 20:11:43 +03:00
|
|
|
test_suite: .FORCE
|
2020-12-21 18:02:00 +03:00
|
|
|
@$(MAKE) --no-print-directory -C tests pass_tests
|
2020-12-10 20:11:43 +03:00
|
|
|
|
2021-02-28 20:18:01 +03:00
|
|
|
test_examples: .FORCE
|
2020-12-21 18:02:00 +03:00
|
|
|
@$(MAKE) --no-print-directory -C examples tests
|
2020-12-10 20:11:43 +03:00
|
|
|
|
2021-03-05 21:16:56 +03:00
|
|
|
#> tests : Run interpreter tests
|
2020-12-10 20:11:43 +03:00
|
|
|
tests: test_suite test_examples
|
2020-08-07 18:37:28 +03:00
|
|
|
|
2021-03-05 21:16:56 +03:00
|
|
|
#> tests_ml : Run OCaml unit tests for the Catala-generated code
|
2021-02-03 12:53:21 +03:00
|
|
|
tests_ml: run_french_law_library_tests
|
|
|
|
|
2021-01-28 20:30:01 +03:00
|
|
|
##########################################
|
2021-02-01 22:09:16 +03:00
|
|
|
# French law library
|
2021-01-28 20:30:01 +03:00
|
|
|
##########################################
|
|
|
|
|
2021-02-01 22:09:16 +03:00
|
|
|
FRENCH_LAW_LIB_DIR=src/french_law
|
2021-01-30 20:00:49 +03:00
|
|
|
|
2021-02-03 12:53:21 +03:00
|
|
|
$(FRENCH_LAW_LIB_DIR)/law_source/allocations_familiales.ml:
|
2021-04-03 18:58:31 +03:00
|
|
|
CATALA_OPTS="-O -t" $(MAKE) -C $(ALLOCATIONS_FAMILIALES_DIR) allocations_familiales.ml
|
2021-02-01 22:09:16 +03:00
|
|
|
cp -f $(ALLOCATIONS_FAMILIALES_DIR)/allocations_familiales.ml \
|
2021-02-28 20:18:01 +03:00
|
|
|
$(FRENCH_LAW_LIB_DIR)/law_source
|
2021-01-28 20:30:01 +03:00
|
|
|
|
2021-02-03 12:53:21 +03:00
|
|
|
$(FRENCH_LAW_LIB_DIR)/law_source/unit_tests/tests_allocations_familiales.ml:
|
2021-04-03 18:58:31 +03:00
|
|
|
CATALA_OPTS="-O -t" $(MAKE) -s -C $(ALLOCATIONS_FAMILIALES_DIR) tests/tests_allocations_familiales.ml
|
2021-03-05 21:16:56 +03:00
|
|
|
cp -f $(ALLOCATIONS_FAMILIALES_DIR)/tests/tests_allocations_familiales.ml \
|
2021-02-03 12:53:21 +03:00
|
|
|
$(FRENCH_LAW_LIB_DIR)/law_source/unit_tests/
|
|
|
|
|
2021-03-30 18:56:56 +03:00
|
|
|
#> generate_french_law_library : Generates the French law library OCaml sources from Catala
|
2021-03-05 21:16:56 +03:00
|
|
|
generate_french_law_library:\
|
|
|
|
$(FRENCH_LAW_LIB_DIR)/law_source/allocations_familiales.ml \
|
2021-02-03 12:53:21 +03:00
|
|
|
$(FRENCH_LAW_LIB_DIR)/law_source/unit_tests/tests_allocations_familiales.ml
|
2021-04-03 14:44:11 +03:00
|
|
|
$(MAKE) format
|
2021-02-03 12:53:21 +03:00
|
|
|
|
2021-03-05 21:16:56 +03:00
|
|
|
#> build_french_law_library : Builds the OCaml French law library
|
|
|
|
build_french_law_library: generate_french_law_library format
|
2021-04-03 18:58:31 +03:00
|
|
|
dune build $(FRENCH_LAW_LIB_DIR)/french_law.a
|
2021-02-01 22:09:16 +03:00
|
|
|
|
2021-03-18 20:31:34 +03:00
|
|
|
run_french_law_library_benchmark: generate_french_law_library
|
2021-04-03 20:31:33 +03:00
|
|
|
dune exec --profile release $(FRENCH_LAW_LIB_DIR)/bench.exe
|
2021-03-05 21:16:56 +03:00
|
|
|
|
2021-03-18 20:31:34 +03:00
|
|
|
run_french_law_library_tests: generate_french_law_library
|
2021-03-05 21:16:56 +03:00
|
|
|
dune exec $(FRENCH_LAW_LIB_DIR)/law_source/unit_tests/run_tests.exe
|
|
|
|
|
|
|
|
#> build_french_law_library_js : Builds the JS version of the OCaml French law library
|
2021-03-05 21:22:37 +03:00
|
|
|
build_french_law_library_js: generate_french_law_library format
|
2021-02-01 22:09:16 +03:00
|
|
|
dune build --profile release $(FRENCH_LAW_LIB_DIR)/api_web.bc.js
|
2021-04-03 20:31:33 +03:00
|
|
|
cp -f $(ROOT_DIR)/_build/default/$(FRENCH_LAW_LIB_DIR)/api_web.bc.js $(ROOT_DIR)/french_law_js/french_law.js
|
2021-02-01 22:09:16 +03:00
|
|
|
|
2020-05-13 15:17:19 +03:00
|
|
|
##########################################
|
|
|
|
# Website assets
|
|
|
|
##########################################
|
2020-04-17 13:29:30 +03:00
|
|
|
|
2021-02-12 20:56:36 +03:00
|
|
|
grammar.html: src/catala/surface/parser.mly
|
2020-04-30 13:15:26 +03:00
|
|
|
obelisk html -o $@ $<
|
|
|
|
|
2020-11-23 11:33:07 +03:00
|
|
|
catala.html: src/catala/utils/cli.ml
|
2021-02-01 22:09:16 +03:00
|
|
|
dune exec src/catala/catala.exe -- --help=groff | man2html | sed -e '1,8d' \
|
2020-05-17 19:51:00 +03:00
|
|
|
| tac | sed "1,20d" | tac > $@
|
2020-05-05 18:04:53 +03:00
|
|
|
|
2021-03-05 21:16:56 +03:00
|
|
|
#> website-assets : Builds all the assets necessary for the Catala website
|
2021-02-04 13:17:45 +03:00
|
|
|
website-assets: doc literate_examples grammar.html catala.html js_build build_french_law_library_js
|
2020-05-13 14:52:20 +03:00
|
|
|
|
2020-05-13 15:17:19 +03:00
|
|
|
##########################################
|
|
|
|
# Misceallenous
|
|
|
|
##########################################
|
|
|
|
|
2021-03-05 21:16:56 +03:00
|
|
|
all: dependencies build doc tests literate_examples website-assets build_french_law_library
|
2020-05-13 15:17:19 +03:00
|
|
|
|
2021-03-05 21:16:56 +03:00
|
|
|
#> clean : Clean build artifacts
|
2020-04-20 09:35:22 +03:00
|
|
|
clean:
|
|
|
|
dune clean
|
2020-04-20 10:02:08 +03:00
|
|
|
$(MAKE) -C $(ALLOCATIONS_FAMILIALES_DIR) clean
|
2020-10-04 02:25:37 +03:00
|
|
|
$(MAKE) -C $(US_TAX_CODE_DIR) clean
|
2021-01-16 20:06:22 +03:00
|
|
|
$(MAKE) -C $(TUTORIEL_FR_DIR) clean
|
|
|
|
$(MAKE) -C $(TUTORIAL_EN_DIR) clean
|
2020-10-04 02:25:37 +03:00
|
|
|
$(MAKE) -C $(CODE_GENERAL_IMPOTS_DIR) clean
|
2020-04-19 17:30:18 +03:00
|
|
|
|
2020-04-13 19:57:24 +03:00
|
|
|
inspect:
|
2020-12-21 20:26:01 +03:00
|
|
|
gitinspector -f ml,mli,mly,iro,tex,catala,catala_en,catala_fr,md,fst,mld --grading
|
2020-04-20 20:37:16 +03:00
|
|
|
|
2020-05-13 15:17:19 +03:00
|
|
|
##########################################
|
2020-04-20 20:37:16 +03:00
|
|
|
# Special targets
|
2020-05-13 15:17:19 +03:00
|
|
|
##########################################
|
2020-12-10 20:11:43 +03:00
|
|
|
.PHONY: inspect clean all literate_examples english allocations_familiales pygments \
|
2020-12-21 20:15:53 +03:00
|
|
|
install build doc format dependencies dependencies-ocaml \
|
2021-03-05 21:16:56 +03:00
|
|
|
catala.html help
|