#! /usr/bin/env sh # # Converts -Dmacro to #define 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.4 2003/11/25 17:22:47 edhill Exp $ # $Name: hrcube_2 $ cat << EOF /* This file created by convert_cpp_cmd2defines with the following command line arguments: $@ */ EOF 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 $arg | sed 's/-D/#define /' | sed 's/=/ /' ;; -U*) echo $arg | sed 's/-U/#undef /' | sed 's/=/ /' ;; *) echo "/* " $arg " */" ;; esac done if test ! "x${BARRIER}" = x ; then echo "#endif /* ${BARRIER} */" fi