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

Contents of /MITgcm/tools/genmake.dec

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


Revision 1.3.2.2 - (show annotations) (download)
Sat Jun 20 21:15:23 1998 UTC (25 years, 10 months ago) by cnh
Branch: checkpoint7-4degree-ref
Changes since 1.3.2.1: +2 -2 lines
Changed executable name to mitgcmuv

1 #!/bin/csh -f
2 #
3 # $Header: /u/gcmpack/models/MITgcmUV/tools/genmake.dec,v 1.3.2.1 1998/06/19 11:59:52 cnh Exp $
4 #
5 # Makefile generator for MITgcm UV codes
6 #
7
8 # Generate make files for Digital UNIX system
9 set mfile = ( Makefile.dec )
10 set mach = ( 'Digital Unix/Alpha' )
11
12 # ***************************************************************************************************
13 # Directories for source, includes, binaries and executables
14 # ***************************************************************************************************
15 # Note
16 # o If you prefer/need everything under a single directory
17 # copy everything in ../eesupp/src, ../model/src,
18 # ../eesupp/inc and model/inc into a directory and then
19 # edit the paths below to read
20 # set EESUPP_SDIR = ( )
21 # set MODEL_SDIR = ( )
22 # set EESUPP_IDIR = ( )
23 # set MODEL_IDIR = ( )
24 # set TDIR = ( )
25 # set BDIR = ( )
26 # set EDIR = ( )
27 set EESUPP_SDIR = ( ../eesupp/src/ )
28 set MODEL_SDIR = ( ../model/src/ )
29 set EESUPP_IDIR = ( ../eesupp/inc/ )
30 set MODEL_IDIR = ( ../model/inc/ )
31 set TDIR = ( ../tools/ )
32 set BDIR = ( ../bin/ )
33 set EDIR = ( ../exe/ )
34 set EXE = ( mitgcmuv )
35
36 # ***************************************************************************************************
37 # Pathnames and arguments for the commands used on this platform
38 # FCOMP1p is used for routines where we want kapf90 directed parallelisation.
39 # FCOMP1s is used for routines where we want kapf90 serial optimisation. Sometimes
40 # it is better to use -O5 and no KAP serial optimisation.
41 # ***************************************************************************************************
42 set CPP = ( '/usr/bin/cpp -P $(INCLUDES) -DTARGET_DEC' )
43 set FCOMP1p = ( 'kapf90 -scan=132 -noconc -cmp=' )
44 set FCOMP1s = ( 'cat >' )
45 set FCOMP2 = ( 'f90 $(INCLUDES) -r8 -extend_source -u -O5 -fast -tune host -automatic -call_shared -c -transform_loops -align dcommons -inline all' )
46 set FCOMP20 = ( 'f90 $(INCLUDES) -extend_source -u -g -c -automatic -align dcommons -r8 -p1 -g1' )
47 set LINK1 = ( 'f77 -O5 -fast -tune host -automatic -call_shared -align dcommons' )
48 set LINK2 = ( '-lfmpi -lmpi -lkmp_osfp10 -pthread' )
49 set INCLUDES = ( '-I. -I$(EESUPP_IDIR) -I$(MODEL_IDIR)' )
50 set MAKEDEPEND = ( /usr/bin/X11/makedepend )
51
52 # ***************************************************************************************************
53 # Write Makefile.xxx header
54 # ***************************************************************************************************
55 echo "Creating make file ${mfile} "
56 echo "#" > ${mfile}
57 echo "# Multithreaded + multi-processing makefile for $mach " >> ${mfile}
58 echo "# This make file was generated automatically by the command" >> ${mfile}
59 echo "# " \"${0}\" >> ${mfile}
60 echo "# on `hostname`:`pwd` " >> ${mfile}
61 echo "# " `date` >> ${mfile}
62 echo "# by $user" >> ${mfile}
63 echo "# Notes " >> ${mfile}
64 echo "# ===== " >> ${mfile}
65 echo "# Digital UNIX parallel threads are controlled by" >> ${mfile}
66 echo "# setenv PARALLEL " >> ${mfile}
67 echo "# The variable KMP_STACKSIZE is also with threaded code" >> ${mfile}
68 echo "# setenv KMP_STACKSIZE 10000000" >> ${mfile}
69 echo "# sets the stack to 10MB. The default size (1MB) is " >> ${mfile}
70 echo "# usually too small. " >> ${mfile}
71 echo "# " >> ${mfile}
72 cat >> ${mfile} <<EOF
73 # EESUPP_SDIR: Directory holding parallel support routines
74 # MODEL_SDIR : Directory model code
75 # EESUPP_IDIR: Directory holding parallel support header files
76 # MODEL_IDIR : Directory model header files
77 # TDIR : Directory where build tools are stored
78 # BDIR : Directory where object files are written
79 # EDIR : Directory where executable that is generated is written
80 # INCLUDES : Directories searched for header files
81 # CPP : C-preprocessor command
82 # FCOMP : Fortran compiler command
83 # LINK : Command for link editor program
84 # Note
85 # ====
86 # o EESUPP_SDIR ... EDIR can all be set to the current directory if
87 # you want to organise things that way. Alternatively they can be
88 # set to different directories so that code can be kept on a backed
89 # up disk while object files and executables are created on scratch
90 # disks. I prefer this latter setup!
91 # o Under Solaris if the disk on which the compiler is generating
92 # object files and executables is mounted via NFS rather than being
93 # a local SCSI disk compilation times can increase by a factor of
94 # ten!
95 EESUPP_SDIR = ${EESUPP_SDIR}
96 MODEL_SDIR = ${MODEL_SDIR}
97 EESUPP_IDIR = ${EESUPP_IDIR}
98 MODEL_IDIR = ${MODEL_IDIR}
99 TDIR = ${TDIR}
100 BDIR = ${BDIR}
101 EDIR = ${EDIR}
102 INCLUDES = ${INCLUDES}
103 EXE = \$(EDIR)${EXE}
104 EOF
105 echo "# C preprocessor " >> ${mfile}
106 echo 'CPP =' ${CPP} >> ${mfile}
107 echo "# Fortran compiler " >> ${mfile}
108 echo 'FCOMP1p = '${FCOMP1p} >> ${mfile}
109 echo 'FCOMP1s = '${FCOMP1s} >> ${mfile}
110 echo 'FCOMP2 = '${FCOMP2} >> ${mfile}
111 echo 'FCOMP20 = '${FCOMP20} >> ${mfile}
112 echo "# Link editor " >> ${mfile}
113 echo 'LINK1 = '${LINK1} >> ${mfile}
114 echo 'LINK2 = '${LINK2} >> ${mfile}
115 echo "# Header dependency" >> ${mfile}
116 echo 'MAKEDEPEND = '${MAKEDEPEND} >> ${mfile}
117 echo " " >> ${mfile}
118
119 # ***************************************************************************************************
120 # Generate build commands for individual .F files
121 # ***************************************************************************************************
122 # Execution environment code
123 if ( ${EESUPP_SDIR} != ${MODEL_SDIR} ) then
124 set sdir = ( ${EESUPP_SDIR} )
125 set sdir_pref = ( '$(EESUPP_SDIR)' )
126 set rp = rp1
127 goto make-mf-entries
128 rp1:
129 set eesupp_files = ( $files )
130 set eesupp_slist = ( $slist )
131 set eesupp_olist = ( $olist )
132 endif
133 # "Model" code
134 set sdir = ( ${MODEL_SDIR} )
135 set sdir_pref = ( '$(MODEL_SDIR)' )
136 set rp = rp2
137 goto make-mf-entries
138 rp2:
139 set model_files = ( $files )
140 set model_slist = ( $slist )
141 set model_olist = ( $olist )
142
143 # ***************************************************************************************************
144 # Generate file lists for various mmake utilities
145 # ***************************************************************************************************
146 echo " " >> ${mfile}
147 echo "# =========== " >> ${mfile}
148 echo "# File lists " >> ${mfile}
149 echo "# =========== " >> ${mfile}
150 set flist = ( ${eesupp_olist} ); set fpref = ( );
151 set vnam = ( eesupp_objs )
152 set rp = rp3
153 goto make-mf-list
154 rp3:
155 set flist = ( ${eesupp_slist} ); set fpref = ( '$(EESUPP_SDIR)' );
156 set vnam = ( eesupp_srcs )
157 set rp = rp4
158 goto make-mf-list
159 rp4:
160 set flist = ( ${eesupp_slist} ); set fpref = ( );
161 set vnam = ( eesupp_sfil )
162 set rp = rp5
163 goto make-mf-list
164 rp5:
165 set flist = ( ${model_olist} ); set fpref = ( );
166 set vnam = ( model_objs )
167 set rp = rp6
168 goto make-mf-list
169 rp6:
170 set flist = ( ${model_slist} ); set fpref = ( '$(MODEL_SDIR)' );
171 set vnam = ( model_srcs )
172 set rp = rp7
173 goto make-mf-list
174 rp7:
175 set flist = ( ${model_slist} ); set fpref = ( );
176 set vnam = ( model_sfil )
177 set rp = rp8
178 goto make-mf-list
179 rp8:
180 echo 'objs = $(eesupp_objs) $(model_objs)' >> ${mfile}
181 echo 'srcs = $(eesupp_srcs) $(model_srcs)' >> ${mfile}
182 echo 'sfil = $(eesupp_sfil) $(model_sfil)' >> ${mfile}
183 echo " " >> ${mfile}
184
185 # ***************************************************************************************************
186 # Write top-level rules for building the executable,
187 # generating dependencies etc...
188 # ***************************************************************************************************
189 echo "# =========== " >> ${mfile}
190 echo "# Begin rules " >> ${mfile}
191 echo "# =========== " >> ${mfile}
192 echo " " >> ${mfile}
193 echo '$(EXE): $(objs) ' >> ${mfile}
194 echo ' $(LINK1) -o $(EXE) $(objs) $(LINK2)' >> ${mfile}
195 echo " " >> ${mfile}
196 echo 'clean: ' >> ${mfile}
197 echo ' rm *.o *.f *.out *.cmp ' >> ${mfile}
198 echo " " >> ${mfile}
199 echo 'depend: ' >> ${mfile}
200 echo ' @-ln -s $(srcs) . ;$(MAKEDEPEND) -o .p.f -f $(TDIR)'${mfile}' $(INCLUDES) $(sfil) ' >> ${mfile}
201 echo " " >> ${mfile}
202
203 # ***************************************************************************************************
204 # Add per file dependencies
205 # ***************************************************************************************************
206 cat ${mfile}.$$ >> ${mfile}
207 \rm ${mfile}.$$
208
209 # ***************************************************************************************************
210 # THE END
211 # ***************************************************************************************************
212 exit
213
214 # ***************************************************************************************************
215 # This block generates the commands to turn a .F file into a .o file.
216 # It may need to be customised for different platforms.
217 # ***************************************************************************************************
218 make-mf-entries:
219 set files = ( );
220 set slist = ( );
221 set olist = ( );
222 set flist = `ls -1 ${sdir} | grep '.*\.F'`
223 if ( "${flist}" != "" ) then
224 foreach f ( $flist )
225 set fname = ( ${f:t} )
226 set pf = ( ${fname:r}.p.f )
227 set kf = ( ${fname:r}.f )
228 set of = ( ${fname:r}.o )
229 echo ${pf}: "${sdir_pref}"${fname} >> ${mfile}.$$
230 echo ' @echo Preprocessing '"${sdir_pref}"${fname} >> ${mfile}.$$
231 echo ' @ $(CPP) '"${sdir_pref}"${fname}' > '$pf >> ${mfile}.$$
232 if ( "$fname" == "main.F" ) then
233 echo ${kf}: ${pf} >> ${mfile}.$$
234 echo ' @echo KAP '${pf} >> ${mfile}.$$
235 echo ' @ $(FCOMP1p)'$kf ${pf} >> ${mfile}.$$
236 else
237 echo ${kf}: ${pf} >> ${mfile}.$$
238 echo ' @echo KAP '${pf} >> ${mfile}.$$
239 echo ' @ $(FCOMP1s)'$kf ${pf} >> ${mfile}.$$
240 endif
241 if ( "$fname" == "barrier.F" || "$fname" == "different_multiple.F" ) then
242 echo ${of}: ${kf} >> ${mfile}.$$
243 echo ' @echo Compiling '${kf} >> ${mfile}.$$
244 echo ' @ $(FCOMP20)' ${kf} >> ${mfile}.$$
245 else
246 echo ${of}: ${kf} >> ${mfile}.$$
247 echo ' @echo Compiling '${kf} >> ${mfile}.$$
248 echo ' @ $(FCOMP2)' ${kf} >> ${mfile}.$$
249 endif
250 set files = ( ${files} ${fname} )
251 set slist = ( ${slist} ${f} )
252 set olist = ( ${olist} ${of} )
253 end
254 endif
255 goto ${rp}
256
257 make-mf-list:
258 if ( $#flist == 0 ) then
259 echo ${vnam} = >> ${mfile}
260 else if ( $#flist == 1 ) then
261 echo ${vnam} = "${fpref}"${flist} >> ${mfile}
262 else
263 echo ${vnam} = "${fpref}"$flist[1] '\' >> ${mfile}
264 set count = 2
265 while ( $count < $#flist )
266 echo ' '"${fpref}"$flist[$count] '\' >> ${mfile}
267 @ count = $count + 1
268 end
269 echo ' '"${fpref}"$flist[$#flist] >> ${mfile}
270 endif
271 echo " " >> ${mfile}
272 goto $rp
273
274 # $ Id: $

  ViewVC Help
Powered by ViewVC 1.1.22