/[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.7 - (show annotations) (download)
Fri May 7 15:18:42 1999 UTC (24 years, 11 months ago) by adcroft
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +1 -1 lines
FILE REMOVED
Removed these old scripts for generating Makefile. It seems that the
generic "genmake" script has been working well enough for sometime...

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

  ViewVC Help
Powered by ViewVC 1.1.22