forked from laurencelundblade/ctoken
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.ossl
116 lines (85 loc) · 4.07 KB
/
Makefile.ossl
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
# Makefile -- UNIX-style make for ctoken using OpenSSL crypto
#
# Copyright (c) 2019-2022, Laurence Lundblade. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
# See BSD-3-Clause license in README.md
#
# ---- comment ----
# This is for OpenSSL Crypto. Adjust CRYPTO_INC and CRYPTO_LIB for the
# location of the openssl libraries on your build machine.
# ---- 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 has been 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
# ---- t_cose location ----
# Adjust this to the location of t_cose in your build environment Be
# sure t_cose was build for crypto lib included in the next section.
#T_COSE_DIR=../../t_cose/master
#T_COSE_INC= -I $(T_COSE_DIR)/inc
#T_COSE_LIB=$(T_COSE_DIR)/libt_cose.a
# This is for reference to t_cose that has been installed in
# /usr/local/ or in some system location. This will typically
# use dynamic linking if there is a libt_cose.so
T_COSE_INC=-I /usr/local/include
T_COSE_LIB=-lt_cose
# ---- crypto configuration -----
# Set up for OpenSSL. This may have to be adjusted for your build environment.
#../../openssl/openssl-1.1.1b/include/openssl -I ../../openssl/openssl-1.1.1b/include
#../../openssl/openssl-1.1.1b/libcrypto.a
CRYPTO_INC=-I /usr/local/include
CRYPTO_LIB=-lcrypto
# ---- compiler configuration -----
# Optimize for size
C_OPTS=-Os -fPIC
# The following are used before a release of t_cose help to make sure
# the code compiles and runs in the most strict environments, but not
# all compilers support them so they are not turned on.
#C_OPTS=-Os -fpic -Wall -pedantic-errors -Wextra -Wshadow -Wparentheses -Wconversion -xc -std=c99
# ---- T_COSE Config and test options ----
TEST_CONFIG_OPTS=
TEST_OBJ=test/eat_test.o test/cwt_test.o test/psa_test.o \
test/run_tests.o test/eat_test_tokens.o
# ---- the main body that is invariant ----
INC=-I inc -I test -I src
ALL_INC=$(CRYPTO_INC) $(QCBOR_INC) $(T_COSE_INC) $(INC)
CFLAGS=$(ALL_INC) $(C_OPTS) $(TEST_CONFIG_OPTS) $(CRYPTO_CONFIG_OPTS)
SRC_OBJ=src/ctoken_encode.o src/ctoken_decode.o src/ctoken_common.o \
src/ctoken_encode_psa.o src/ctoken_decode_psa.o
all: libctoken.a ctoken_test eat_example_ossl
libctoken.a: $(SRC_OBJ) $(CRYPTO_OBJ)
ar -r $@ $^
ctoken_test: main.o $(TEST_OBJ) libctoken.a
cc -o $@ $^ $(QCBOR_LIB) $(T_COSE_LIB) $(CRYPTO_LIB)
eat_example_ossl: examples/eat_example_ossl.o libctoken.a
cc -dead_strip -o $@ $^ $(QCBOR_LIB) $(CRYPTO_LIB) $(T_COSE_LIB)
clean:
rm -f $(SRC_OBJ) $(TEST_OBJ) $(CRYPTO_OBJ) eat_example_ossl t_cose_test libctoken.a main.o examples/eat_example_ossl.o ctoken_test
# ---- source dependecies -----
src/ctoken_encode.o: inc/ctoken/ctoken_encode.h inc/ctoken/ctoken.h \
inc/ctoken/ctoken_cwt_labels.h inc/ctoken/ctoken_eat_labels.h \
src/ctoken_common.h
src/ctoken_decode.o: inc/ctoken/ctoken_decode.h inc/ctoken/ctoken.h \
inc/ctoken/ctoken_cwt_labels.h inc/ctoken/ctoken_eat_labels.h \
src/ctoken_common.h
src/ctoken_encode_psa.o: inc/ctoken/ctoken_encode_psa.h inc/ctoken/ctoken.h \
inc/ctoken/ctoken_psa_labels.h inc/ctoken/ctoken_cwt_labels.h \
inc/ctoken/ctoken_eat_labels.h
src/ctoken_decode_psa.o: inc/ctoken/ctoken_decode_psa.h inc/ctoken/ctoken.h \
inc/ctoken/ctoken_psa_labels.h inc/ctoken/ctoken_cwt_labels.h \
inc/ctoken/ctoken_eat_labels.h
src/ctoken_common.o: src/ctoken_common.h
# ---- test dependencies -----
test/cwt_test.o: test/cwt_test.h $(PUBLIC_INTERFACE)
test/eat_test.o: test/eat_test.h $(PUBLIC_INTERFACE)
# ---- example dependencies ----
eat_example_ossl.o: $(PUBLIC_INTERFACE)