make_cdilib 2.87 KB
Newer Older
Uwe Schulzweida's avatar
Cleanup  
Uwe Schulzweida committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh
#
# combine source code into one module
# easier to compile -- no make file needed
#
# pretty generic script -- just echos, cats and greps.
#
#
PROG=cdilib.c
echo "combining source code into one module"
echo "output is ${PROG}"
#set -x

rm -f ${PROG}

DATE=`date`

18
19
20
21
if test -f config.h ; then
   CDILIBVERSION=`grep PACKAGE_VERSION config.h | cut -f3 -d" "`
fi

Uwe Schulzweida's avatar
Cleanup  
Uwe Schulzweida committed
22
23
24
25
cat > ${PROG} << EOR

/* Generated automatically from $USER on $DATE */

26
27
/* CDILIB_VERSION=$CDILIBVERSION */

Uwe Schulzweida's avatar
Cleanup  
Uwe Schulzweida committed
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#if  defined  (HAVE_CONFIG_H)
#  include "config.h"
#endif

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>
#include <float.h>
#include <math.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

#if ! defined (HAVE_CONFIG_H)
#  define  HAVE_LIBGRIB      1
#  define  HAVE_LIBSERVICE   1
#  define  HAVE_LIBEXTRA     1
#  define  HAVE_LIBIEG       1
#endif

EOR

Uwe Schulzweida's avatar
Uwe Schulzweida committed
55
c="dmemory.c         \
Uwe Schulzweida's avatar
Cleanup  
Uwe Schulzweida committed
56
   dmemory.h         \
Uwe Schulzweida's avatar
Uwe Schulzweida committed
57
   taxis.c           \
Uwe Schulzweida's avatar
Cleanup  
Uwe Schulzweida committed
58
   error.c           \
59
   timebase.c        \
Uwe Schulzweida's avatar
Cleanup  
Uwe Schulzweida committed
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
   calendar.c        \
   model.c           \
   institution.c     \
   table.c           \
   util.c            \
   varscan.c         \
   vlist.c           \
   vlist_var.c       \
   basetime.c        \
   servicelib.c      \
   extralib.c        \
   ieglib.c          \
   grid_rot.c        \
   grid_gme.c        \
   grid.c            \
   zaxis.c           \
   cdf_int.c         \
   cdi_error.c       \
   stream_int.c      \
   stream.c          \
   stream_history.c  \
   stream_grb.c      \
   stream_srv.c      \
   stream_ext.c      \
   stream_ieg.c      \
   stream_cdf.c      \
   stream_var.c      \
   stream_record.c   \
   tsteps.c          \
   file.c            \
   griblib.c         \
   swap.c            \
   binary.c          \
   cdf.c             \
"

h="cdi_limits.h taxis.h error.h dtypes.h file.h grib.h service.h extra.h \
97
   ieg.h cdi.h timebase.h calendar.h \
Uwe Schulzweida's avatar
Uwe Schulzweida committed
98
   basetime.h stream_int.h stream_grb.h  datetime.h stream_cdf.h \
Uwe Schulzweida's avatar
Cleanup  
Uwe Schulzweida committed
99
100
   grib.h tablepar.h table.h util.h grid.h varscan.h binary.h swap.h \
   service.h stream_srv.h stream_ext.h stream_ieg.h cdf_int.h  \
Uwe Schulzweida's avatar
Uwe Schulzweida committed
101
   cdf.h vlist.h"
Uwe Schulzweida's avatar
Cleanup  
Uwe Schulzweida committed
102
103
104
105
106
107

cat $h >> ${PROG}
cat $c | grep -v '#include' >> ${PROG}

if test -f config.h ; then
   cpp -P -DHAVE_CONFIG_H  version.c >>  ${PROG}
108
   CDIVERSION=`grep PACKAGE_VERSION config.h | cut -f3 -d" "`
Uwe Schulzweida's avatar
Cleanup  
Uwe Schulzweida committed
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
else
   echo "error: missing config.h"
fi

# Fortran interface (with -DHAVE_CF_INTERFACE)

echo "#if defined (HAVE_CF_INTERFACE)" >>  ${PROG}
echo "#undef realloc" >>  ${PROG}
echo "#undef malloc" >>  ${PROG}
echo "#undef calloc" >>  ${PROG}
echo "#undef free" >>  ${PROG}
echo "#undef DOUBLE_PRECISION" >>  ${PROG}
cat cfortran.h  >>  ${PROG}
echo "#endif" >>  ${PROG}
cat cdiFortran.c >>  ${PROG}

echo "#undef realloc" >>  ${PROG}
echo "#undef malloc" >>  ${PROG}
echo "#undef calloc" >>  ${PROG}
echo "#undef free" >>  ${PROG}

exit