--- MITgcm/tools/convert_cpp_cmd2defines 2003/11/24 14:54:12 1.1 +++ MITgcm/tools/convert_cpp_cmd2defines 2012/08/28 21:09:11 1.7 @@ -1,35 +1,48 @@ -#!/bin/sh +#! /usr/bin/env bash # # Converts -Dmacro to #define macro -# and -Umacro to #undef macro +# and -Umacro to #undef macro # on standard output # # Any options that do not take the form -D* or -U* are placed as comments. # # usage: convert_cpp_cmd2defines [-Dmacro1|-Umacro1] [...] # -# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/convert_cpp_cmd2defines,v 1.1 2003/11/24 14:54:12 adcroft Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/convert_cpp_cmd2defines,v 1.7 2012/08/28 21:09:11 jmc Exp $ # $Name: $ cat << EOF +/* Warning - this file is automatically generated - do NOT edit */ /* - This file created by convert_cpp_cmd2defines with the following command - line arguments: + Created by convert_cpp_cmd2defines with the following command line arguments: $@ */ EOF -for ac_option ; do - case $ac_option in +BARRIER= + +# Process arguments +for arg in "$@" +do + case $arg in + -b*) + BARRIER=`echo $arg | sed 's/-b//'` + echo "#ifndef ${BARRIER}" + echo "#define ${BARRIER}" + ;; -D*) - echo $ac_option | sed 's/-D/#define /' | sed 's/=/ /' - ;; + echo $arg | sed 's/-D/#define /' | sed 's/=/ /' + ;; -U*) - echo $ac_option | sed 's/-U/#undef /' | sed 's/=/ /' - ;; + echo $arg | sed 's/-U/#undef /' | sed 's/=/ /' + ;; *) - echo "/* " $ac_option " */" - ;; + echo "/* " $arg " */" + ;; esac done + +if test ! "x${BARRIER}" = x ; then + echo "#endif /* ${BARRIER} */" +fi