blob: c0e5a053146be8f4e576dcd153892d106bacd4ca [file] [log] [blame]
Jaeden Amerodebb2c02018-06-25 17:25:29 +01001###########################################################################
2#
3# Copyright (c) 2018, ARM Limited, All Rights Reserved
4# SPDX-License-Identifier: Apache-2.0
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17#
18###########################################################################
19
20#
21# Use this file to export an Mbed Crypto release tarball as follows, from the
22# top level of the mbedtls repo:
23#
24# 1) make -f scripts/mbed_crypto.make
25#
26
27.PHONY: all clean FORCE
28
29all: mbedcrypto.tar.gz
30
31#
32# Crypto-necessary library files
33#
34LIB_FILES := \
35 aes.c \
36 aesni.c \
37 arc4.c \
38 asn1parse.c \
39 asn1write.c \
40 base64.c \
41 bignum.c \
42 blowfish.c \
43 camellia.c \
44 ccm.c \
45 cipher.c \
46 cipher_wrap.c \
47 cmac.c \
48 ctr_drbg.c \
49 des.c \
50 ecdsa.c \
51 ecp.c \
52 ecp_curves.c \
53 entropy.c \
54 entropy_poll.c \
55 gcm.c \
56 hmac_drbg.c \
57 md.c \
58 md2.c \
59 md4.c \
60 md5.c \
61 md_wrap.c \
62 oid.c \
63 pem.c \
64 pk.c \
65 pk_wrap.c \
66 pkcs12.c \
67 pkcs5.c \
68 pkparse.c \
69 pkwrite.c \
70 platform.c \
71 platform_util.c \
72 psa_crypto.c \
73 ripemd160.c \
74 rsa_internal.c \
75 rsa.c \
76 sha1.c \
77 sha256.c \
78 sha512.c \
79 xtea.c \
80# Don't delete this line.
81
82#
83# Crypto-necessary include files
84#
85INC_FILES := \
86 mbedcrypto/aes.h \
87 mbedcrypto/aesni.h \
88 mbedcrypto/arc4.h \
89 mbedcrypto/asn1.h \
90 mbedcrypto/asn1write.h \
91 mbedcrypto/base64.h \
92 mbedcrypto/bignum.h \
93 mbedcrypto/blowfish.h \
94 mbedcrypto/bn_mul.h \
95 mbedcrypto/camellia.h \
96 mbedcrypto/ccm.h \
97 mbedcrypto/certs.h \
98 mbedcrypto/check_config.h \
99 mbedcrypto/cipher.h \
100 mbedcrypto/cipher_internal.h \
101 mbedcrypto/cmac.h \
102 mbedcrypto/config.h \
103 mbedcrypto/ctr_drbg.h \
104 mbedcrypto/des.h \
105 mbedcrypto/ecdsa.h \
106 mbedcrypto/ecp.h \
107 mbedcrypto/ecp_internal.h \
108 mbedcrypto/entropy.h \
109 mbedcrypto/entropy_poll.h \
110 mbedcrypto/error.h \
111 mbedcrypto/gcm.h \
112 mbedcrypto/hmac_drbg.h \
113 mbedcrypto/md.h \
114 mbedcrypto/md2.h \
115 mbedcrypto/md4.h \
116 mbedcrypto/md5.h \
117 mbedcrypto/md_internal.h \
118 mbedcrypto/oid.h \
119 mbedcrypto/pem.h \
120 mbedcrypto/pk.h \
121 mbedcrypto/pk_internal.h \
122 mbedcrypto/pkcs11.h \
123 mbedcrypto/pkcs12.h \
124 mbedcrypto/pkcs5.h \
125 mbedcrypto/platform.h \
126 mbedcrypto/platform_util.h \
127 mbedcrypto/ripemd160.h \
128 mbedcrypto/rsa.h \
129 mbedcrypto/rsa_internal.h \
130 mbedcrypto/sha1.h \
131 mbedcrypto/sha256.h \
132 mbedcrypto/sha512.h \
133 mbedcrypto/threading.h \
134 mbedcrypto/xtea.h \
135 psa/crypto.h \
136 psa/crypto_extra.h \
137 psa/crypto_platform.h \
138 psa/crypto_sizes.h \
139 psa/crypto_struct.h \
140# Don't delete this line.
141
142TEST_FILES := \
143 tests/scripts/generate_test_code.py \
144 tests/scripts/mbedtls_test.py \
145 tests/scripts/test_generate_test_code.py \
146 tests/scripts/run-test-suites.pl \
147 tests/suites/helpers.function \
148 tests/suites/host_test.function \
149 tests/suites/main_test.function \
150 tests/suites/target_test.function \
151 tests/suites/test_suite_psa_crypto.data \
152 tests/suites/test_suite_psa_crypto.function \
Gilles Peskine44fed612018-08-21 18:20:20 +0200153 tests/suites/test_suite_psa_crypto_metadata.data \
154 tests/suites/test_suite_psa_crypto_metadata.function \
Jaeden Amerodebb2c02018-06-25 17:25:29 +0100155# Don't delete this line.
156
157OTHER_FILES := \
158 LICENSE \
159 VERSION.txt \
160 programs/psa/crypto_examples.c \
161 programs/psa/key_ladder_demo.c \
Jaeden Amero80e317a2018-07-11 15:45:23 +0100162 programs/psa/key_ladder_demo.sh \
Jaeden Amerodebb2c02018-06-25 17:25:29 +0100163 programs/psa/psa_constant_names.c \
164 scripts/config.pl \
165 scripts/generate_psa_constants.py \
166# Don't delete this line.
167
168# Prepend destination directory
169LIB_FILES := $(addprefix crypto/library/,$(LIB_FILES))
170INC_FILES := $(addprefix crypto/include/,$(INC_FILES))
171TEST_FILES := $(addprefix crypto/,$(TEST_FILES))
172OTHER_FILES := $(addprefix crypto/,$(OTHER_FILES))
173
174define rename_mbedcrypto
175 @sed -i -e 's/Mbed TLS/Mbed Crypto/g' $(1)
176 @sed -i -e 's/mbed TLS/Mbed Crypto/g' $(1)
177 @sed -i -e 's/MBEDTLS_/MBEDCRYPTO_/g' $(1)
178 @sed -i -e 's/mbedtls/mbedcrypto/g' $(1)
179 @sed -i -e 's/MbedTls/MbedCrypto/g' $(1)
180 @sed -i -e 's/include\/mbedtls/include\/mbedcrypto/g' $(1)
181endef
182
183crypto/include/mbedcrypto/config.h: configs/config-psa-crypto.h
184 @echo $@
185 @mkdir -p $(dir $@)
186 @cp $< $@
187 @#Rename the file in the comments
188 @sed -i -e 's/config-psa-crypto.h/config.h/g' $@
189 $(call rename_mbedcrypto,$@)
190
191crypto/tests/data_files/%: tests/data_files/%
192 @echo $@
193 @mkdir -p $(dir $@)
194 @cp $< $@
195 @#Don't rename things inside data files
196
197crypto/include/mbedcrypto/%.h: include/mbedtls/%.h
198 @echo $@
199 @mkdir -p $(dir $@)
200 @cp $< $@
201 $(call rename_mbedcrypto,$@)
202
203crypto/LICENSE: apache-2.0.txt
204 @echo $@
205 @mkdir -p $(dir $@)
206 @cp $< $@
207 @#Don't rename anything in the license
208
209crypto/%: %
210 @echo $@
211 @mkdir -p $(dir $@)
212 @cp $< $@
213 $(call rename_mbedcrypto,$@)
214
215crypto/VERSION.txt: FORCE
Jaeden Amero3a33c012018-09-27 10:14:36 +0100216 @git describe --tags --abbrev=12 --dirty --always > $@
Jaeden Amerodebb2c02018-06-25 17:25:29 +0100217
218mbedcrypto.tar.gz: $(LIB_FILES) $(INC_FILES) $(TEST_FILES) $(OTHER_FILES)
219 @echo $@
220 @tar czf mbedcrypto.tar.gz crypto
221
222clean:
223 @echo clean
224 @rm -rf mbedcrypto.tar.gz \
225 $(LIB_FILES) $(INC_FILES) $(TEST_FILES) $(OTHER_FILES)
226
227FORCE:
228
229# vi: ft=make