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

rm -f ${PROG}

20
DATE=`date +%F`
Uwe Schulzweida's avatar
Cleanup  
Uwe Schulzweida committed
21

22
23
24
25
if test -f config.h ; then
   CDILIBVERSION=`grep PACKAGE_VERSION config.h | cut -f3 -d" "`
fi

Uwe Schulzweida's avatar
Cleanup  
Uwe Schulzweida committed
26
27
cat > ${PROG} << EOR

28
/* Automatically generated by $USER at $DATE, do not edit */
Uwe Schulzweida's avatar
Cleanup  
Uwe Schulzweida committed
29

30
/* CDILIB_VERSION=${CDILIBVERSION} */
31

Uwe Schulzweida's avatar
Cleanup  
Uwe Schulzweida committed
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#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>

Uwe Schulzweida's avatar
Uwe Schulzweida committed
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#if  defined  (HAVE_LIBGRIB_API)
#  include <grib_api.h>
#endif

#if defined (HAVE_MMAP)
#  include <sys/mman.h> /* mmap() is defined in this header */
#endif

#if  defined  (HAVE_LIBPTHREAD)
#  include <pthread.h>
#endif

#if  defined  (HAVE_LIBSZ)
#  include <szlib.h>
#endif

Uwe Schulzweida's avatar
Cleanup  
Uwe Schulzweida committed
66
67
#if ! defined (HAVE_CONFIG_H)
#  define  HAVE_LIBGRIB      1
Uwe Schulzweida's avatar
Uwe Schulzweida committed
68
#  define  HAVE_LIBCGRIBEX   1
Uwe Schulzweida's avatar
Cleanup  
Uwe Schulzweida committed
69
70
71
72
73
74
75
#  define  HAVE_LIBSERVICE   1
#  define  HAVE_LIBEXTRA     1
#  define  HAVE_LIBIEG       1
#endif

EOR

Uwe Schulzweida's avatar
Uwe Schulzweida committed
76
c="dmemory.c         \
Uwe Schulzweida's avatar
Cleanup  
Uwe Schulzweida committed
77
   dmemory.h         \
Uwe Schulzweida's avatar
Uwe Schulzweida committed
78
   taxis.c           \
Uwe Schulzweida's avatar
Cleanup  
Uwe Schulzweida committed
79
   error.c           \
80
   timebase.c        \
Uwe Schulzweida's avatar
Cleanup  
Uwe Schulzweida committed
81
82
83
84
85
   calendar.c        \
   model.c           \
   institution.c     \
   table.c           \
   util.c            \
86
   gaussgrid.c       \
Uwe Schulzweida's avatar
Cleanup  
Uwe Schulzweida committed
87
88
   varscan.c         \
   vlist.c           \
89
   vlist_att.c       \
Uwe Schulzweida's avatar
Cleanup  
Uwe Schulzweida committed
90
91
92
93
94
95
96
97
98
   vlist_var.c       \
   basetime.c        \
   servicelib.c      \
   extralib.c        \
   ieglib.c          \
   grid.c            \
   zaxis.c           \
   cdf_int.c         \
   cdi_error.c       \
Uwe Schulzweida's avatar
Uwe Schulzweida committed
99
   cdi_util.c        \
Uwe Schulzweida's avatar
Cleanup  
Uwe Schulzweida committed
100
101
102
   stream_int.c      \
   stream.c          \
   stream_history.c  \
Uwe Schulzweida's avatar
Uwe Schulzweida committed
103
104
   stream_cgribex.c  \
   stream_gribapi.c  \
Uwe Schulzweida's avatar
Cleanup  
Uwe Schulzweida committed
105
106
107
108
109
110
111
112
113
   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            \
Uwe Schulzweida's avatar
Uwe Schulzweida committed
114
   cgribexlib.c      \
Uwe Schulzweida's avatar
Uwe Schulzweida committed
115
   gribapi.c         \
Uwe Schulzweida's avatar
Cleanup  
Uwe Schulzweida committed
116
117
118
119
120
   swap.c            \
   binary.c          \
   cdf.c             \
"

Uwe Schulzweida's avatar
Uwe Schulzweida committed
121
h="cdi_limits.h taxis.h error.h dtypes.h file.h cgribex.h gribapi.h service.h extra.h \
Uwe Schulzweida's avatar
Uwe Schulzweida committed
122
123
   ieg.h cdi.h timebase.h calendar.h basetime.h datetime.h stream_int.h \
   stream_cgribex.h  stream_gribapi.h  stream_grb.h  stream_cdf.h \
124
   tablepar.h table.h gaussgrid.h grid.h varscan.h binary.h swap.h \
Uwe Schulzweida's avatar
Cleanup  
Uwe Schulzweida committed
125
   service.h stream_srv.h stream_ext.h stream_ieg.h cdf_int.h  \
Uwe Schulzweida's avatar
Uwe Schulzweida committed
126
   cdf.h vlist.h"
Uwe Schulzweida's avatar
Cleanup  
Uwe Schulzweida committed
127

128
129
#cat $h >> ${PROG}
#cat $c | grep -v '#include' | grep -v '#  include' >> ${PROG}
Uwe Schulzweida's avatar
Cleanup  
Uwe Schulzweida committed
130

131
132
133
134
135
136
137
138
139
140
141
for hfile in $h ; do
  cat $srcdir/$hfile  >> ${PROG}
done

for cfile in $c ; do
  cat $srcdir/$cfile | grep -v '#include' | grep -v '#  include' >> ${PROG}
done


if test -f  config.h ; then
   cpp -P -DHAVE_CONFIG_H  -I./ $srcdir/version.c >>  ${PROG}
Uwe Schulzweida's avatar
Cleanup  
Uwe Schulzweida committed
142
143
144
145
146
147
148
149
else
   echo "error: missing config.h"
fi

# Fortran interface (with -DHAVE_CF_INTERFACE)

echo "#if defined (HAVE_CF_INTERFACE)" >>  ${PROG}
echo "#undef realloc" >>  ${PROG}
Uwe Schulzweida's avatar
Uwe Schulzweida committed
150
151
152
echo "#undef malloc"  >>  ${PROG}
echo "#undef calloc"  >>  ${PROG}
echo "#undef free"    >>  ${PROG}
Uwe Schulzweida's avatar
Cleanup  
Uwe Schulzweida committed
153
echo "#undef DOUBLE_PRECISION" >>  ${PROG}
Uwe Schulzweida's avatar
Uwe Schulzweida committed
154
cat $srcdir/cfortran.h   >>  ${PROG}
Uwe Schulzweida's avatar
Cleanup  
Uwe Schulzweida committed
155
echo "#endif" >>  ${PROG}
156
cat $srcdir/cdiFortran.c >>  ${PROG}
Uwe Schulzweida's avatar
Cleanup  
Uwe Schulzweida committed
157
158

echo "#undef realloc" >>  ${PROG}
Uwe Schulzweida's avatar
Uwe Schulzweida committed
159
160
161
echo "#undef malloc"  >>  ${PROG}
echo "#undef calloc"  >>  ${PROG}
echo "#undef free"    >>  ${PROG}
Uwe Schulzweida's avatar
Cleanup  
Uwe Schulzweida committed
162
163

exit