forked from moby/vpnkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
77 lines (64 loc) · 1.72 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
REPO_ROOT=$(shell git rev-parse --show-toplevel)
COMMIT_ID=$(shell git rev-parse HEAD)
LICENSEDIRS=$(REPO_ROOT)/repo/licenses
BINDIR?=$(shell pwd)
BINARIES := vpnkit.exe
ARTEFACTS :=
ifeq ($(OS),Windows_NT)
ARTEFACTS += vpnkit.exe
else
ARTEFACTS += vpnkit.tgz
endif
all: $(BINARIES)
.PHONY: install
install: $(BINARIES)
cp $(BINARIES) '$(BINDIR)'
.PHONY: uninstall
uninstall:
cd '$(BINDIR)' && for BINARY in $(BINARIES) ; do \
rm -f $$BINARY ; \
done
artefacts: $(ARTEFACTS)
vpnkit.tgz: vpnkit.exe
mkdir -p _build/root/Contents/Resources/bin
cp vpnkit.exe _build/root/Contents/Resources/bin/vpnkit
dylibbundler -od -b \
-x _build/root/Contents/Resources/bin/vpnkit \
-d _build/root/Contents/Resources/lib \
-p @executable_path/../lib
tar -C _build/root -cvzf vpnkit.tgz Contents
.PHONY: vpnkit.exe
vpnkit.exe:
jbuilder build --dev src/bin/main.exe
cp _build/default/src/bin/main.exe vpnkit.exe
.PHONY: test
test:
jbuilder build --dev src/hostnet_test/main.exe
# One test requires 1026 file descriptors
ulimit -n 1500 && ./_build/default/src/hostnet_test/main.exe
.PHONY: OSS-LICENSES
OSS-LICENSES:
mkdir -p $(LICENSEDIRS)
cd $(LICENSEDIRS) && \
$(OPAMFLAGS) $(REPO_ROOT)/repo/opam-licenses.sh vpnkit
$(REPO_ROOT)/repo/list-licenses.sh $(LICENSEDIRS) > OSS-LICENSES
.PHONY: COMMIT
COMMIT:
@echo $(COMMIT_ID) > COMMIT
.PHONY: clean
clean:
jbuilder clean
rm -rf _build
rm -f vpnkit.exe
rm -f vpnkit.tgz
REPO=../../mirage/opam-repository
PACKAGES=$(REPO)/packages
# until we have https://github.com/ocaml/opam-publish/issues/38
pkg-%:
topkg opam pkg -n $*
mkdir -p $(PACKAGES)/$*
cp -r _build/$*.* $(PACKAGES)/$*/
cd $(PACKAGES) && git add $*
PKGS=$(basename $(wildcard *.opam))
opam-pkg:
$(MAKE) $(PKGS:%=pkg-%)