-
Notifications
You must be signed in to change notification settings - Fork 36
/
Makefile
96 lines (65 loc) · 1.82 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
ifeq ($(MAKECMDGOALS),distclean)
-include Makefile.config
-include $(PIQI_ROOT)/make/Makefile.dirs
else
include Makefile.config
include $(PIQI_ROOT)/make/Makefile.dirs
endif
DIRS = piqilib src
.PHONY: deps build-dir install test strip distclean \
ocaml ocaml-install ocaml-uninstall \
doc piqi
# export installation path for piqilib
ifneq ($(findstring ocaml-,$(MAKECMDGOALS)),)
ifneq ($(PIQI_OCAML_DESTDIR),)
export OCAMLFIND_DESTDIR = $(PIQI_OCAML_DESTDIR)
endif
endif
deps: build-dir
ifndef OCAMLFIND_TOOLCHAIN
opam install -y --deps-only ./opam
else
$(MAKE) -C deps download
$(MAKE) -C deps
$(MAKE) -C deps uninstall install
endif
build-dir:
mkdir -p build/lib/ocaml
doc:
$(MAKE) -C doc
install:
-install -d $(DESTDIR)$(PIQI_PREFIX)/bin
install src/piqi $(DESTDIR)$(PIQI_PREFIX)/bin
-install -d $(DESTDIR)$(PIQI_PREFIX)/share/man/man1
install -m 644 doc/piqi.1 $(DESTDIR)$(PIQI_PREFIX)/share/man/man1
# especially useful for cross-compilation
STRIP ?= strip
strip:
$(STRIP) src/piqi$(EXE)
# re-generate _piqi.ml from .piqi and copy the latest version of piqilib.ml --
# called manually as "make piqi" when there were changes in the .piqi files or
# to take advantage of new versions of piqic-ocaml and the piqirun.pb runtime
# library
piqi:
$(MAKE) -C piqilib piqi
$(MAKE) -C src piqi
# build bytecode version of the library (it is not built by default to avoid
# unnecessary slowdown of the main build)
ocaml:
$(MAKE) -C piqilib bcl
ocaml-install: ocaml-uninstall
test -d $(PIQI_OCAML_DESTDIR) || mkdir -p $(PIQI_OCAML_DESTDIR)
$(MAKE) -C piqilib install
ocaml-uninstall:
$(MAKE) -C piqilib uninstall
test:
$(MAKE) -C tests
clean::
$(MAKE) -C tests clean
distclean:
if [ -f Makefile.config ]; then \
$(MAKE) -C deps clean; \
$(MAKE) clean; \
rm -rf $(PIQI_BUILD); \
rm Makefile.config; \
fi