-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile.teep
119 lines (92 loc) · 3.74 KB
/
Makefile.teep
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
#
# Copyright (c) 2020 SECOM CO., LTD. All Rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause
#
CFLAGS = -Wall -g
LDFLAGS = -lt_cose -lqcbor -lm
INC = -I ./inc -I ./examples/inc
TARGETu = ./bin/suit_for_teep_uri
TARGETi = ./bin/suit_for_teep_integrated
TARGETd = ./bin/suit_for_teep_depending
TARGETr = ./bin/suit_for_teep_delete
SRCu = examples/suit_manifest_for_teep_uri.c
SRCi = examples/suit_manifest_for_teep_integrated.c
SRCd = examples/suit_manifest_for_teep_depend_uri.c
SRCr = examples/suit_manifest_for_teep_delete.c
SRCS = examples/suit_examples_common.c examples/suit_examples_cose.c src/suit_manifest_print.c src/suit_common.c src/suit_manifest_decode.c src/suit_manifest_encode.c src/suit_cose.c src/suit_digest.c
OBJDIR = ./obj
OBJu = $(addprefix $(OBJDIR)/,$(patsubst %.c,%.o,$(SRCu)))
OBJi = $(addprefix $(OBJDIR)/,$(patsubst %.c,%.o,$(SRCi)))
OBJd = $(addprefix $(OBJDIR)/,$(patsubst %.c,%.o,$(SRCd)))
OBJr = $(addprefix $(OBJDIR)/,$(patsubst %.c,%.o,$(SRCr)))
OBJS = $(addprefix $(OBJDIR)/,$(patsubst %.c,%.o,$(SRCS)))
ifeq ($(MBEDTLS),1)
# use MbedTLS
CFLAGS += -DLIBCSUIT_PSA_CRYPTO_C=1
LDFLAGS += -lmbedtls -lmbedx509 -lmbedcrypto
else
# use OpenSSL
LDFLAGS += -lcrypto
endif
.PHONY: all test generate clean
all: $(TARGETu) $(TARGETi) $(TARGETd) $(TARGETr) $(OUTPUTu) $(OUTPUTd) $(OUTPUTi) $(OUTPUTr)
$(TARGETu): $(OBJu) $(OBJS)
mkdir -p ./bin
$(CC) -o $@ $^ $(LDFLAGS)
$(TARGETi): $(OBJi) $(OBJS) $(TCOSE)
mkdir -p ./bin
$(CC) -o $@ $^ $(LDFLAGS) $(TCOSE)
$(TARGETd): $(OBJd) $(OBJS) $(TCOSE)
mkdir -p ./bin
$(CC) -o $@ $^ $(LDFLAGS) $(TCOSE)
$(TARGETr): $(OBJr) $(OBJS) $(TCOSE)
mkdir -p ./bin
$(CC) -o $@ $^ $(LDFLAGS) $(TCOSE)
$(OBJDIR)/%.o: %.c
mkdir -p $(dir $@)
$(CC) $(CFLAGS) $(INC) -o $@ -c $<
URI := https://example.org/8d82573a-926d-4754-9353-32dc29997f74.suit
OUTPUTu := ./testfiles/suit_manifest_expU.cbor
OUTPUTi := ./testfiles/suit_manifest_expI.cbor
OUTPUTd := ./testfiles/suit_manifest_expD.cbor
OUTPUTr := ./testfiles/suit_manifest_expR.cbor
DEPENDENCY := ./testfiles/suit_manifest_expU_fixed.cbor
OUTPUTid := ./testfiles/suit_manifest_expID.cbor
MARKDOWNu := ./testfiles/suit_manifest_expU.md
MARKDOWNi := ./testfiles/suit_manifest_expI.md
MARKDOWNd := ./testfiles/suit_manifest_expD.md
MARKDOWNr := ./testfiles/suit_manifest_expR.md
$(OUTPUTu): $(TARGETu)
$(TARGETu) $(OUTPUTu)
$(DEPENDENCY): $(OUTPUTu)
cp $(OUTPUTu) $(DEPENDENCY)
$(OUTPUTd): $(TARGETd) $(DEPENDENCY)
$(TARGETd) $(DEPENDENCY) -u $(URI) -o $(OUTPUTd)
$(OUTPUTid): $(TARGETd) $(OUTPUTi)
$(TARGETd) $(OUTPUTi) -o $(OUTPUTid)
$(OUTPUTi): $(TARGETi)
$(TARGETi) $(OUTPUTi)
$(OUTPUTr): $(TARGETr)
$(TARGETr) $(OUTPUTr)
generate: $(OUTPUTu) $(OUTPUTi) $(OUTPUTd) $(OUTPUTr) $(OUTPUTid) $(MARKDOWNu) $(MARKDOWNi) $(MARKDOWNd) $(MARKDOWNr)
test: $(TARGETu) $(TARGETi) $(TARGETd) $(TARGETr)
$(TARGETu)
$(TARGETi)
$(TARGETd) $(OUTPUTu) -u $(URI)
$(TARGETd) $(OUTPUTi)
$(TARGETr)
GENERATE_SCRIPT := ./generate_teep_example.sh
PARSER := ./bin/suit_manifest_parser
$(PARSER):
$(MAKE) -f Makefile.parser
$(MARKDOWNu): $(OUTPUTu) $(GENERATE_SCRIPT) $(PARSER)
$(shell $(GENERATE_SCRIPT) "U" "Example 1: SUIT Manifest pointing to URI of the Trusted Component Binary {#suit-uri}")
$(MARKDOWNi): $(OUTPUTi) $(GENERATE_SCRIPT) $(PARSER)
$(shell $(GENERATE_SCRIPT) "I" "Example 2: SUIT Manifest including the Trusted Component Binary {#suit-integrated}")
$(MARKDOWNd): $(OUTPUTd) $(GENERATE_SCRIPT) $(PARSER)
$(shell $(GENERATE_SCRIPT) "D" "Example 3: Supplying Personalization Data for Trusted Component Binary {#suit-personalization}")
$(MARKDOWNr): $(OUTPUTr) $(GENERATE_SCRIPT) $(PARSER)
$(shell $(GENERATE_SCRIPT) "R" "E.4. Example 4: Unlink a Trusted Component {#suit-unlink}")
clean:
rm -f $(OBJS) $(TARGETu) $(TARGETi) $(TARGETd) $(TARGETr)