blob: 391c914f40cbb09d3b548cb236c5ab614e6002b9 [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 \
153# Don't delete this line.
154
155OTHER_FILES := \
156 LICENSE \
157 VERSION.txt \
158 programs/psa/crypto_examples.c \
159 programs/psa/key_ladder_demo.c \
160 programs/psa/psa_constant_names.c \
161 scripts/config.pl \
162 scripts/generate_psa_constants.py \
163# Don't delete this line.
164
165# Prepend destination directory
166LIB_FILES := $(addprefix crypto/library/,$(LIB_FILES))
167INC_FILES := $(addprefix crypto/include/,$(INC_FILES))
168TEST_FILES := $(addprefix crypto/,$(TEST_FILES))
169OTHER_FILES := $(addprefix crypto/,$(OTHER_FILES))
170
171define rename_mbedcrypto
172 @sed -i -e 's/Mbed TLS/Mbed Crypto/g' $(1)
173 @sed -i -e 's/mbed TLS/Mbed Crypto/g' $(1)
174 @sed -i -e 's/MBEDTLS_/MBEDCRYPTO_/g' $(1)
175 @sed -i -e 's/mbedtls/mbedcrypto/g' $(1)
176 @sed -i -e 's/MbedTls/MbedCrypto/g' $(1)
177 @sed -i -e 's/include\/mbedtls/include\/mbedcrypto/g' $(1)
178endef
179
180crypto/include/mbedcrypto/config.h: configs/config-psa-crypto.h
181 @echo $@
182 @mkdir -p $(dir $@)
183 @cp $< $@
184 @#Rename the file in the comments
185 @sed -i -e 's/config-psa-crypto.h/config.h/g' $@
186 $(call rename_mbedcrypto,$@)
187
188crypto/tests/data_files/%: tests/data_files/%
189 @echo $@
190 @mkdir -p $(dir $@)
191 @cp $< $@
192 @#Don't rename things inside data files
193
194crypto/include/mbedcrypto/%.h: include/mbedtls/%.h
195 @echo $@
196 @mkdir -p $(dir $@)
197 @cp $< $@
198 $(call rename_mbedcrypto,$@)
199
200crypto/LICENSE: apache-2.0.txt
201 @echo $@
202 @mkdir -p $(dir $@)
203 @cp $< $@
204 @#Don't rename anything in the license
205
206crypto/%: %
207 @echo $@
208 @mkdir -p $(dir $@)
209 @cp $< $@
210 $(call rename_mbedcrypto,$@)
211
212crypto/VERSION.txt: FORCE
213 @git describe --tags --abbrev=12 --dirty > $@
214
215mbedcrypto.tar.gz: $(LIB_FILES) $(INC_FILES) $(TEST_FILES) $(OTHER_FILES)
216 @echo $@
217 @tar czf mbedcrypto.tar.gz crypto
218
219clean:
220 @echo clean
221 @rm -rf mbedcrypto.tar.gz \
222 $(LIB_FILES) $(INC_FILES) $(TEST_FILES) $(OTHER_FILES)
223
224FORCE:
225
226# vi: ft=make