forked from xapi-project/xen-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
136 lines (122 loc) · 5.69 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
include config.mk
XAPIDOC=_build/install/default/xapi/doc
XAPISDK=_build/install/default/xapi/sdk
JOBS = $(shell getconf _NPROCESSORS_ONLN)
PROFILE=release
XAPI_VERSION ?= $(shell git describe --always --dirty || echo "NO_GIT")
MANDIR ?= $(OPTDIR)/man/man1/
.PHONY: build clean test doc python format install uninstall
build:
XAPI_VERSION=$(XAPI_VERSION) dune build @install -j $(JOBS) --profile=$(PROFILE)
# Quickly verify that the code compiles, without actually building it
check:
XAPI_VERSION=$(XAPI_VERSION) dune build @check -j $(JOBS) --profile=$(PROFILE)
clean:
dune clean
test:
XAPI_VERSION=$(XAPI_VERSION) dune runtest --profile=$(PROFILE) --no-buffer -j $(JOBS)
doc:
XAPI_VERSION=$(XAPI_VERSION) dune build --profile=$(PROFILE) ocaml/idl/datamodel_main.exe
dune build --profile=$(PROFILE) -f @ocaml/doc/jsapigen
mkdir -p $(XAPIDOC)/html
cp -r _build/default/ocaml/doc/api $(XAPIDOC)/html
cp _build/default/ocaml/doc/branding.js $(XAPIDOC)/html
cp ocaml/doc/*.js ocaml/doc/*.html ocaml/doc/*.css $(XAPIDOC)/html
dune exec --profile=$(PROFILE) -- ocaml/idl/datamodel_main.exe -closed -markdown $(XAPIDOC)/markdown
cp ocaml/doc/*.dot ocaml/doc/doc-convert.sh $(XAPIDOC)
find ocaml/doc -name "*.md" -not -name "README.md" -exec cp {} $(XAPIDOC)/markdown/ \;
sdk:
cp $(SHAREDIR)/sm/XE_SR_ERRORCODES.xml ocaml/sdk-gen/csharp/XE_SR_ERRORCODES.xml
dune build --profile=$(PROFILE) \
ocaml/sdk-gen/c/gen_c_binding.exe \
ocaml/sdk-gen/csharp/gen_csharp_binding.exe \
ocaml/sdk-gen/java/main.exe \
ocaml/sdk-gen/powershell/gen_powershell_binding.exe
dune build --profile=$(PROFILE) -f\
@ocaml/sdk-gen/c/generate \
@ocaml/sdk-gen/csharp/generate \
@ocaml/sdk-gen/java/generate \
@ocaml/sdk-gen/powershell/generate
mkdir -p $(XAPISDK)/c
mkdir -p $(XAPISDK)/csharp
mkdir -p $(XAPISDK)/java
mkdir -p $(XAPISDK)/powershell
mkdir -p $(XAPISDK)/python
cp -r _build/default/ocaml/sdk-gen/c/autogen/* $(XAPISDK)/c
cp -r _build/default/ocaml/sdk-gen/csharp/autogen/* $(XAPISDK)/csharp
cp -r _build/default/ocaml/sdk-gen/java/autogen/* $(XAPISDK)/java
cp -r _build/default/ocaml/sdk-gen/powershell/autogen/* $(XAPISDK)/powershell
cp -r ocaml/sdk-gen/python/samples $(XAPISDK)/python
cp scripts/examples/python/XenAPI/XenAPI.py $(XAPISDK)/python
sh ocaml/sdk-gen/windows-line-endings.sh $(XAPISDK)/csharp
sh ocaml/sdk-gen/windows-line-endings.sh $(XAPISDK)/powershell
python:
$(MAKE) -C scripts/examples/python build
doc-json:
dune build --profile=$(PROFILE) ocaml/idl/json_backend/gen_json.exe
dune exec --profile=$(PROFILE) -- ocaml/idl/json_backend/gen_json.exe -destdir $(XAPIDOC)/jekyll
format:
dune build @fmt --auto-promote
.PHONY: quality-gate
quality-gate:
./quality-gate.sh
install: build doc sdk doc-json
mkdir -p $(DESTDIR)$(SBINDIR)
mkdir -p $(DESTDIR)$(OPTDIR)/bin
mkdir -p $(DESTDIR)$(MANDIR)
mkdir -p $(DESTDIR)$(LIBEXECDIR)
mkdir -p $(DESTDIR)$(OPTDIR)/debug
mkdir -p $(DESTDIR)/usr/bin
mkdir -p $(DESTDIR)/etc/bash_completion.d
# ocaml/xapi
make -C scripts install
cp -f _build/install/default/bin/xapi $(DESTDIR)$(SBINDIR)/xapi
scripts/install.sh 755 ocaml/quicktest/quicktest $(DESTDIR)$(OPTDIR)/debug
cp -f _build/install/default/bin/quicktestbin $(DESTDIR)$(OPTDIR)/debug/quicktestbin
scripts/install.sh 644 _build/install/default/share/xapi/rbac_static.csv $(DESTDIR)$(OPTDIR)/debug
# ocaml/xsh
cp -f _build/install/default/bin/xsh $(DESTDIR)$(OPTDIR)/bin/xsh
# ocaml/xe-cli
scripts/install.sh 755 _build/install/default/bin/xe $(DESTDIR)$(OPTDIR)/bin/xe
ln -sf $(OPTDIR)/bin/xe $(DESTDIR)/usr/bin/xe
scripts/install.sh 755 ocaml/xe-cli/bash-completion $(DESTDIR)/etc/bash_completion.d/xe
# ocaml/vncproxy
scripts/install.sh 755 _build/install/default/bin/vncproxy $(DESTDIR)$(OPTDIR)/debug/vncproxy
# ocaml/perftest
scripts/install.sh 755 _build/install/default/bin/perftest $(DESTDIR)$(OPTDIR)/debug/perftest
# ocaml/mpathalert
scripts/install.sh 755 _build/install/default/bin/mpathalert $(DESTDIR)$(OPTDIR)/bin/mpathalert
# ocaml/license
scripts/install.sh 755 _build/install/default/bin/daily-license-check $(DESTDIR)$(LIBEXECDIR)/daily-license-check
# ocaml/alerts/certificate
scripts/install.sh 755 _build/install/default/bin/alert-certificate-check $(DESTDIR)$(LIBEXECDIR)/alert-certificate-check
# ocaml/events
scripts/install.sh 755 _build/install/default/bin/event_listen $(DESTDIR)$(OPTDIR)/debug/event_listen
# ocaml/db_process
scripts/install.sh 755 _build/install/default/bin/xapi-db-process $(DESTDIR)$(OPTDIR)/bin/xapi-db-process
# ocaml/cdrommon
scripts/install.sh 755 _build/install/default/bin/cdrommon $(DESTDIR)$(LIBEXECDIR)/cdrommon
# ocaml/database
scripts/install.sh 755 _build/install/default/bin/block_device_io $(DESTDIR)$(LIBEXECDIR)/block_device_io
# ocaml/gencert
scripts/install.sh 755 _build/install/default/bin/gencert $(DESTDIR)$(LIBEXECDIR)/gencert
# ocaml/rrd2csv
scripts/install.sh 755 _build/install/default/bin/rrd2csv $(DESTDIR)$(OPTDIR)/bin/rrd2csv
scripts/install.sh 644 ocaml/rrd2csv/man/rrd2csv.1.man $(DESTDIR)$(MANDIR)/rrd2csv.1
# Libraries
dune install --profile=$(PROFILE) \
xapi-client xapi-database xapi-consts xapi-cli-protocol xapi-datamodel xapi-types \
xen-api-client xen-api-client-lwt xen-api-client-async
# docs
mkdir -p $(DESTDIR)$(DOCDIR)
cp -r $(XAPIDOC)/jekyll $(DESTDIR)$(DOCDIR)
cp -r $(XAPIDOC)/html $(DESTDIR)$(DOCDIR)
cp -r $(XAPIDOC)/markdown $(DESTDIR)$(DOCDIR)
cp $(XAPIDOC)/*.dot $(XAPIDOC)/doc-convert.sh $(DESTDIR)$(DOCDIR)
# sdk
mkdir -p $(DESTDIR)$(SDKDIR)
cp -r $(XAPISDK)/* $(DESTDIR)$(SDKDIR)
find $(DESTDIR)$(SDKDIR) -type f -exec chmod 644 {} \;
uninstall:
# only removes the libraries, which were installed with `dune install`
dune uninstall xapi-client xapi-database xapi-consts xapi-cli-protocol xapi-datamodel xapi-types