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

Annotation of /MITgcm/tools/convert_cpp_cmd2defines

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


Revision 1.5 - (hide annotations) (download)
Mon May 24 12:03:51 2010 UTC (13 years, 10 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint63p, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63g, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint63, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62w, checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62z, checkpoint62y, checkpoint62x
Changes since 1.4: +3 -3 lines
- switch to bash (as genmake2 & other scripts);
- put list of arg between double quote ("$@")

1 jmc 1.5 #! /usr/bin/env bash
2 adcroft 1.1 #
3     # Converts -Dmacro to #define macro
4     # and -Umacro to #undef macro
5     # on standard output
6     #
7     # Any options that do not take the form -D* or -U* are placed as comments.
8     #
9     # usage: convert_cpp_cmd2defines [-Dmacro1|-Umacro1] [...]
10     #
11 jmc 1.5 # $Header: /u/gcmpack/MITgcm/tools/convert_cpp_cmd2defines,v 1.4 2003/11/25 17:22:47 edhill Exp $
12 adcroft 1.2 # $Name: $
13 adcroft 1.1
14     cat << EOF
15     /*
16     This file created by convert_cpp_cmd2defines with the following command
17     line arguments:
18     $@
19     */
20    
21     EOF
22    
23 adcroft 1.2 BARRIER=
24    
25 adcroft 1.3 # Process arguments
26 jmc 1.5 for arg in "$@"
27 adcroft 1.3 do
28     case $arg in
29 adcroft 1.2 -b*)
30 adcroft 1.3 BARRIER=`echo $arg | sed 's/-b//'`
31     echo "#ifndef ${BARRIER}"
32     echo "#define ${BARRIER}"
33     ;;
34 adcroft 1.1 -D*)
35 adcroft 1.3 echo $arg | sed 's/-D/#define /' | sed 's/=/ /'
36     ;;
37 adcroft 1.1 -U*)
38 adcroft 1.3 echo $arg | sed 's/-U/#undef /' | sed 's/=/ /'
39     ;;
40 adcroft 1.1 *)
41 adcroft 1.3 echo "/* " $arg " */"
42     ;;
43 adcroft 1.1 esac
44     done
45 adcroft 1.2
46     if test ! "x${BARRIER}" = x ; then
47     echo "#endif /* ${BARRIER} */"
48     fi

  ViewVC Help
Powered by ViewVC 1.1.22