2020-05-13 15:17:19 +03:00
|
|
|
##########################################
|
|
|
|
# Variables
|
|
|
|
##########################################
|
|
|
|
|
2021-03-19 19:36:09 +03:00
|
|
|
LATEXMK?=latexmk
|
2020-04-20 10:02:08 +03:00
|
|
|
|
2022-07-20 17:35:51 +03:00
|
|
|
CURR_DIR=examples/$(shell basename $(shell pwd))/
|
|
|
|
|
|
|
|
CATALA=cd ../../; _build/default/compiler/catala.exe \
|
2021-02-01 22:09:16 +03:00
|
|
|
$(CATALA_OPTS) --language=$(CATALA_LANG)
|
2020-04-20 20:37:16 +03:00
|
|
|
|
2022-07-22 13:34:46 +03:00
|
|
|
PLUGIN_DIR=_build/default/compiler/plugins
|
|
|
|
|
2021-03-19 19:36:09 +03:00
|
|
|
help : ../Makefile.common.mk
|
|
|
|
@sed -n 's/^#> //p' $<
|
|
|
|
|
2020-05-13 15:17:19 +03:00
|
|
|
##########################################
|
|
|
|
# Targets
|
|
|
|
##########################################
|
|
|
|
|
2021-03-19 19:36:09 +03:00
|
|
|
#> SCOPE=<ScopeName> <target_file>.run : Runs the interpeter for the scope of the file
|
2021-02-01 22:09:16 +03:00
|
|
|
%.run: %.catala_$(CATALA_LANG)
|
2020-12-10 20:11:43 +03:00
|
|
|
@$(CATALA) Makefile $<
|
2021-03-19 19:36:09 +03:00
|
|
|
$(CATALA) \
|
2020-12-03 20:59:14 +03:00
|
|
|
Interpret \
|
|
|
|
-s $(SCOPE) \
|
|
|
|
$<
|
|
|
|
|
2021-03-19 19:36:09 +03:00
|
|
|
#> <target_file>.ml : Compiles the file to OCaml
|
2021-02-01 22:09:16 +03:00
|
|
|
%.ml: %.catala_$(CATALA_LANG)
|
2022-07-20 17:35:51 +03:00
|
|
|
@$(CATALA) Makefile $(CURR_DIR)$<
|
2021-03-19 19:36:09 +03:00
|
|
|
$(CATALA) \
|
2021-01-28 02:28:28 +03:00
|
|
|
OCaml \
|
2022-07-20 17:35:51 +03:00
|
|
|
$(CURR_DIR)$<
|
2021-01-28 02:28:28 +03:00
|
|
|
|
2022-07-22 18:42:24 +03:00
|
|
|
#> <target_file>_api_web.ml : Compiles the file to OCaml + generates the API web
|
2022-07-22 13:34:46 +03:00
|
|
|
%_api_web.ml: %.catala_$(CATALA_LANG)
|
|
|
|
@$(CATALA) Makefile $(CURR_DIR)$<
|
|
|
|
$(CATALA) \
|
2022-07-29 14:40:43 +03:00
|
|
|
api_web \
|
2022-07-22 13:34:46 +03:00
|
|
|
--plugin-dir=$(PLUGIN_DIR) \
|
|
|
|
$(CURR_DIR)$<
|
|
|
|
|
2022-07-29 14:40:43 +03:00
|
|
|
#> SCOPE=<ScopeName> <target_file>_api_web.ml : Generates the JSON schema
|
|
|
|
%_schema.json: %.catala_$(CATALA_LANG)
|
|
|
|
@$(CATALA) Makefile $(CURR_DIR)$<
|
|
|
|
$(CATALA) \
|
|
|
|
json_schema \
|
|
|
|
--plugin-dir=$(PLUGIN_DIR) \
|
|
|
|
-s $(SCOPE) \
|
|
|
|
$(CURR_DIR)$<
|
|
|
|
|
2021-06-22 15:00:42 +03:00
|
|
|
#> <target_file>.py : Compiles the file to Python
|
|
|
|
%.py: %.catala_$(CATALA_LANG)
|
2022-07-20 17:35:51 +03:00
|
|
|
@$(CATALA) Makefile $(CURR_DIR)$<
|
2021-06-22 15:00:42 +03:00
|
|
|
$(CATALA) \
|
|
|
|
Python \
|
2022-07-20 17:35:51 +03:00
|
|
|
$(CURR_DIR)$<
|
2021-06-22 15:00:42 +03:00
|
|
|
|
2021-03-19 19:36:09 +03:00
|
|
|
#> <target_file>.tex : Weaves the file to LaTeX
|
2021-02-01 22:09:16 +03:00
|
|
|
%.tex: %.catala_$(CATALA_LANG)
|
2022-07-20 17:35:51 +03:00
|
|
|
@$(CATALA) Makefile $(CURR_DIR)$<
|
2020-04-20 10:05:40 +03:00
|
|
|
$(CATALA) \
|
2020-04-29 10:55:49 +03:00
|
|
|
--wrap \
|
2020-04-20 10:02:08 +03:00
|
|
|
LaTeX \
|
2022-07-20 17:35:51 +03:00
|
|
|
$(CURR_DIR)$<
|
2020-04-20 10:02:08 +03:00
|
|
|
|
2022-05-05 15:00:24 +03:00
|
|
|
#> <target_file>.pdf : Weaves the file to PDF (via XeLaTeX)
|
2021-03-19 19:36:09 +03:00
|
|
|
%.pdf: %.tex
|
2022-04-30 00:47:02 +03:00
|
|
|
cd $(@D) && $(LATEXMK) -g -xelatex -halt-on-error -shell-escape $(%F)
|
2021-03-19 19:36:09 +03:00
|
|
|
|
|
|
|
#> <target_file>.html : Weaves the file to HTML
|
|
|
|
%.html: %.catala_$(CATALA_LANG)
|
2022-07-20 17:35:51 +03:00
|
|
|
@$(CATALA) Makefile $(CURR_DIR)$<
|
2020-04-29 10:55:49 +03:00
|
|
|
$(CATALA) \
|
|
|
|
--wrap \
|
|
|
|
HTML \
|
2022-07-20 17:35:51 +03:00
|
|
|
$(CURR_DIR)$<
|
2020-04-29 10:55:49 +03:00
|
|
|
|
2021-10-10 17:45:57 +03:00
|
|
|
%.spellok: %.catala_$(CATALA_LANG) ../whitelist.$(CATALA_LANG)
|
|
|
|
aspell list --lang=$(CATALA_LANG) --mode=markdown --camel-case --add-wordlists=../whitelist.$(CATALA_LANG) <$< | tee "$<".errors
|
|
|
|
@# list of mispelled words must be empty
|
|
|
|
@test ! -s "$<".errors
|
|
|
|
@touch $@
|
|
|
|
|
2020-04-20 10:02:08 +03:00
|
|
|
|
2020-05-13 15:17:19 +03:00
|
|
|
##########################################
|
|
|
|
# Misceallenous
|
|
|
|
##########################################
|
|
|
|
|
2021-03-19 19:36:09 +03:00
|
|
|
#> clean : Removes intermediate files
|
2020-04-20 10:02:08 +03:00
|
|
|
clean:
|
2020-08-08 20:07:28 +03:00
|
|
|
$(LATEXMK) -f -C $(SRC:.catala_$(CATALA_LANG)=.tex)
|
2020-12-18 15:13:51 +03:00
|
|
|
rm -rf $(SRC:.catala_$(CATALA_LANG)=.tex) \
|
|
|
|
$(SRC:.catala_$(CATALA_LANG)=.d) \
|
|
|
|
_minted-$(SRC:.catala_$(CATALA_LANG)=) \
|
2021-06-08 16:09:17 +03:00
|
|
|
$(SRC:.catala_$(CATALA_LANG)=.html) \
|
|
|
|
$(SRC:.catala_$(CATALA_LANG)=.ml) \
|
2022-07-29 14:40:43 +03:00
|
|
|
$(SRC:.catala_$(CATALA_LANG)=_api_web.ml) \
|
|
|
|
$(SRC:.catala_$(CATALA_LANG)=_schema.json)
|
2020-04-20 10:02:08 +03:00
|
|
|
|
2020-08-08 20:07:28 +03:00
|
|
|
include $(wildcard $(SRC:.catala_$(CATALA_LANG)=.d))
|
2020-04-20 20:37:16 +03:00
|
|
|
|
|
|
|
.SECONDARY:
|