-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
96 lines (73 loc) · 2.35 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
project_name = html_of_jsx
DUNE = opam exec -- dune
opam_file = $(project_name).opam
.PHONY: help
help: ## Print this help message
@echo "";
@echo "List of available make commands";
@echo "";
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}';
@echo "";
.PHONY: build
build: ## Build the project, including non installable libraries and executables
$(DUNE) build @all
.PHONY: build-prod
build-prod: ## Build for production (--profile=prod)
$(DUNE) build --profile=prod @all
.PHONY: bench
bench: ## Run bench mark executable
$(DUNE) exec bench/bench.exe
.PHONY: dev
dev: ## Build in watch mode
$(DUNE) build -w @all
.PHONY: clean
clean: ## Clean artifacts
$(DUNE) clean
.PHONY: test
test: ## Run the tests
$(DUNE) build @runtest
.PHONY: test-watch
test-watch: ## Run the tests in watch mode
$(DUNE) build @runtest -w
.PHONY: test-promote
test-promote: ## Updates snapshots and promotes it to correct
$(DUNE) build @runtest --auto-promote
.PHONY: format
format: ## Format the codebase with ocamlformat
$(DUNE) build @fmt --auto-promote
.PHONY: format-check
format-check: ## Checks if format is correct
$(DUNE) build @fmt
.PHONY: init
setup-githooks: ## Setup githooks
git config core.hooksPath .githooks
.PHONY: create-switch
create-switch: ## Create opam switch
opam switch create . 5.1.1 --deps-only --with-test -y
.PHONY: install
install: # Install dependencies
opam install . --deps-only --with-test --with-doc -y
opam install -y tiny_httpd ocamlformat ocaml-lsp-server odoc dune-release # Since we don't use latest opam and can use "with-dev-setup" we need to install those deps manually
.PHONY: init
init: setup-githooks create-switch install ## Create a local dev enviroment
.PHONY: demo
demo: ## Run demo executable
$(DUNE) exec demo/server.exe
.PHONY: demo-watch
demo-watch: ## Run demo executable
$(DUNE) exec -w demo/server.exe
.PHONY: demo-client
demo-client: build ## Run client's demo
node _build/default/demo/output/demo/client.mjs
.PHONY: subst
subst: ## Run dune substitute
$(DUNE) subst
.PHONY: docs
docs: ## Generate odoc docs
$(DUNE) build --root . @doc
.PHONY: docs-watch
docs-watch: ## Generate odoc docs
$(DUNE) build --root . -w @doc
.PHONY: docs-serve
docs-serve: ## Open odoc docs with default web browser
open _build/default/_doc/_html/index.html