#!/bin/sh
#                              -*- Mode: SH -*-
#
# Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
#
# The contents of this file are covered under the licence agreement in the
# file "LICENCE" distributed with Cforall.
#
# time_make --
#
# Author           : Thierry Delisle
# Created On       : Tue Jul 11 15:55:44 2017
# Last Modified By :
# Last Modified On :
# Update Count     : 0
#

set -x
COMPILER=${CXX}
SAFE_COMPILER=$(echo "${CXX}" | sed 's/+/\\+/g')
TMP_FILE=$(mktemp)
FILE=times.out

make -s clean -C src
make CXX="/usr/bin/time -f \"%E %C\" -o ${TMP_FILE} -a ${COMPILER}" -C src
sed -r "s/([0-9]+:[0-9]+\.[0-9]+) ${SAFE_COMPILER} .* ([a-Z0-9/_\-]+\.o).*/\1 \2/" ${TMP_FILE} | \
sed 's/driver_cfa_cpp-//' | \
sort -r -o ${FILE}