-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
62 lines (51 loc) · 1.68 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
# Copyright (C) 2023 Gramine contributors
# SPDX-License-Identifier: BSD-3-Clause
ARCH_LIBDIR ?= /lib/$(shell $(CC) -dumpmachine)
SELF_EXE = target/release/sgx-notary-server
.PHONY: all
all: $(SELF_EXE) sgx-notary-server.manifest
ifeq ($(SGX),1)
all: sgx-notary-server.manifest.sgx sgx-notary-server.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
sgx-notary-server.manifest: sgx-notary-server.manifest.template
gramine-manifest \
-Dentrypoint=$$(command -v gramine-ratls) \
-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.
sgx-notary-server.manifest.sgx sgx-notary-server.sig: sgx_sign
@:
.INTERMEDIATE: sgx_sign
sgx_sign: sgx-notary-server.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
$(GRAMINE) sgx-notary-server
.PHONY: clean
clean:
$(RM) -rf *.token *.sig *.manifest.sgx *.manifest result-* OUTPUT
.PHONY: distclean
distclean: clean
$(RM) -rf target/ Cargo.lock