-
Notifications
You must be signed in to change notification settings - Fork 43
/
Makefile
86 lines (67 loc) · 2.96 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
SRC_PATH = $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
HOST_MACHINE = $(shell uname -m)
CONTAINER_TAG = nsm-api
DOCKERFILES_PATH = ${SRC_PATH}/Dockerfiles
BUILD_DOCKERFILE = ${DOCKERFILES_PATH}/Dockerfile.build
TEST_DOCKERFILE = ${DOCKERFILES_PATH}/Dockerfile.test
COMP_VERSION = 1.63.0
STABLE = stable
NIGHTLY = nightly
.build-${HOST_MACHINE}-${COMP_VERSION}: ${DOCKERFILES_PATH}
docker image build \
--build-arg RUST_VERSION=${COMP_VERSION} \
-t ${CONTAINER_TAG}-${COMP_VERSION} -f ${BUILD_DOCKERFILE} ${SRC_PATH}
.build-${HOST_MACHINE}-${STABLE}:
docker image build \
--build-arg RUST_VERSION=${STABLE} \
-t ${CONTAINER_TAG}-${STABLE} -f ${BUILD_DOCKERFILE} ${SRC_PATH}
.build-${HOST_MACHINE}-${NIGHTLY}: ${DOCKERFILES_PATH}
docker image build \
--build-arg RUST_VERSION=${NIGHTLY} \
-t ${CONTAINER_TAG}-${NIGHTLY} -f ${BUILD_DOCKERFILE} ${SRC_PATH}
nsm-api-${COMP_VERSION}: .build-${HOST_MACHINE}-${COMP_VERSION}
docker run \
${CONTAINER_TAG}-${COMP_VERSION} \
cargo test --all
nsm-api-${STABLE}: .build-${HOST_MACHINE}-${STABLE}
docker run \
${CONTAINER_TAG}-${STABLE} \
/bin/bash -c "cargo build && cargo test --all"
nsm-api-${NIGHTLY}: .build-${HOST_MACHINE}-${NIGHTLY}
docker run \
${CONTAINER_TAG}-${NIGHTLY} \
cargo test --all
rustfmt: nsm-api-${STABLE}
docker run \
${CONTAINER_TAG}-${STABLE} \
cargo fmt -v --all -- --check
clippy: nsm-api-${STABLE}
docker run \
${CONTAINER_TAG}-${STABLE} \
cargo clippy --all
eif_dir:
mkdir -p eifs/${HOST_MACHINE}/
.build-nsm-test-cpp-docker:
docker build \
-f ${TEST_DOCKERFILE} -t nsm-test-cpp --target nsm-test-cpp ${SRC_PATH}
.build-nsm-check-docker:
docker build \
-f ${TEST_DOCKERFILE} -t nsm-check --target nsm-check ${SRC_PATH}
.build-nsm-multithread-docker:
docker build \
-f ${TEST_DOCKERFILE} -t nsm-multithread --target nsm-multithread ${SRC_PATH}
.build-nsm-test-cpp-eif: .build-nsm-test-cpp-docker eif_dir
nitro-cli build-enclave --docker-uri nsm-test-cpp:latest --output-file eifs/${HOST_MACHINE}/nsm-test-cpp.eif
.build-nsm-check-eif: .build-nsm-check-docker eif_dir
nitro-cli build-enclave --docker-uri nsm-check:latest --output-file eifs/${HOST_MACHINE}/nsm-check.eif
.build-nsm-multithread-eif: .build-nsm-multithread-docker eif_dir
nitro-cli build-enclave --docker-uri nsm-multithread:latest --output-file eifs/${HOST_MACHINE}/nsm-multithread.eif
run-nsm-test-cpp: .build-nsm-test-cpp-eif
nitro-cli run-enclave --cpu-count 4 --memory 2048 --eif-path eifs/${HOST_MACHINE}/nsm-test-cpp.eif --enclave-cid 16
run-nsm-check-eif: .build-nsm-check-eif
nitro-cli run-enclave --cpu-count 4 --memory 2048 --eif-path eifs/${HOST_MACHINE}/nsm-check.eif --enclave-cid 16
run-nsm-multithread-eif: .build-nsm-multithread-eif
nitro-cli run-enclave --cpu-count 4 --memory 2048 --eif-path eifs/${HOST_MACHINE}/nsm-multithread.eif --enclave-cid 16 --attach-console
clean:
cargo clean