This repository was archived by the owner on Jun 21, 2020. It is now read-only.
File tree 2 files changed +18
-4
lines changed
2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ $(Signed_RustEnclave_Name): $(RustEnclave_Name)
139
139
@echo " SIGN => $@ "
140
140
141
141
.PHONY : enclave
142
- enclave :
142
+ enclave : $( Enclave_EDL_Files )
143
143
mkdir -p ./lib
144
144
$(MAKE ) -C ./enclave/ CARGO_FLAGS=$(App_Rust_Flags ) Rust_target_dir=$(Rust_target_dir )
145
145
Original file line number Diff line number Diff line change 2
2
Rust_Enclave_Name := libenclave.a
3
3
Rust_Enclave_Files := $(wildcard src/* .rs)
4
4
5
- .PHONY : all
5
+ BINDGEN_OUTPUT_FILE := src/auto_ffi.rs
6
+ BINDGEN_RAW_LINES := "\# ![allow(dead_code)] use enigma_types::*; use sgx_types::*;"
7
+ BINDGEN_CLANG_FLAGS := -I/opt/sgxsdk/include -I$(HOME ) /sgx/edl
8
+ BINDGEN_FLAGS := --default-enum-style=rust --rust-target=nightly \
9
+ --no-recursive-whitelist --use-array-pointers-in-arguments \
10
+ --whitelist-function ocall_.* --raw-line $(BINDGEN_RAW_LINES )
6
11
7
- all : $(Rust_Enclave_Name )
12
+
13
+ all : bindgen $(Rust_Enclave_Name )
8
14
9
15
$(Rust_Enclave_Name ) : $(Rust_Enclave_Files )
10
16
ifeq ($(XARGO_SGX ) , 1)
@@ -13,4 +19,12 @@ ifeq ($(XARGO_SGX), 1)
13
19
else
14
20
cargo build $(CARGO_FLAGS)
15
21
cp ./target/$(Rust_target_dir)/libenigmacoreenclave.a ../lib/libenclave.a
16
- endif
22
+ endif
23
+
24
+
25
+ .PHONY : bindgen
26
+ bindgen : Enclave_t.h
27
+ cargo build -p enigma-types # Meant to make sure `enigma-types.h` already exists and can be included.
28
+ echo $(BINDGEN_RAW_LINES )
29
+ bindgen Enclave_t.h $(BINDGEN_FLAGS ) -- $(BINDGEN_CLANG_FLAGS ) > $(BINDGEN_OUTPUT_FILE )
30
+ rustfmt $(BINDGEN_OUTPUT_FILE )
You can’t perform that action at this time.
0 commit comments