-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile.encode
41 lines (33 loc) · 1008 Bytes
/
Makefile.encode
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
#
# 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
TARGET = ./bin/suit_manifest_encode
SRCS = examples/suit_manifest_encode_main.c examples/suit_examples_common.c examples/suit_examples_cose.c src/suit_common.c src/suit_digest.c src/suit_cose.c src/suit_manifest_encode.c src/suit_manifest_decode.c src/suit_manifest_print.c
OBJDIR = ./obj
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
$(TARGET): $(OBJS)
mkdir -p ./bin
$(CC) -o $@ $^ $(LDFLAGS)
$(OBJDIR)/%.o: %.c
mkdir -p $(dir $@)
$(CC) $(CFLAGS) $(INC) -o $@ -c $<
.PHONY: all test clean
all: $(TARGET)
OUTPUT := ./testfiles/suit_manifest_expX.cbor
test: all
$(TARGET) $(OUTPUT)
clean:
rm -f $(OBJS) $(TARGET)