/
Makefile
70 lines (56 loc) · 1.39 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
.DEFAULT_GOAL := build
project_name = async_app
opam_file = $(project_name).opam
DUNE = opam exec -- dune
.PHONY: build
build:
# Build the app
$(DUNE) build @all
.PHONY: install
install:
# Install the dependencies
opam install --deps-only --with-doc --with-test -y .
.PHONY: dev
dev:
# Create a local opam switch and install deps
opam switch create . 4.10.0 --deps-only
opam install -y ocaml-lsp-server dune
make install
.PHONY: watch
watch:
watchexec -w server \
--exts re,rei,ml,mli,atd,json -r -c \
"$(MAKE) run-debug"
.PHONY: fmt
fmt:
# Format
$(DUNE) build @fmt --auto-promote
.PHONY: test
test:
# Run unit tests
$(DUNE) test --force
.PHONY: run
run:
$(DUNE) exec $(project_name)
.PHONY: run-debug
run-debug:
# Build and run the app with Opium's internal debug messages visible
$(DUNE) exec $(project_name) -- --debug
.PHONY: migrate
migrate:
# Run the database migrations defined in migrate/migrate.ml
$(DUNE) exec migrate
.PHONY: rollback
rollback:
# Run the database rollback defined in migrate/rollback.ml
$(DUNE) exec rollback
.PHONY: deps
# Alias to update the opam file and install the needed deps
deps: $(opam_file)
.PHONY: clean
clean:
$(DUNE) clean
# Update the package dependencies when new deps are added to dune-project
$(opam_file): dune-project
$(DUNE) build @install # Update the $(project_name).opam file
opam install --deps-only --with-doc --with-test -y .