File: find_flags

package info (click to toggle)
gccxml 0.9.0%2Bcvs20100501-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 79,132 kB
  • ctags: 73,371
  • sloc: ansic: 751,436; cpp: 34,175; asm: 26,833; sh: 5,077; makefile: 4,696; lex: 589; awk: 566; perl: 334; yacc: 271; pascal: 86; python: 29
file content (56 lines) | stat: -rwxr-xr-x 1,625 bytes parent folder | download | duplicates (3)
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
56
#!/bin/sh
#=============================================================================
#
#  Program:   GCC-XML
#  Module:    $RCSfile: find_flags,v $
#  Language:  C++
#  Date:      $Date: 2005-04-07 12:51:07 $
#  Version:   $Revision: 1.5 $
#
#  Copyright (c) 2002 Kitware, Inc., Insight Consortium.  All rights reserved.
#  See Copyright.txt for details.
#
#     This software is distributed WITHOUT ANY WARRANTY; without even 
#     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
#     PURPOSE.  See the above copyright notices for more information.
#
#=============================================================================

# Find the GCC executable name.
if test "x$1" = "x" ; then
  if test "x${CXX}" = "x" ; then
    CXX=gcc
  fi
else 
  CXX="$1"
  shift
  CXXFLAGS="$@"
fi

# Find the macro definition options.
MACROS=`echo "" | ${CXX} -x c++ -E -dM ${CXXFLAGS} - 2>/dev/null |
  sed -n '
/^#define / {s/#define \([A-Za-z_][A-Za-z0-9_]*\) \(.*\)/-D\1='\''\2'\''/;p;}
' |
  awk '
BEGIN { first=1 }
/./ { if(first) { printf("%s", $0); first=0 } else { printf(" %s", $0) } }
'`

# Find the include path options.
INCLUDES=`
  echo "" | ${CXX} -v -x c++ -E ${CXXFLAGS} - 2>&1 |
  awk '/^[ \t]*-I\/.* \\\\$/ { printf("%s ",$1) }
       END {printf("\n")}' -
`

# The support headers are located where this script is.
SELFPATH=`echo $0 | sed -n '/\//{s/\/find_flags//;p;}'`
if test "x$SELFPATH" = "x" ; then SELFPATH="." ; fi
SELFPATH=`cd "$SELFPATH" ; pwd`

INCLUDES="-iwrapper\"$SELFPATH\" $INCLUDES"

# Format and print out the options.
OPTIONS="$MACROS -D_WCHAR_T $INCLUDES"
echo $OPTIONS