forked from rose-compiler/rose
-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_compiler_header_dirs
executable file
·47 lines (37 loc) · 1.98 KB
/
get_compiler_header_dirs
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
#!/bin/sh
# DQ (2/2/2016): This script currently takes the name of the backend
# compiler, but what we want to do instead is hand it the vendor name.
if test $# -ne 3; then
echo "Usage: $0 <compilerName> <language> <compilerVendorName>" >&2
exit 1
fi
compilerName="`basename $1`"
language=$2
compilerVendorName=$3
# echo "In get_compiler_header_dirs: compilerName = $compilerName" >&2
# echo "In get_compiler_header_dirs: compilerVendorName = $compilerVendorName" >&2
# echo "In get_compiler_header_dirs: language = $language" >&2
# case "$compilerName" in
case "$compilerVendorName" in
# DQ (3/21/2014): Added support for the MPI versions of the Intel compiler (as named on LC machines).
# Support for compiling ROSE with GNU g++ compiler
# g++*|gcc*|icpc|icc|mpiicpc|mpiicc|mpicc|mpic++|mpiCC|mpicxx|cc|c++|xt-xcc|xt-xc++|clang|clang++)
gnu|intel|clang)
$1 -v -E -x $language /dev/null 2>&1 | sed -n '/^#include </,/^End/p' | sed '/^#include </d; /^End/d; /\/usr\/include$/d; /\/Library\/Frameworks$/d; /[(]framework directory[)]$/d'
;;
# Support for compiling ROSE with ROSE (must use translator named: "roseTranslator"
# roseTranslator*|testTranslator*|roseCodeGeneration*|testCodeGeneration*|roseAnalysis*|testAnalysis*|roseAstFileIO*|testAstFileIO*)
rose)
tmpFile="/tmp/tmp`uname -n`$$.C"
echo "int main(int argc, char **argv){return 0;}" > "$tmpFile"
#$1 -v -E $tmpFile 2>&1 # | sed -n '/^#include </,/^End/p' | sed '/^#include </d; /^End/d; /\/usr\/include$/d'"
$1 -v -E $tmpFile 2>&1 | sed -n '/^#include </,/^End/p' | sed '/^#include </d; /^End/d; /\/usr\/include$/d; /\/Library\/Frameworks$/d; /[(]framework directory[)]$/d'
;;
# DQ (2/2/2016): Added case for unknown compiler vendor (m4 macro will return this value).
unknown) echo "ERROR: Not able to recognize compiler (vendor marked as unknown) $1"
exit 1
;;
*) echo "ERROR: Not able to recognize compiler (error) $1"
exit 1
;;
esac