forked from alavrik/piqi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
97 lines (66 loc) · 1.92 KB
/
Makefile
File metadata and controls
97 lines (66 loc) · 1.92 KB
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
96
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 strip distclean \
ocaml ocaml-install ocaml-uninstall \
doc piqi
# export installation and search path for third-party OCaml dependencies
ifeq ($(MAKECMDGOALS),deps)
OCAMLFIND_DESTDIR := $(PIQI_BUILD)/lib/ocaml
ifeq ($(SYSTEM),$(filter $(SYSTEM),mingw mingw64))
OCAMLFIND_DESTDIR := $(shell cygpath -w $(OCAMLFIND_DESTDIR))
endif
export OCAMLFIND_DESTDIR
endif
# export installation path for third-party deps and piqilib
ifneq ($(findstring ocaml-,$(MAKECMDGOALS)),)
ifneq ($(PIQI_OCAML_DESTDIR),)
export OCAMLFIND_DESTDIR = $(PIQI_OCAML_DESTDIR)
endif
endif
deps: build-dir
$(MAKE) -C deps
$(MAKE) -C deps uninstall install
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
# 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
ocaml:
$(MAKE) -C piqilib
ocaml-install: ocaml-uninstall
test -d $(PIQI_OCAML_DESTDIR) || mkdir -p $(PIQI_OCAML_DESTDIR)
$(MAKE) -C deps install
$(MAKE) -C piqilib install
ocaml-uninstall:
$(MAKE) -C deps uninstall
$(MAKE) -C piqilib uninstall
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