summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2017-05-25 13:06:04 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2017-05-26 08:35:49 +0200
commit792f9f6992d802bc2ef15b86bdb3544341143df7 (patch)
tree780a3a5d11b671864e05a15f277b1120eca7b70a /scripts
parentfb026d2ab1c6645d4a7c1198f7c86e25f9790a3f (diff)
downloadptxdist-792f9f6992d802bc2ef15b86bdb3544341143df7.tar.gz
ptxdist-792f9f6992d802bc2ef15b86bdb3544341143df7.tar.xz
ptxd_make_00-init: cache the output of ptxd_cross_cc_v
It's always the same and calling the compiler several times has a measurable impact on the startup time. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/ptxd_make_00-init.sh11
1 files changed, 9 insertions, 2 deletions
diff --git a/scripts/lib/ptxd_make_00-init.sh b/scripts/lib/ptxd_make_00-init.sh
index a55846042..0ea48be80 100644
--- a/scripts/lib/ptxd_make_00-init.sh
+++ b/scripts/lib/ptxd_make_00-init.sh
@@ -76,8 +76,15 @@ export -f ptxd_cross_cc
# run cross-gcc with flags and -v
#
ptxd_cross_cc_v() {
- echo 'int main(void){return 0;}' | \
- ptxd_cross_cc -x c -o /dev/null -v - 2>&1
+ local cache="${PTXDIST_TEMPDIR}/ptxd_cross_cc_v"
+ if [ -e "${cache}" ]; then
+ cat "${cache}"
+ else
+ local tmp="$(mktemp "${cache}.XXXXXX")"
+ echo 'int main(void){return 0;}' | \
+ ptxd_cross_cc -x c -o /dev/null -v - 2>&1 | tee "${tmp}"
+ mv "${tmp}" "${cache}"
+ fi
}
export -f ptxd_cross_cc_v