-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
61 lines (44 loc) · 1.89 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
.PHONY: all clean distclean setup build doc install test
all: build
NAME=openflow
J=4
UNIX ?= $(shell if [ $(MIRAGE_OS) = "unix" ]; then echo --enable-unix; else echo --disable-unix; fi)
DIRECT ?= $(shell if [ $(MIRAGE_NET) = "direct" ]; then echo --enable-direct; else echo --disable-direct; fi)
XEN ?= $(shell if [ $(MIRAGE_OS) = "xen" ]; then echo --enable-xen; else echo --disable-xen; fi)
caml_path ?= $(shell ocamlfind printconf path)
# MIRAGE = --enable-mirage
-include Makefile.config
setup.ml: _oasis
oasis setup
setup.data: setup.ml
ocaml setup.ml -configure $(UNIX) $(XEN) $(DIRECT)
clean: setup.data
ocaml setup.ml -clean $(OFLAGS)
rm -f setup.data setup.log setup.ml
distclean: setup.ml setup.data
ocaml setup.ml -distclean $(OFLAGS)
rm -f setup.data setup.log setup.ml
setup: setup.data
build: setup.data $(wildcard lib/*.ml)
ocaml setup.ml -build -cflags -bin-annot -j $(J) $(OFLAGS) $(DR)
ifeq ($(MIRAGE_OS), xen)
ld -d -nostdlib -m elf_x86_64 -T $(caml_path)/mirage-xen/mirage-x86_64.lds \
$(caml_path)/mirage-xen/x86_64.o _build/switch/xen_switch.nobj.o \
$(caml_path)/mirage-xen/libocaml.a $(caml_path)/mirage-xen/libxen.a \
$(caml_path)/mirage-xen/libxencaml.a $(caml_path)/mirage-xen/libdiet.a \
$(caml_path)/mirage-xen/libm.a $(caml_path)/mirage-xen/longjmp.o \
-o ofswitch.xen
ld -d -nostdlib -m elf_x86_64 -T $(caml_path)/mirage-xen/mirage-x86_64.lds \
$(caml_path)/mirage-xen/x86_64.o _build/controller/xen_controller.nobj.o \
$(caml_path)/mirage-xen/libocaml.a $(caml_path)/mirage-xen/libxen.a \
$(caml_path)/mirage-xen/libxencaml.a $(caml_path)/mirage-xen/libdiet.a \
$(caml_path)/mirage-xen/libm.a $(caml_path)/mirage-xen/longjmp.o \
-o ofcontroller.xen
endif
doc: setup.data setup.ml
ocaml setup.ml -doc -j $(J) $(OFLAGS)
install:
ocamlfind remove $(NAME)
ocaml setup.ml -install $(OFLAGS)
test: build
ocaml setup.ml -test