This repository has been archived by the owner on Jun 13, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (46 loc) · 1.63 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
project_name = react-jsx-ppx
DUNE = opam exec -- dune
opam_file = $(project_name).opam
.PHONY: help
help: ## Print this help message
@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 @@default
.PHONY: build-prod
build-prod: ## Build for production (--profile=prod)
$(DUNE) build --profile=prod @@default
.PHONY: dev
dev: ## Build in watch mode
$(DUNE) build -w @@default
.PHONY: clean
clean: ## Clean artifacts
$(DUNE) clean
.PHONY: test
test: ## Run the unit tests
$(DUNE) build @runtest
.PHONY: test-watch
test-watch: ## Run the unit 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: deps
deps: $(opam_file) ## Alias to update the opam file and install the needed deps
.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
## This creates a target based on the opam file
$(opam_file): dune-project ## Update the package dependencies when new deps are added to dune-project
$(DUNE) build @install
opam install . --deps-only --with-test # Install the new dependencies
.PHONY: init
init: ## Create a local opam switch and setups githooks
git config core.hooksPath .githooks
opam switch create . 4.14.0 --deps-only --with-test