/[MITgcm]/MITgcm/tools/convert_cpp_cmd2defines
ViewVC logotype

Diff of /MITgcm/tools/convert_cpp_cmd2defines

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1 by adcroft, Mon Nov 24 14:54:12 2003 UTC revision 1.6 by jmc, Fri Jul 6 18:53:14 2012 UTC
# Line 1  Line 1 
1  #!/bin/sh  #! /usr/bin/env bash
2  #  #
3  # Converts -Dmacro to #define macro  # Converts -Dmacro to #define macro
4  #      and -Umacro to #undef macro  #      and -Umacro to #undef macro
5  # on standard output  # on standard output
6  #  #
7  # Any options that do not take the form -D* or -U* are placed as comments.  # Any options that do not take the form -D* or -U* are placed as comments.
# Line 13  Line 13 
13    
14  cat << EOF  cat << EOF
15  /*  /*
16   This file created by convert_cpp_cmd2defines with the following command   This file created by convert_cpp_cmd2defines with the following command line arguments:
  line arguments:  
17   $@   $@
18  */  */
19    
20  EOF  EOF
21    
22  for ac_option ; do  BARRIER=
23   case $ac_option in  
24    # Process arguments
25    for arg in "$@"
26    do
27     case $arg in
28      -b*)
29            BARRIER=`echo $arg | sed 's/-b//'`
30            echo "#ifndef ${BARRIER}"
31            echo "#define ${BARRIER}"
32            ;;
33    -D*)    -D*)
34          echo $ac_option | sed 's/-D/#define /' | sed 's/=/ /'          echo $arg | sed 's/-D/#define /' | sed 's/=/ /'
35          ;;          ;;
36    -U*)    -U*)
37          echo $ac_option | sed 's/-U/#undef  /' | sed 's/=/ /'          echo $arg | sed 's/-U/#undef  /' | sed 's/=/ /'
38          ;;          ;;
39    *)    *)
40          echo "/* " $ac_option " */"          echo "/* " $arg " */"
41          ;;          ;;
42   esac   esac
43  done  done
44    
45    if test ! "x${BARRIER}" = x ; then
46     echo "#endif /* ${BARRIER} */"
47    fi

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.22