forked from openenclave/openenclave
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
42 lines (34 loc) · 1.46 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
# Copyright (c) Open Enclave SDK contributors.
# Licensed under the MIT License.
include ../../config.mk
CRYPTO_LDFLAGS := $(shell pkg-config oeenclave-$(COMPILER) --variable=${OE_CRYPTO_LIB}libs)
APKMAN_INITIALIZE=$(shell oeapkman)
APKMAN_ROOT=$(shell oeapkman root)
CFLAGS=$(shell pkg-config oeenclave-$(COMPILER) --cflags)
LDFLAGS=$(shell pkg-config oeenclave-$(COMPILER) --libs)
INCDIR=$(shell pkg-config oeenclave-$(COMPILER) --variable=includedir)
all:
$(MAKE) build
$(MAKE) keys
$(MAKE) sign
build:
@ echo "Compilers used: $(CC), $(CXX)"
oeedger8r ../sqlite.edl --trusted \
--search-path $(INCDIR) \
--search-path $(INCDIR)/openenclave/edl/sgx
oeapkman add sqlite-dev sqlite-static
$(CC) -g -c $(CFLAGS) -DOE_API_VERSION=2 -I$(APKMAN_ROOT)/usr/include enc.c -o enc.o
$(CC) -g -c $(CFLAGS) -DOE_API_VERSION=2 -I$(APKMAN_ROOT)/usr/include main.c -o main.o
$(CC) -g -c $(CFLAGS) -DOE_API_VERSION=2 -I$(APKMAN_ROOT)/usr/include stubs.c -o stubs.o
$(CC) -g -c $(CFLAGS) -DOE_API_VERSION=2 sqlite_t.c -o sqlite_t.o
$(CC) -o enclave sqlite_t.o enc.o main.o stubs.o \
$(APKMAN_ROOT)/usr/lib/libsqlite3.a \
$(LDFLAGS) $(CRYPTO_LDFLAGS)
sign:
oesign sign -e enclave -c sqlite.conf -k private.pem
clean:
rm -f enc.o main.o stubs.o enclave enclave.signed \
private.pem public.pem sqlite_t.o sqlite_t.h sqlite_t.c sqlite_args.h
keys:
openssl genrsa -out private.pem -3 3072
openssl rsa -in private.pem -pubout -out public.pem