-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.ocaml
73 lines (50 loc) · 1.83 KB
/
Makefile.ocaml
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
# -*- makefile -*-
SHELL:=bash
# This is a generic Makefile.ocaml file, intended to be included in a
# top-level Makefile. NOTE that this file in turn attempts to include
# Makefile.local, which you can use to override defaults if needed.
# scratch - the Makefile.ocaml will check here for updates to
# Makefile.ocaml itself; if this path doesn't exist on your system
# there is nothing to worry about
scratch?=/tmp/l/github/scratch
BUILD_DOCS?=#empty for no, otherwise yes
# after building docs, we copy to this dir
PROMOTE_DOCS?=#empty for no, otherwise yes
PROMOTE_DIR?=/tmp/l/github/ocamldocs/$(notdir $(abspath .))
# generic makefile follows ---------------------------------------------
# just -include Makefile.local in your top-level Makefile, not here
# # allow overriding locally
# -include Makefile.local
# NOTE minimal dune/opam files might be at /tmp/l/github/notes/minimal_ocaml_proj/
# allow overriding from main makefile
DUNE?=dune
# default: all
build::
$(DUNE) build @install
# note: add build:: to have more things built
install::
$(DUNE) install --display quiet 2>&1 | tail
uninstall::
$(DUNE) uninstall
clean::
$(DUNE) clean
all::
$(MAKE) Makefile.ocaml
$(MAKE) build
$(MAKE) install
$(if $(BUILD_DOCS), $(MAKE) docs, echo "NOTE: not building docs")
$(if $(PROMOTE_DOCS), $(MAKE) promote_docs, echo "NOTE: not promoting docs")
clean_all::
$(MAKE) clean
$(MAKE) all
SRC:=_build/default/_doc/_html
docs:: FORCE
$(DUNE) build @doc
promote_docs:: FORCE
rsync -vaz $(SRC)/* $(PROMOTE_DIR) 2>&1 | tail
Makefile.ocaml: FORCE
@if test -f $(scratch)/Makefile.ocaml; then diff ./Makefile.ocaml $(scratch)/Makefile.ocaml; fi
# FIXME update Makefile.ocaml itself, from scratch; error if
# different, forcing user to update manually
# https://www.gnu.org/software/make/manual/html_node/Overriding-Makefiles.html
FORCE: ;