-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.am
121 lines (88 loc) · 2.88 KB
/
Makefile.am
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
## This must come first when building an application that uses Intel
## SGX enclaves.
include $(top_srcdir)/build-aux/sgx_app.am
## It sets the following automake variables:
##
## AM_CPPFLAGS = -I$(SGXSDK_INCDIR)
## AM_LDFLAGS = -L$(SGXSDK_LIBDIR)
##
## And a pattern rule for building proxy functions from EDL files:
##
## %_u.h %_u.c: %.edl
##
## And sets these Makefile variables:
##
## SGXSDK
## SGXSDK_BINDIR
## SGXSDK_INCDIR
## SGXSDK_LIBDIR
## SGXSSL
## SGXSSL_BINDIR
## SGXSSL_INCDIR
## SGXSSL_LIBDIR
## SGX_URTS_LIB
## SGX_EDGER8R
SUBDIRS = Enclave
## Supply additional flags to edger8r here.
##
## SGX_EDGER8R_FLAGS=
## Needed to make our pattern rule work
Enclave.edl: Enclave/Enclave.edl
ln -s $?
Enclave.signed.so: Enclave/Enclave.signed.so
ln -s $?
Enclave/Enclave.signed.so:
make -C Enclave
## Additional automake variables
##
## AM_CPPFLAGS +=
## AM_CFLAGS =
AM_CXXFLAGS = -std=c++11
AM_CPPFLAGS += -fno-builtin-memset @OPENSSL_CPPFLAGS@
## Additional targets to remove with 'make clean'. You must list
## any edger8r generated files here.
CLEANFILES = Enclave_u.c Enclave_u.h Enclave.edl Enclave.signed.so \
policy enclave_sigstruct_raw
## The build target
#server: sp
#bin_PROGRAMS = client sp sigstruct
bin_PROGRAMS = client sigstruct
## You can't use $(wildcard ...) with automake so all source files
## have to be explicitly listed.
common = byteorder.c common.cpp crypto.c hexutil.c fileio.c base64.c \
msgio.cpp logfile.c
## client
client_SOURCES = client.cpp sgx_detect_linux.c sgx_stub.c quote_size.c \
$(common)
nodist_client_SOURCES = Enclave_u.c Enclave_u.h
EXTRA_client_DEPENDENCIES = Enclave.signed.so
BUILT_SOURCES = Enclave_u.c Enclave_u.h
client_LDFLAGS= $(AM_LDFLAGS) @OPENSSL_LDFLAGS@
## sp
#sp_SOURCES = sp.cpp agent_wget.cpp iasrequest.cpp enclave_verify.c $(common)
BUILT_SOURCES += policy
#EXTRA_sp_DEPENDENCIES = Enclave.signed.so
#if AGENT_CURL
#sp_SOURCES += agent_curl.cpp
#endif
## sigstruct (helper app)
sigstruct_SOURCES = sigstruct.cpp crypto.c hexutil.c
## Extract the enclave SIGSTRUCT and use it to calculate MRSIGNER
policy: sigstruct policy.in Enclave.signed.so
$(SGX_SIGN) dump -cssfile enclave_sigstruct_raw -dumpfile /dev/null -enclave Enclave.signed.so
sed -e "s^@MRSIGNER@^`./sigstruct.sh --mrsigner enclave_sigstruct_raw`^" \
-e "s^@MRENCLAVE@^`./sigstruct.sh --mrenclave enclave_sigstruct_raw`^" \
policy.in > policy
rm -f enclave_sigstruct_raw
#sp_LDFLAGS= $(AM_LDFLAGS) @OPENSSL_LDFLAGS@ @CURL_LDFLAGS@
sigstruct_LDFLAGS= $(AM_LDFLAGS) @OPENSSL_LDFLAGS@
## Library flags. At minimum, an Intel SGX application will need:
##
## -l$(SGX_URTS_LIB)
##
## Use the variables, not the actual library names to ensure these
## targets work on simulation builds.
client_LDADD=-l$(SGX_URTS_LIB) -lsgx_ukey_exchange -lcrypto \
-l:libsgx_capable.a -lpthread -ldl
sigstruct_LDADD=-lcrypto
#sp_LDADD=-lcrypto @CURL_LIBS@