diff --git a/samples/cxx/SConscript b/samples/cxx/SConscript index 06e00a8a9..31ef1bb4c 100644 --- a/samples/cxx/SConscript +++ b/samples/cxx/SConscript @@ -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) diff --git a/samples/f77/Makefile.in b/samples/f77/Makefile.in index 1ebd11793..8e53770f6 100644 --- a/samples/f77/Makefile.in +++ b/samples/f77/Makefile.in @@ -1,4 +1,4 @@ -include ../Cantera.mak +include @tmpl_Cantera_dot_mak@ FC=@F77@ RM=rm -f diff --git a/samples/f77/SConscript b/samples/f77/SConscript index a9ce377f5..a53d7cc34 100644 --- a/samples/f77/SConscript +++ b/samples/f77/SConscript @@ -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]) diff --git a/samples/f90/Makefile.in b/samples/f90/Makefile.in index 6086ff57a..8f1512997 100644 --- a/samples/f90/Makefile.in +++ b/samples/f90/Makefile.in @@ -1,4 +1,4 @@ -include ../Cantera.mak +include @tmpl_Cantera_dot_mak@ F90=@F90@ RM=rm -f diff --git a/samples/f90/SConscript b/samples/f90/SConscript index e4a84fa40..f6f943a2b 100644 --- a/samples/f90/SConscript +++ b/samples/f90/SConscript @@ -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])