forked from yuichitk/libteep
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.parser
78 lines (62 loc) · 2.26 KB
/
Makefile.parser
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
#
# Copyright (c) 2020 SECOM CO., LTD. All Rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause
#
CFLAGS = -Wall -g
LDFLAGS = $(CMD_LD) -lt_cose -lqcbor -lm
INC = $(CMD_INC) -I ./inc -I ./examples/inc
TAM = ./bin/teep_message_parser_tam
AGENT = ./bin/teep_message_parser_agent
VERIFIER = ./bin/teep_message_parser_verifier
SRCS = examples/teep_examples_common.c examples/teep_examples_cose.c src/teep_common.c src/teep_message_decode.c src/teep_message_print.c src/teep_cose.c
TAM_OBJ = obj/examples/teep_message_parser_tam.o
AGENT_OBJ = obj/examples/teep_message_parser_agent.o
VERIFIER_OBJ = obj/examples/teep_message_parser_verifier.o
OBJDIR = ./obj
OBJS = $(addprefix $(OBJDIR)/,$(patsubst %.c,%.o,$(SRCS)))
COSE_FLAG = _cose
ifeq ($(suit),1)
CFLAGS += -DPARSE_SUIT
LDFLAGS := ../libcsuit/bin/libcsuit.a $(LDFLAGS)
INC += -I ../libcsuit/inc -I ../libcsuit/examples/inc
endif
ifeq ($(debug),1)
CFLAGS += -DALLOW_CBOR_WITHOUT_SIGN1
COSE_FLAG=
endif
ifeq ($(MBEDTLS),1)
# use MbedTLS
CFLAGS += -DLIBTEEP_PSA_CRYPTO_C=1
LDFLAGS += -lmbedcrypto
else
# use OpenSSL
MBEDTLS=0
LDFLAGS += -lcrypto
endif
.PHONY: all run clean debug_test
all: $(TAM) $(AGENT) $(VERIFIER)
include Makefile.common
$(OBJDIR)/%.o: %.c | $(OBJDIR)
$(CC) $(CFLAGS) $(INC) -o $@ -c $<
$(TAM_OBJ): examples/teep_message_parser_main.c
$(CC) $(CFLAGS) $(INC) -DTEEP_ACTOR_TAM=1 -o $@ -c $<
$(AGENT_OBJ): examples/teep_message_parser_main.c
$(CC) $(CFLAGS) $(INC) -DTEEP_ACTOR_AGENT=1 -o $@ -c $<
$(VERIFIER_OBJ): examples/teep_message_parser_main.c
$(CC) $(CFLAGS) $(INC) -DTEEP_ACTOR_VERIFIER=1 -o $@ -c $<
$(TAM): $(OBJS) $(TAM_OBJ)
$(CC) -o $@ $^ $(LDFLAGS)
$(AGENT): $(OBJS) $(AGENT_OBJ)
$(CC) -o $@ $^ $(LDFLAGS)
$(VERIFIER): $(OBJS) $(VERIFIER_OBJ)
$(CC) -o $@ $^ $(LDFLAGS)
run: $(TAM) $(AGENT) $(VERIFIER)
$(AGENT) ./testfiles/query_request$(COSE_FLAG).cbor || exit 1
$(TAM) ./testfiles/query_response$(COSE_FLAG).cbor || exit 1
$(AGENT) ./testfiles/update$(COSE_FLAG).cbor || exit 1
$(TAM) ./testfiles/teep_success$(COSE_FLAG).cbor || exit 1
$(TAM) ./testfiles/teep_error$(COSE_FLAG).cbor || exit 1
$(VERIFIER) ./testfiles/attestation_results$(COSE_FLAG).cbor || exit 1
clean:
$(RM) $(OBJS) $(TAM_OBJ) $(AGENT_OBJ) $(VERIFIER_OBJ) $(TAM) $(AGENT) $(VERIFIER)