generated from CharlesAverill/OCaml_Project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
79 lines (62 loc) · 1.95 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
.PHONY: default build install uninstall test clean fmt
.IGNORE: fmt
default: build
fmt:
opam exec -- dune build @fmt
opam exec -- dune promote
build: fmt
opam exec -- dune build --profile release
install:
opam exec -- dune install
uninstall:
opam exec -- dune uninstall
clean:
opam exec -- dune clean
git clean -dfXq
test: fmt
opam exec -- dune runtest
testf: fmt
opam exec -- dune runtest -f
OBJS ?= objs/teapot.obj
N ?= 1
run: build
opam exec -- dune exec -- zenith $(OBJS) -n $(N)
raw_run: build
clear
_build/default/bin/main.exe
debug: build
opam exec -- ocamldebug _build/default/zenith/main.bc
DOCS_PATH=docs/
DOCS_NAME=zenith
DOCS_DESCR=Zen Engine for Navigating wIreframes In Three-dimensional Holographic space
DOCS_INDEX_TITLE=$(DOCS_NAME) - $(DOCS_DESCR)
define DOCS_EMBED
<meta content="$(DOCS_NAME)" property="og:title" />\
<meta content="$(DOCS_DESCR)" property="og:description" />\
<meta content="https://github.com/CharlesAverill/zenith" property="og:url" />
endef
cleandocs:
if [ ! -d $(DOCS_PATH) ]; then \
mkdir $(DOCS_PATH); \
fi
rm -rf $(DOCS_PATH)module $(DOCS_PATH)docs $(DOCS_PATH)odoc.support $(DOCS_PATH)index.html
docs: cleandocs build
opam exec -- dune build @doc
mv -f _build/default/_doc/_html/* $(DOCS_PATH)
rm -f $(DOCS_PATH)index.html
mv $(DOCS_PATH)zenith/zenith.html $(DOCS_PATH)index.html
mv $(DOCS_PATH)zenith $(DOCS_PATH)module
@echo "Preparing Index\n--------------"
# Header
sed -i 's/<title>.*<\/title>/<title>$(DOCS_INDEX_TITLE)<\/title>/g' $(DOCS_PATH)index.html
sed -i 's@</head>@$(DOCS_EMBED)\n</head>@g' $(DOCS_PATH)index.html
sed -i 's/..\/odoc.support/odoc.support/g' $(DOCS_PATH)index.html
# Body
sed -i "s@<nav class="odoc-nav">.*gbcamel</nav>@@g" $(DOCS_PATH)index.html
push: cleandocs build
@read -p "Commit message: " input; \
if [ -z "$input" ]; then \
echo "Error: Please provide a valid commit message."; \
exit 1; \
fi; \
git add . && git commit -m "$$input" && git push origin main