File: tool_analyze.sh

package info (click to toggle)
libxsmm 1.17-4
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 14,976 kB
  • sloc: ansic: 119,587; cpp: 27,680; fortran: 9,179; sh: 5,765; makefile: 5,040; pascal: 2,312; python: 1,812; f90: 1,773
file content (55 lines) | stat: -rwxr-xr-x 2,103 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/env bash
###############################################################################
# Copyright (c) Intel Corporation - All rights reserved.                      #
# This file is part of the LIBXSMM library.                                   #
#                                                                             #
# For information on the license, see the LICENSE file.                       #
# Further information: https://github.com/hfp/libxsmm/                        #
# SPDX-License-Identifier: BSD-3-Clause                                       #
###############################################################################
# Hans Pabst (Intel Corp.)
###############################################################################

HERE=$(cd "$(dirname "$0")" && pwd -P)
MKTEMP=${HERE}/../.mktmp.sh
MAKE=$(command -v make)
GREP=$(command -v grep)
SORT=$(command -v sort)
CXX=$(command -v clang++)
CC=$(command -v clang)
CP=$(command -v cp)
MV=$(command -v mv)

if [ "${MKTEMP}" ] && [ "${MAKE}" ] && \
   [ "${GREP}" ] && [ "${SORT}" ] && \
   [ "${CXX}" ] && [ "${CC}" ] && \
   [ "${CP}" ] && [ "${MV}" ];
then
  cd "${HERE}/.." || exit 1
  ARG=$*
  if [ "" = "${ARG}" ]; then
    ARG=lib
  fi
  TMPF=$("${MKTEMP}" .tool_analyze.XXXXXX)
  ${CP} "${HERE}/../include/libxsmm_config.h" "${TMPF}"
  ${MAKE} -e CXX="${CXX}" CC="${CC}" FC= FORCE_CXX=1 DBG=1 ILP64=1 EFLAGS="--analyze" ${ARG} 2> .analyze.log
  ${MV} "${TMPF}" "${HERE}/../include/libxsmm_config.h"
  ISSUES=$(${GREP} -e "error:" -e "warning:" .analyze.log \
    | ${GREP} -v "make:" \
    | ${GREP} -v "is never read" \
    | ${SORT} -u)
  echo
  echo   "================================================================================"
  if [ "" = "${ISSUES}" ]; then
    echo "SUCCESS"
    echo "================================================================================"
  else
    echo "Errors (warnings)"
    echo "================================================================================"
    echo "${ISSUES}"
    exit 1
  fi
else
  >&2 echo "Error: missing prerequisites!"
  exit 1
fi