forked from TheNewNormal/libxhyve
-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
73 lines (54 loc) · 2.16 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
# -----------------------------------------------------------------------------
# includeing xhyve original config.mk
-include xhyve.mk
# -----------------------------------------------------------------------------
# ocaml-qcow bindings
HAVE_OCAML_QCOW := $(shell if ocamlfind query qcow uri >/dev/null 2>/dev/null ; then echo YES ; else echo NO; fi)
ifeq ($(HAVE_OCAML_QCOW),YES)
CGO_CFLAGS += -DHAVE_OCAML=1 -DHAVE_OCAML_QCOW=1 -DHAVE_OCAML=1
OCAML_WHERE := $(shell ocamlc -where)
OCAML_LDLIBS := -L$(OCAML_WHERE) \
$(shell ocamlfind query cstruct)/cstruct.a \
$(shell ocamlfind query cstruct)/libcstruct_stubs.a \
$(shell ocamlfind query io-page)/io_page.a \
$(shell ocamlfind query io-page)/io_page_unix.a \
$(shell ocamlfind query io-page)/libio_page_unix_stubs.a \
$(shell ocamlfind query lwt.unix)/liblwt-unix_stubs.a \
$(shell ocamlfind query lwt.unix)/lwt-unix.a \
$(shell ocamlfind query lwt.unix)/lwt.a \
$(shell ocamlfind query threads)/libthreadsnat.a \
$(shell ocamlfind query mirage-block-unix)/libmirage_block_unix_stubs.a \
-lasmrun -lbigarray -lunix
build: CGO_CFLAGS += -I$(OCAML_WHERE)
build: CGO_LDFLAGS += $(OCAML_LDLIBS)
build: GO_BUILD_TAGS += qcow2
build: generate
endif
# -----------------------------------------------------------------------------
# make rules
build:
CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" go build -v -x -tags=$(GO_BUILD_TAGS) .
mirage_block_ocaml.o:
go generate -v -x -tags=$(GO_BUILD_TAGS)
generate: mirage_block_ocaml.o
vendor-hyperkit:
-git clone https://github.com/docker/hyperkit.git hyperkit
patch-generate: patch-apply
-cd hyperkit; git diff > ../xhyve.patch
patch-apply: vendor-hyperkit
cd hyperkit; \
for p in $(shell find patch \( -name \*.patch \)); do \
patch -Nl -p1 -F4 < ../$$p; \
done
sync: clean vendor-hyperkit apply-patch
find . \( -name \*.orig -o -name \*.rej \) -delete
for file in $(SRC); do \
cp -f $$file $$(basename $$file) ; \
done
cp -r hyperkit/src/include include
cp hyperkit/README.md README.hyperkit.md
cp hyperkit/README.xhyve.md .
clean:
${RM} *.a *.o *.cmi *.cmx
${RM} -r hyperkit
.PHONY: build generate vendor-hyperkit patch-generate patch-apply sync clean