-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathMakefile.test
125 lines (89 loc) · 4.23 KB
/
Makefile.test
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
118
119
120
121
122
123
124
# Makefile.test -- Makefile for no-crypto test config for t_cose
#
# Copyright (c) 2019-2023, Laurence Lundblade. All rights reserved.
# Copyright (c) 2020, Michael Eckel, Fraunhofer SIT.
# Copyright (c) 2022, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
# See BSD-3-Clause license in README.md
#
# ---- General comment ----
# This makefile is for t_cose with no crypto library. This
# t_cose configuration is used for bring up on a new platform
# and testing. No external crypto library is needed. The crypto
# that it does use (e.g., SHA-256) is built-in.
# Makefile.common, included below, contains the lists of library, test
# and example object files that are invariant by crypto library.
# ---- QCBOR location ----
# This is for direct reference to QCBOR that is not installed in
# /usr/local or some system location. The path may need to be adjusted
# for your location of QCBOR.
#QCBOR_DIR=../../QCBOR/master
#QCBOR_INC=-I $(QCBOR_DIR)/inc
#QCBOR_LIB=$(QCBOR_DIR)/libqcbor.a
# This is for reference to QCBOR that is installed in /usr/local or in
# some system location. This will typically use dynamic linking if
# there is a libqcbor.so
QCBOR_INC=-I /usr/local/include
QCBOR_LIB=-lqcbor
# ---- crypto configuration -----
# Uses only the internal Brad Conte hash implementation that is bundled with t_cose
CRYPTO_INC=-I crypto_adapters/b_con_hash
CRYPTO_LIB=
CRYPTO_CONFIG_OPTS=-DT_COSE_USE_B_CON_SHA256
CRYPTO_OBJ=crypto_adapters/t_cose_test_crypto.o crypto_adapters/b_con_hash/sha256.o
CRYPTO_EXAMPLE_OBJ=examples/init_keys_test.o
CRYPTO_TEST_OBJ=examples/init_keys_test.o
# ---- other configuration ----
# Use as needed. It has been used to disable features that aren't ready
# or that aren't passing tests
OTHER_OPTS=-DT_COSE_ENABLE_HASH_FAIL_TEST -DT_COSE_DISABLE_SIGN_VERIFY_TESTS
# ---- compiler configuration -----
# This makefile uses a minimum of compiler flags so that it will
# work out-of-the-box with a wide variety of compilers. For example,
# some compilers error out on some of the warnings flags gcc supports.
# The $(CMD_LINE) variable allows passing in extra flags. This is
# used on the stringent build script that is in
# https://github.com/laurencelundblade/tdv. This script is used
# before pushes to master (though not yet through an automated build
# process). See "warn:" below.
C_OPTS=-Os -fPIC
# ---- Aggregate includes and options ----
INC=-I inc -I test -I src -I examples
ALL_INC=$(INC) $(CRYPTO_INC) $(QCBOR_INC)
CFLAGS=$(CMD_LINE) $(ALL_INC) $(C_OPTS) $(CRYPTO_CONFIG_OPTS) $(OTHER_OPTS)
# ---- The build targets ----
.PHONY: all clean warn
all: libt_cose.a t_cose_test t_cose_examples
# run "make warn" as a handy way to compile with the warning flags
# used in the QCBOR release process. See C_OPTS above.
warn:
make -f Makefile.test CMD_LINE="-Wall -Wextra -Wpedantic -Wshadow -Wconversion -Wcast-qual"
# ---- Bring in common definitions of SRC_OBJ, TEST_OBJ, ... -----
include Makefile.common
# --- Finally, the things that actually get built ----
libt_cose.a: $(SRC_OBJ) $(CRYPTO_OBJ)
ar -r $@ $^
# The shared library which is not made by default because of platform
# variability For example MacOS and Linux behave differently and some
# IoT OS's don't support them at all.
libt_cose.so: $(SRC_OBJ) $(CRYPTO_OBJ)
cc -shared $^ -o $@ $(CRYPTO_LIB) $(QCBOR_LIB)
t_cose_test: main.o $(TEST_OBJ) $(CRYPTO_TEST_OBJ) libt_cose.a
cc -dead_strip -o $@ $^ $(QCBOR_LIB) $(CRYPTO_LIB)
crypto_adapters/t_cose_test_crypto.o: crypto_adapters/t_cose_test_crypto.c \
src/t_cose_crypto.h \
src/t_cose_util.h \
inc/t_cose/t_cose_standard_constants.h \
crypto_adapters/b_con_hash/sha256.h
crypto_adapters/b_con_hash/sha256.o: crypto_adapters/b_con_hash/sha256.h
examples/init_keys_test.o: examples/init_keys_test.c \
examples/init_keys.h \
$(PUBLIC_INTERFACE)
t_cose_examples: $(EXAMPLE_OBJ) $(CRYPTO_EXAMPLE_OBJ) libt_cose.a
cc -o $@ $^ $(QCBOR_LIB) $(CRYPTO_LIB)
clean:
rm -f $(SRC_OBJ) $(TEST_OBJ) $(CRYPTO_OBJ) $(CRYPTO_TEST_OBJ) $(EXAMPLE_OBJ) $(CRYPTO_EXAMPLE_OBJ) \
t_cose_examples libt_cose.so \
main.o t_cose_test libt_cose.a libt_cose.so