Fix path to Cantera.mak in sample Fortran Makefiles

Use relative path if the Cantera install directory contains spaces, as the
Makefile 'include' statement doesn't seem to have a way to escape the space
otherwise.
This commit is contained in:
Ray Speth 2014-04-28 18:18:10 +00:00
parent 4e68860165
commit 3944dda878
5 changed files with 26 additions and 3 deletions

View file

@ -30,7 +30,14 @@ for subdir, name, extensions in samples:
## Generate Makefiles to be installed
localenv['make_sourcefile'] = '%s.cpp' % name
localenv['make_target'] = name
localenv['make_Cantera_dot_mak'] = pjoin(localenv['ct_incroot'], 'cantera', 'Cantera.mak')
mak_path = pjoin(localenv['ct_incroot'], 'cantera', 'Cantera.mak')
if ' ' in mak_path:
# There is no reasonable way to handle spaces in Makefile 'include'
# statement, so we fall back to using the relative path instead
mak_path = os.path.relpath(mak_path, pjoin(localenv['ct_sampledir'], 'cxx', subdir))
localenv['make_Cantera_dot_mak'] = mak_path
makefile = build(localenv.SubstFile(pjoin(subdir, 'Makefile'), 'Makefile.in'))
install(pjoin('$inst_sampledir', 'cxx', subdir), makefile)

View file

@ -1,4 +1,4 @@
include ../Cantera.mak
include @tmpl_Cantera_dot_mak@
FC=@F77@
RM=rm -f

View file

@ -25,6 +25,14 @@ libdirs = ((localenv['ct_libdir'], localenv['sundials_libdir'],
localenv['blas_lapack_dir'], localenv['boost_lib_dir']) +
tuple(localenv['extra_lib_dirs']))
linkflags = ('-g', localenv['thread_flags'])
mak_path = pjoin(localenv['ct_incroot'], 'cantera', 'Cantera.mak')
if ' ' in mak_path:
# There is no reasonable way to handle spaces in Makefile 'include'
# statement, so we fall back to using the relative path instead
mak_path = os.path.relpath(mak_path, pjoin(localenv['ct_sampledir'], 'f90'))
localenv['tmpl_Cantera_dot_mak'] = mak_path
localenv['tmpl_cantera_incdirs'] = repr([x for x in incdirs if x])
localenv['tmpl_cantera_libs'] = repr(libs)
localenv['tmpl_cantera_libdirs'] = repr([x for x in libdirs if x])

View file

@ -1,4 +1,4 @@
include ../Cantera.mak
include @tmpl_Cantera_dot_mak@
F90=@F90@
RM=rm -f

View file

@ -19,6 +19,14 @@ for programName, sources in samples:
localenv['blas_lapack_dir'], localenv['boost_lib_dir']) +
tuple(localenv['extra_lib_dirs']))
linkflags = ('-g', localenv['thread_flags'])
mak_path = pjoin(localenv['ct_incroot'], 'cantera', 'Cantera.mak')
if ' ' in mak_path:
# There is no reasonable way to handle spaces in Makefile 'include'
# statement, so we fall back to using the relative path instead
mak_path = os.path.relpath(mak_path, pjoin(localenv['ct_sampledir'], 'f90'))
localenv['tmpl_Cantera_dot_mak'] = mak_path
localenv['tmpl_cantera_incdirs'] = repr([x for x in incdirs if x])
localenv['tmpl_cantera_libs'] = repr(libs)
localenv['tmpl_cantera_libdirs'] = repr([x for x in libdirs if x])