forked from Account-Link/teleport-gramine-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
66 lines (53 loc) · 1.61 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
# Copyright (C) 2023 Gramine contributors
# SPDX-License-Identifier: BSD-3-Clause
ARCH_LIBDIR ?= /lib/$(shell $(CC) -dumpmachine)
SELF_EXE = target/release/teleport
DB_FILE = target/release/main.db
.PHONY: all
all: $(SELF_EXE) exex.manifest
ifeq ($(SGX),1)
all: exex.manifest.sgx exex.sig
endif
ifeq ($(DEBUG),1)
GRAMINE_LOG_LEVEL = debug
else
GRAMINE_LOG_LEVEL = error
endif
# Note that we're compiling in release mode regardless of the DEBUG setting passed
# to Make, as compiling in debug mode results in an order of magnitude's difference in
# performance that makes testing by running a benchmark with ab painful. The primary goal
# of the DEBUG setting is to control Gramine's loglevel.
-include $(SELF_EXE).d # See also: .cargo/config.toml
$(SELF_EXE): Cargo.toml
cargo build --release
exex.manifest: exex.manifest.template
gramine-manifest \
-Dlog_level=$(GRAMINE_LOG_LEVEL) \
-Darch_libdir=$(ARCH_LIBDIR) \
-Dself_exe=$(SELF_EXE) \
$< > $@
# Make on Ubuntu <= 20.04 doesn't support "Rules with Grouped Targets" (`&:`),
# see the helloworld example for details on this workaround.
exex.manifest.sgx exex.sig: sgx_sign
@:
.INTERMEDIATE: sgx_sign
sgx_sign: exex.manifest $(SELF_EXE)
gramine-sgx-sign \
--manifest $< \
--output $<.sgx
ifeq ($(SGX),)
GRAMINE = gramine-direct
else
GRAMINE = gramine-sgx
endif
.PHONY: start-gramine-server
start-gramine-server: all
$(eval include private.env)
$(eval export $(shell sed 's/=.*//' private.env))
$(GRAMINE) exex
.PHONY: clean
clean:
$(RM) -rf *.token *.sig *.manifest.sgx *.manifest result-* OUTPUT
.PHONY: distclean
distclean: clean
$(RM) -rf target/ Cargo.lock