|
1 | 1 | INSTALL_ARGS := $(if $(PREFIX),--prefix $(PREFIX),) |
| 2 | +EXAMPLE_DESCRIPTIONS := \ |
| 3 | + "example-building-ast:Demonstrates how to build AST" \ |
| 4 | + "example-destructuring-ast:Demonstrates how to destructure an AST" \ |
2 | 5 |
|
3 | | -# Default rule |
| 6 | +.PHONY: help |
| 7 | +help: |
| 8 | + @echo ""; |
| 9 | + @echo "List of available make commands"; |
| 10 | + @echo ""; |
| 11 | + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'; |
| 12 | + @echo ""; |
| 13 | + @echo "Available examples:"; |
| 14 | + @echo ""; |
| 15 | + @for desc in $(EXAMPLE_DESCRIPTIONS); do \ |
| 16 | + target=$$(echo $$desc | cut -d: -f1); \ |
| 17 | + description=$$(echo $$desc | cut -d: -f2); \ |
| 18 | + printf " \033[36m%-30s\033[0m %s\n" "$$target" "$$description"; \ |
| 19 | + done |
| 20 | + @echo ""; |
| 21 | + |
| 22 | +.PHONY: default |
4 | 23 | default: |
5 | 24 | dune build --auto-promote @install |
6 | 25 |
|
| 26 | +.PHONY: install |
7 | 27 | install: |
8 | 28 | dune install $(INSTALL_ARGS) |
9 | 29 |
|
| 30 | +.PHONY: uninstall |
10 | 31 | uninstall: |
11 | 32 | dune uninstall $(INSTALL_ARGS) |
12 | 33 |
|
13 | | -reinstall: uninstall reinstall |
| 34 | +.PHONY: reinstall |
| 35 | +reinstall: |
| 36 | + uninstall reinstall |
14 | 37 |
|
| 38 | +.PHONY: test |
15 | 39 | test: |
16 | 40 | dune runtest |
17 | 41 |
|
| 42 | +.PHONY: doc |
18 | 43 | doc: |
19 | 44 | dune build @doc |
20 | 45 |
|
| 46 | +.PHONY: doc-dev |
| 47 | +doc-dev: |
| 48 | + dune build @doc --watch & dune_pid=$$!; \ |
| 49 | + trap 'kill $$dune_pid' EXIT; \ |
| 50 | + sleep 2 && open _build/default/_doc/_html/index.html & \ |
| 51 | + wait $$dune_pid |
| 52 | + |
| 53 | +.PHONY: clean |
21 | 54 | clean: |
22 | 55 | dune clean |
23 | 56 |
|
| 57 | +.PHONY: all-supported-ocaml-versions |
24 | 58 | all-supported-ocaml-versions: |
25 | 59 | dune build @install --workspace dune-workspace.dev --root . |
26 | 60 |
|
| 61 | +.PHONY: opam-release |
27 | 62 | opam-release: |
28 | 63 | dune-release distrib --skip-build --skip-lint --skip-tests |
29 | 64 | dune-release publish distrib --verbose |
30 | 65 | dune-release opam pkg |
31 | 66 | dune-release opam submit |
32 | 67 |
|
| 68 | +.PHONY: bench |
33 | 69 | bench: |
34 | 70 | dune build bench --profile release |
35 | 71 | dune exec bench/bench.exe |
36 | 72 |
|
37 | | -.PHONY: default install uninstall reinstall clean test doc bench |
38 | | -.PHONY: all-supported-ocaml-versions opam-release |
39 | | - |
40 | 73 | .PHONY: $(TARGET) |
41 | 74 | example-%: |
42 | | - DUNE_CONFIG__GLOBAL_LOCK=disabled opam exec -- dune exec $*-example |
| 75 | + opam exec -- dune exec $*-example |
0 commit comments