156d4a381SRasmus Villemoes#!/bin/sh 2*b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0 356d4a381SRasmus Villemoes 456d4a381SRasmus Villemoesoutfile="" 556d4a381SRasmus Villemoesnow=`date +%s` 656d4a381SRasmus Villemoes 756d4a381SRasmus Villemoeswhile [ $# -gt 0 ] 856d4a381SRasmus Villemoesdo 956d4a381SRasmus Villemoes case "$1" in 1056d4a381SRasmus Villemoes -o) 1156d4a381SRasmus Villemoes outfile="$2" 1256d4a381SRasmus Villemoes shift 2;; 1356d4a381SRasmus Villemoes -h) 1456d4a381SRasmus Villemoes echo "usage: $0 [-o outfile] <make options/args>" 1556d4a381SRasmus Villemoes exit 0;; 1656d4a381SRasmus Villemoes *) break;; 1756d4a381SRasmus Villemoes esac 1856d4a381SRasmus Villemoesdone 1956d4a381SRasmus Villemoes 2056d4a381SRasmus Villemoesif [ -z "$outfile" ] 2156d4a381SRasmus Villemoesthen 2256d4a381SRasmus Villemoes outfile=`mktemp --tmpdir stackusage.$$.XXXX` 2356d4a381SRasmus Villemoesfi 2456d4a381SRasmus Villemoes 2556d4a381SRasmus VillemoesKCFLAGS="${KCFLAGS} -fstack-usage" make "$@" 2656d4a381SRasmus Villemoes 2756d4a381SRasmus Villemoes# Prepend directory name to file names, remove column information, 2856d4a381SRasmus Villemoes# make file:line/function/size/type properly tab-separated. 2956d4a381SRasmus Villemoesfind . -name '*.su' -newermt "@${now}" -print | \ 3056d4a381SRasmus Villemoes xargs perl -MFile::Basename -pe \ 3156d4a381SRasmus Villemoes '$d = dirname($ARGV); s#([^:]+:[0-9]+):[0-9]+:#$d/$1\t#;' | \ 3256d4a381SRasmus Villemoes sort -k3,3nr > "${outfile}" 3356d4a381SRasmus Villemoes 3456d4a381SRasmus Villemoesecho "$0: output written to ${outfile}" 35