/[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.2 by adcroft, Tue Nov 25 14:18:50 2003 UTC revision 1.7 by jmc, Tue Aug 28 21:09:11 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 12  Line 12 
12  # $Name$  # $Name$
13    
14  cat << EOF  cat << EOF
15    /*  Warning - this file is automatically generated - do NOT edit  */
16  /*  /*
17   This file created by convert_cpp_cmd2defines with the following command   Created by convert_cpp_cmd2defines with the following command line arguments:
  line arguments:  
18   $@   $@
19  */  */
20    
# Line 22  EOF Line 22  EOF
22    
23  BARRIER=  BARRIER=
24    
25  for ac_option ; do  # Process arguments
26   case $ac_option in  for arg in "$@"
27    do
28     case $arg in
29    -b*)    -b*)
30          BARRIER=`echo $ac_option | sed 's/-b//'`          BARRIER=`echo $arg | sed 's/-b//'`
31          echo "#ifndef ${BARRIER}"          echo "#ifndef ${BARRIER}"
32          echo "#define ${BARRIER}"          echo "#define ${BARRIER}"
33          ;;          ;;
34    -D*)    -D*)
35          echo $ac_option | sed 's/-D/#define /' | sed 's/=/ /'          echo $arg | sed 's/-D/#define /' | sed 's/=/ /'
36          ;;          ;;
37    -U*)    -U*)
38          echo $ac_option | sed 's/-U/#undef  /' | sed 's/=/ /'          echo $arg | sed 's/-U/#undef  /' | sed 's/=/ /'
39          ;;          ;;
40    *)    *)
41          echo "/* " $ac_option " */"          echo "/* " $arg " */"
42          ;;          ;;
43   esac   esac
44  done  done
45    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.22