-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile.process
48 lines (36 loc) · 1.16 KB
/
Makefile.process
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
#
# 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_process
SRCS = examples/suit_manifest_process_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_process.c src/suit_manifest_decode.c src/suit_manifest_encode.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
.PHONY: all test clean
all: $(TARGET)
$(TARGET): $(OBJS)
mkdir -p ./bin
$(CC) -Xlinker --wrap=suit_fetch_callback -o $@ $^ $(LDFLAGS)
$(OBJDIR)/%.o: %.c
mkdir -p $(dir $@)
$(CC) $(CFLAGS) $(INC) -o $@ -c $<
TEST_NUM := 0 1 2A 2B 3 4 5 U I R # TODO: D and ID
define test-one
$(TARGET) ./testfiles/suit_manifest_exp$(1).cbor
endef
test: all
$(foreach num,$(TEST_NUM),$(call test-one,$(num)))
clean:
rm -f $(OBJS) $(TARGET)