[cig-commits] r14033 - cs/portal/trunk/northridge/backend
leif at geodynamics.org
leif at geodynamics.org
Tue Feb 10 14:30:48 PST 2009
Author: leif
Date: 2009-02-10 14:30:47 -0800 (Tue, 10 Feb 2009)
New Revision: 14033
Modified:
cs/portal/trunk/northridge/backend/specfem3D.py
Log:
Merged the tweak from r14031 which enables C source files to be
included in pluggable Earth models.
Modified: cs/portal/trunk/northridge/backend/specfem3D.py
===================================================================
--- cs/portal/trunk/northridge/backend/specfem3D.py 2009-02-10 22:23:59 UTC (rev 14032)
+++ cs/portal/trunk/northridge/backend/specfem3D.py 2009-02-10 22:30:47 UTC (rev 14033)
@@ -174,12 +174,14 @@
def prepareModel(self):
import tarfile
from os.path import basename, dirname, splitext
+ from itertools import chain
tgz = tarfile.open(self.model, 'r:gz')
path = "model"
directories = []
fortranSourceFiles = []
+ cSourceFiles = []
for tarinfo in tgz:
if tarinfo.isdir():
@@ -190,9 +192,12 @@
except EnvironmentError:
pass
directories.append(tarinfo)
- elif tarinfo.name.endswith(".f90"):
+ elif tarinfo.name.endswith(".f90") or tarinfo.name.endswith(".c"):
pathname = os.path.join(path, tarinfo.name)
- fortranSourceFiles.append(pathname)
+ if tarinfo.name.endswith(".f90"):
+ fortranSourceFiles.append(pathname)
+ else:
+ cSourceFiles.append(pathname)
thisDir = dirname(tarinfo.name) # see bcast_model.c
s = tgz.extractfile(tarinfo)
f = open(pathname, "w")
@@ -221,7 +226,7 @@
s = open("model.mk", "w")
print >>s
print >>s, "model_OBJECTS = \\"
- for sourceFile in fortranSourceFiles:
+ for sourceFile in chain(fortranSourceFiles, cSourceFiles):
base = splitext(basename(sourceFile))[0]
print >>s, "\t$O/%s.o \\" % base
print >>s, "\t$(empty)"
@@ -231,6 +236,11 @@
print >>s, "$O/%s.o: constants.h %s" % (base, sourceFile)
print >>s, "\t${MPIFCCOMPILE_CHECK} -c -o $O/%s.o ${FCFLAGS_f90} %s" % (base, sourceFile)
print >>s
+ for sourceFile in cSourceFiles:
+ base = splitext(basename(sourceFile))[0]
+ print >>s, "$O/%s.o: config.h %s" % (base, sourceFile)
+ print >>s, "\tmpicc $(CPPFLAGS) $(CFLAGS) -c -o $O/%s.o %s" % (base, sourceFile)
+ print >>s
return
More information about the CIG-COMMITS
mailing list