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

Annotation of /MITgcm/tools/genmake.hp

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


Revision 1.2 - (hide annotations) (download)
Thu Apr 23 21:00:52 1998 UTC (26 years, 1 month ago) by cnh
Branch: MAIN
CVS Tags: kloop2, kloop1
Changes since 1.1: +1 -1 lines
Further  changes for converting $Id to $Header

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

  ViewVC Help
Powered by ViewVC 1.1.22