1 |
adcroft |
1.1 |
#!/bin/sh |
2 |
|
|
# |
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 |
adcroft |
1.2 |
# $Header: /u/gcmpack/MITgcm/tools/convert_cpp_cmd2defines,v 1.1 2003/11/24 14:54:12 adcroft Exp $ |
12 |
|
|
# $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.1 |
for ac_option ; do |
26 |
|
|
case $ac_option in |
27 |
adcroft |
1.2 |
-b*) |
28 |
|
|
BARRIER=`echo $ac_option | sed 's/-b//'` |
29 |
|
|
echo "#ifndef ${BARRIER}" |
30 |
|
|
echo "#define ${BARRIER}" |
31 |
|
|
;; |
32 |
adcroft |
1.1 |
-D*) |
33 |
|
|
echo $ac_option | sed 's/-D/#define /' | sed 's/=/ /' |
34 |
|
|
;; |
35 |
|
|
-U*) |
36 |
|
|
echo $ac_option | sed 's/-U/#undef /' | sed 's/=/ /' |
37 |
|
|
;; |
38 |
|
|
*) |
39 |
|
|
echo "/* " $ac_option " */" |
40 |
|
|
;; |
41 |
|
|
esac |
42 |
|
|
done |
43 |
adcroft |
1.2 |
|
44 |
|
|
if test ! "x${BARRIER}" = x ; then |
45 |
|
|
echo "#endif /* ${BARRIER} */" |
46 |
|
|
fi |