/[MITgcm]/MITgcm/tools/genmake.c90
ViewVC logotype

Annotation of /MITgcm/tools/genmake.c90

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Wed Apr 22 19:15:31 1998 UTC (26 years ago) by cnh
Branch: MAIN
Branch point for: cnh
Initial revision

1 cnh 1.1 #!/bin/csh -f
2     #
3     # $Id$
4     #
5     # Makefile generator for MITgcm UV codes
6     #
7    
8     # Generate make files for CRAY C90 system
9     set mfile = ( Makefile.c90 )
10     set mach = ( 'CRAY UNICOS/C90 ' )
11    
12     # Directories for source, includes, binaries and executables
13     # Note
14     # o If you prefer/need everything under a single directory
15     # copy everything in ../psupp/src, ../model/src,
16     # ../psupp/inc and ../model/inc into a directory and then
17     # edit the paths below to read
18     # set PSUPP_SDIR = ( )
19     # set MODEL_SDIR = ( )
20     # set PSUPP_IDIR = ( )
21     # set MODEL_IDIR = ( )
22     # set TDIR = ( )
23     # set BDIR = ( )
24     # set EDIR = ( )
25     set PSUPP_SDIR = ( ../eesupp/src/ )
26     set MODEL_SDIR = ( ../model/src/ )
27     set PSUPP_IDIR = ( ../eesupp/inc/ )
28     set MODEL_IDIR = ( ../model/inc/ )
29     set TDIR = ( ../tools/ )
30     set BDIR = ( ../bin/ )
31     set EDIR = ( ../exe/ )
32     set EXE = ( barrier )
33    
34     set CPP = ( '/opt/ctl/bin/cpp -P $(INCLUDES) -DUSE_C90' )
35     set FCOMP = ( 'cf77 -c -N 132 -e f -O scalar3,vector3,task1,aggress' )
36     set FCOMP0 = ( 'cf77 -g -N 132 -c' )
37     set LINK = ( 'cf77 -e f -O scalar3,vector3,task1,aggress' )
38     set INCLUDES = ( '-I. -I$(PSUPP_IDIR) -I$(MODEL_IDIR) ' \
39     '-I/usr/local/mpi/include' )
40     set MAKEDEPEND = ( /usr/bin/X11/makedepend )
41    
42     echo "Creating make file ${mfile} "
43     echo "#" > ${mfile}
44     echo "# Multithreaded + multi-processing makefile for $mach " >> ${mfile}
45     echo "# This make file was generated automatically by the command" >> ${mfile}
46     echo "# " \"${0}\" >> ${mfile}
47     echo "# on `hostname`:`pwd` " >> ${mfile}
48     echo "# " `date` >> ${mfile}
49     echo "# by $user" >> ${mfile}
50     echo "# Notes " >> ${mfile}
51     echo "# ===== " >> ${mfile}
52     echo "# C90 parallel threads ar controlled by" >> ${mfile}
53     echo "# setenv NCPUS " >> ${mfile}
54     echo "# " >> ${mfile}
55    
56     cat >> ${mfile} <<EOF
57    
58     # PSUPP_SDIR: Directory holding parallel support routines
59     # MODEL_SDIR: Directory model code
60     # PSUPP_IDIR: Directory holding parallel support header files
61     # MODEL_IDIR: Directory model header files
62     # TDIR : Directory where build tools are stored
63     # BDIR : Directory where object files are written
64     # EDIR : Directory where executable that is generated is written
65     # INCLUDES : Directories searched for header files
66     # CPP : C-preprocessor command
67     # FCOMP : Fortran compiler command
68     # LINK : Command for link editor program
69     # Note
70     # ====
71     # o PSUPP_SDIR ... EDIR can all be set to the current directory if
72     # you want to organise things that way. Alternatively they can be
73     # set to different directories so that code can be kept on a backed
74     # up disk while object files and executables are created on scratch
75     # disks. I prefer this latter setup!
76     # o Under Solaris if the disk on which the compiler is generating
77     # object files and executables is mounted via NFS rather than being
78     # a local SCSI disk compilation times can increase by a factor of
79     # ten!
80     PSUPP_SDIR = ${PSUPP_SDIR}
81     MODEL_SDIR = ${MODEL_SDIR}
82     PSUPP_IDIR = ${PSUPP_IDIR}
83     MODEL_IDIR = ${MODEL_IDIR}
84     TDIR = ${TDIR}
85     BDIR = ${BDIR}
86     EDIR = ${EDIR}
87     INCLUDES = ${INCLUDES}
88     EXE = \$(EDIR)${EXE}
89     EOF
90    
91     echo "# C preprocessor " >> ${mfile}
92     echo 'CPP =' ${CPP} >> ${mfile}
93     echo "# Fortran compiler " >> ${mfile}
94     echo 'FCOMP = '${FCOMP} >> ${mfile}
95     echo 'FCOMP0 = '${FCOMP0} >> ${mfile}
96     echo "# Link editor " >> ${mfile}
97     echo 'LINK = '${LINK} >> ${mfile}
98     echo "# Header dependency" >> ${mfile}
99     echo 'MAKEDEPEND = '${MAKEDEPEND} >> ${mfile}
100     echo " " >> ${mfile}
101    
102    
103     set psupp_files = ( )
104     set psupp_slist = ( )
105     set psupp_olist = ( )
106     if ( ${PSUPP_SDIR} != ${MODEL_SDIR} ) then
107     set flist = `ls -1 ${PSUPP_SDIR} | grep '.*\.F'`
108     if ( "${flist}" != "" ) then
109     foreach f ( $flist )
110     set fname = ( ${f:t} )
111     set pf = ( ${fname:r}.f )
112     set of = ( ${fname:r}.o )
113     echo ${pf}: '$(PSUPP_SDIR)'${fname} >> ${mfile}.$$
114     echo ' @echo Preprocessing $(PSUPP_SDIR)'${fname} >> ${mfile}.$$
115     echo ' @ $(CPP) $(PSUPP_SDIR)'${fname}' > '$pf >> ${mfile}.$$
116     echo ${of}: ${pf} >> ${mfile}.$$
117     echo ' @echo Compiling '${pf} >> ${mfile}.$$
118     # Compile fbar.F without optimisation. This file holds the barrier
119     # routines which rely on shared variables which can be accessed
120     # concurrently. Optimisation knows nothing about parallel access
121     # it assumes sequential semantics and rearranges code on that
122     # basis.
123     if ( "${fname}" != "fbar.F" ) then
124     echo ' @ $(FCOMP) '$pf >> ${mfile}.$$
125     else
126     echo ' @ $(FCOMP0) '$pf >> ${mfile}.$$
127     endif
128     set psupp_files = ( ${psupp_files} ${fname} )
129     set psupp_slist = ( ${psupp_slist} ${f} )
130     set psupp_olist = ( ${psupp_olist} ${of} )
131     end
132     endif
133     endif
134    
135     set model_files = ( )
136     set model_slist = ( )
137     set model_olist = ( )
138     set flist = `ls -1 ${MODEL_SDIR} | grep '.*\.F'`
139     if ( "${flist}" != "" ) then
140     foreach f ( ${flist} )
141     set fname = ( ${f:t} )
142     set pf = ( ${fname:r}.f )
143     set of = ( ${fname:r}.o )
144     echo ${pf}: '$(MODEL_SDIR)'${fname} >> ${mfile}.$$
145     echo ' @echo Preprocessing $(MODEL_SDIR)'${fname} >> ${mfile}.$$
146     echo ' @ $(CPP) $(MODEL_SDIR)'${fname}' > '$pf >> ${mfile}.$$
147     echo ${of}: ${pf} >> ${mfile}.$$
148     echo ' @echo Compiling '${pf} >> ${mfile}.$$
149     echo ' @ $(FCOMP) '$pf >> ${mfile}.$$
150     set model_files = ( ${model_files} ${fname} )
151     set model_slist = ( ${model_slist} ${f} )
152     set model_olist = ( ${model_olist} ${of} )
153     end
154     endif
155    
156     echo " " >> ${mfile}
157     echo "# =========== " >> ${mfile}
158     echo "# File lists " >> ${mfile}
159     echo "# =========== " >> ${mfile}
160     if ( $#psupp_olist == 0 ) then
161     echo 'psupp_objs = ' >> ${mfile}
162     else if ( $#psupp_olist == 1 ) then
163     echo 'psupp_objs = '${psupp_olist} >> ${mfile}
164     else
165     echo 'psupp_objs = '$psupp_olist[1] '\' >> ${mfile}
166     set psupp_count = 2
167     while ( $psupp_count < $#psupp_olist )
168     echo ' '$psupp_olist[$psupp_count] '\' >> ${mfile}
169     @ psupp_count = $psupp_count + 1
170     end
171     echo ' '$psupp_olist[$#psupp_olist] >> ${mfile}
172     endif
173     echo " " >> ${mfile}
174     if ( $#psupp_slist == 0 ) then
175     echo 'psupp_srcs = ' >> ${mfile}
176     else if ( $#psupp_slist == 1 ) then
177     echo 'psupp_srcs = $(PSUPP_SDIR)'${psupp_slist} >> ${mfile}
178     else
179     echo 'psupp_srcs = $(PSUPP_SDIR)'$psupp_slist[1] '\' >> ${mfile}
180     set psupp_count = 2
181     while ( $psupp_count < $#psupp_slist )
182     echo ' $(PSUPP_SDIR)'$psupp_slist[$psupp_count] '\' >> ${mfile}
183     @ psupp_count = $psupp_count + 1
184     end
185     echo ' $(PSUPP_SDIR)'$psupp_slist[$#psupp_slist] >> ${mfile}
186     endif
187     echo " " >> ${mfile}
188     if ( $#psupp_files == 0 ) then
189     echo 'psupp_sfil = ' >> ${mfile}
190     else if ( $#psupp_files == 1 ) then
191     echo 'psupp_sfil = '${psupp_files} >> ${mfile}
192     else
193     echo 'psupp_sfil = '$psupp_files[1] '\' >> ${mfile}
194     set psupp_count = 2
195     while ( $psupp_count < $#psupp_files )
196     echo ' '$psupp_files[$psupp_count] '\' >> ${mfile}
197     @ psupp_count = $psupp_count + 1
198     end
199     echo ' '$psupp_files[$#psupp_files] >> ${mfile}
200     endif
201     echo " " >> ${mfile}
202     if ( $#model_olist == 0 ) then
203     echo 'model_objs = ' >> ${mfile}
204     else if ( $#model_olist == 1 ) then
205     echo 'model_objs = '${model_olist} >> ${mfile}
206     else
207     echo 'model_objs = '$model_olist[1] '\' >> ${mfile}
208     set model_count = 2
209     while ( $model_count < $#model_olist )
210     echo ' '$model_olist[$model_count] '\' >> ${mfile}
211     @ model_count = $model_count + 1
212     end
213     echo ' '$model_olist[$#model_olist] >> ${mfile}
214     endif
215     echo " " >> ${mfile}
216     if ( $#model_slist == 0 ) then
217     echo 'model_srcs = ' >> ${mfile}
218     else if ( $#model_slist == 1 ) then
219     echo 'model_srcs = $(MODEL_SDIR)'${model_slist} >> ${mfile}
220     else
221     echo 'model_srcs = $(MODEL_SDIR)'$model_slist[1] '\' >> ${mfile}
222     set model_count = 2
223     while ( $model_count < $#model_slist )
224     echo ' $(MODEL_SDIR)'$model_slist[$model_count] '\' >> ${mfile}
225     @ model_count = $model_count + 1
226     end
227     echo ' $(MODEL_SDIR)'$model_slist[$#model_slist] >> ${mfile}
228     endif
229     echo " " >> ${mfile}
230     if ( $#model_files == 0 ) then
231     echo 'model_sfil = ' >> ${mfile}
232     else if ( $#model_files == 1 ) then
233     echo 'model_sfil = '${model_files} >> ${mfile}
234     else
235     echo 'model_sfil = '$model_files[1] '\' >> ${mfile}
236     set model_count = 2
237     while ( $model_count < $#model_files )
238     echo ' '$model_files[$model_count] '\' >> ${mfile}
239     @ model_count = $model_count + 1
240     end
241     echo ' '$model_files[$#model_files] >> ${mfile}
242     endif
243     echo " " >> ${mfile}
244     echo 'objs = $(psupp_objs) $(model_objs)' >> ${mfile}
245     echo 'srcs = $(psupp_srcs) $(model_srcs)' >> ${mfile}
246     echo 'sfil = $(psupp_sfil) $(model_sfil)' >> ${mfile}
247     echo " " >> ${mfile}
248     echo "# =========== " >> ${mfile}
249     echo "# Begin rules " >> ${mfile}
250     echo "# =========== " >> ${mfile}
251     echo " " >> ${mfile}
252     echo '$(EXE): $(objs) ' >> ${mfile}
253     echo ' $(LINK) -o $(EXE) $(objs)' >> ${mfile}
254     echo " " >> ${mfile}
255     echo 'clean: ' >> ${mfile}
256     echo ' rm *.o *.f *.out *.cmp ' >> ${mfile}
257     echo " " >> ${mfile}
258     echo 'depend: ' >> ${mfile}
259     echo ' @-ln -s $(srcs) . ;$(MAKEDEPEND) -o .f -f $(TDIR)'${mfile}' $(INCLUDES) $(sfil) ' >> ${mfile}
260     echo " " >> ${mfile}
261     cat ${mfile}.$$ >> ${mfile}
262     \rm ${mfile}.$$
263    
264     # $ Id: $

  ViewVC Help
Powered by ViewVC 1.1.22