Skip to content

Commit 91b7524

Browse files
committed
Improve Makefile
Signed-off-by: Pedro B S Lisboa <[email protected]>
1 parent d304a96 commit 91b7524

22 files changed

+39
-17
lines changed

Makefile

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,75 @@
11
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" \
25

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
423
default:
524
dune build --auto-promote @install
625

26+
.PHONY: install
727
install:
828
dune install $(INSTALL_ARGS)
929

30+
.PHONY: uninstall
1031
uninstall:
1132
dune uninstall $(INSTALL_ARGS)
1233

13-
reinstall: uninstall reinstall
34+
.PHONY: reinstall
35+
reinstall:
36+
uninstall reinstall
1437

38+
.PHONY: test
1539
test:
1640
dune runtest
1741

42+
.PHONY: doc
1843
doc:
1944
dune build @doc
2045

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
2154
clean:
2255
dune clean
2356

57+
.PHONY: all-supported-ocaml-versions
2458
all-supported-ocaml-versions:
2559
dune build @install --workspace dune-workspace.dev --root .
2660

61+
.PHONY: opam-release
2762
opam-release:
2863
dune-release distrib --skip-build --skip-lint --skip-tests
2964
dune-release publish distrib --verbose
3065
dune-release opam pkg
3166
dune-release opam submit
3267

68+
.PHONY: bench
3369
bench:
3470
dune build bench --profile release
3571
dune exec bench/bench.exe
3672

37-
.PHONY: default install uninstall reinstall clean test doc bench
38-
.PHONY: all-supported-ocaml-versions opam-release
39-
4073
.PHONY: $(TARGET)
4174
example-%:
42-
DUNE_CONFIG__GLOBAL_LOCK=disabled opam exec -- dune exec $*-example
75+
opam exec -- dune exec $*-example

doc/dune

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,2 @@
11
(documentation
22
(package ppxlib))
3-
4-
(rule
5-
(alias doc)
6-
(deps
7-
(glob_files ./images/*))
8-
(action
9-
(progn
10-
(system "mkdir -p %{project_root}/_doc/_html/ppxlib/assets/images")
11-
(system "chmod -R a+rw %{project_root}/_doc/_html/ppxlib/assets/images")
12-
(system
13-
"cp -R ./images/ %{project_root}/_doc/_html/ppxlib/assets/images/"))))

doc/images/attribute_name-ast.png

-57.3 KB
Binary file not shown.

doc/images/attribute_name.png

-14.9 KB
Binary file not shown.
-73.7 KB
Binary file not shown.

doc/images/attribute_payload.png

-14.7 KB
Binary file not shown.

doc/images/extension_node-ast.png

-48.6 KB
Binary file not shown.

doc/images/extension_node.png

-13.7 KB
Binary file not shown.
-41.1 KB
Binary file not shown.

doc/images/extension_node_name.png

-13.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)