forked from tpm2-software/tpm2-tss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap
executable file
·74 lines (62 loc) · 2.06 KB
/
bootstrap
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
#!/bin/sh
set -e
# generate list of source files for use in Makefile.am
# if you add new source files, you must run ./bootstrap again
src_listvar () {
basedir=$1
suffix=$2
var=$3
find "${basedir}" -name "${suffix}" | LC_ALL=C sort | tr '\n' ' ' | (printf "${var} = " && cat)
echo ""
}
# remove source files from list if their usage depends on a configure option
remove_src () {
files=$1
shift
for x in $*
do
x=$(echo "$x" | sed 's/\//\\\//g')
files=$(echo $files | sed -e "s/$x//")
done
echo $files
}
# generate list of eys source files for use in Makefile.am
# if you add new source files, you must run ./bootstrap again
# files after the var name will be elimenated from list list
src_esys_listvar () {
basedir=$1;
shift;
suffix=$1
shift;
var=$1
shift;
files=$(find "${basedir}" -name "${suffix}" | LC_ALL=C sort | tr '\n' ' ')
files=$(remove_src "${files}" $*)
printf "${var} = ${files}"
echo ""
}
VARS_FILE=src_vars.mk
AUTORECONF=${AUTORECONF:-autoreconf}
echo "Generating file lists: ${VARS_FILE}"
(
src_listvar "src/util" "*.c" "UTIL_C"
src_listvar "src/util" "*.h" "UTIL_H"
printf "UTIL_SRC = \$(UTIL_C) \$(UTIL_H)\n"
src_listvar "src/tss2-sys/" "*.c" "TSS2_SYS_C"
src_listvar "src/tss2-sys/" "*.h" "TSS2_SYS_H"
printf "TSS2_SYS_SRC = \$(TSS2_SYS_H) \$(TSS2_SYS_C)\n"
src_esys_listvar "src/tss2-esys/" "*.h" "TSS2_ESYS_H" src/tss2-esys/esys_crypto_ossl.h src/tss2-esys/esys_crypto_gcrypt.h
src_esys_listvar "src/tss2-esys/" "*.c" "TSS2_ESYS_C" src/tss2-esys/esys_crypto_ossl.c src/tss2-esys/esys_crypto_gcrypt.c
printf "TSS2_ESYS_SRC = \$(TSS2_ESYS_H) \$(TSS2_ESYS_C)\n"
src_listvar "src/tss2-mu" "*.c" "TSS2_MU_C"
src_listvar "src/tss2-mu" "*.h" "TSS2_MU_H"
printf "TSS2_MU_SRC = \$(TSS2_MU_C) \$(TSS2_MU_H)"
) > ${VARS_FILE}
# Do not generate fuzz tests unless environment variable GEN_FUZZ is set to 1
if test "${GEN_FUZZ}0" -eq 10; then
echo "Generating fuzz tests"
script/gen_fuzz.py
else
touch Makefile-fuzz-generated.am
fi
${AUTORECONF} --install --sym $@