# HG changeset patch # User Eugenio Gianniti # Date 1402677940 -7200 # Node ID 1a3674836579f4ac8cd7d265bc8b8254042ef359 # Parent 194f8c66b45ac8581ba749c6e9e652f68055efa6 Provide flags for just-in-time compilation * src/configure.ac: add inst/private/get_vars.m as configured file * inst/private/get_vars.m.in: a function returning proper compiler or linker flags * inst/provate/generate_makefile.m: use flags * src/Makefile.in: add get_vars.m in the cleanall recipe diff -r 194f8c66b45a -r 1a3674836579 inst/private/generate_makefile.m --- a/inst/private/generate_makefile.m Thu Jun 05 19:50:52 2014 +0200 +++ b/inst/private/generate_makefile.m Fri Jun 13 18:45:40 2014 +0200 @@ -21,8 +21,8 @@ STRING ="\n\ DIR = @@PATH@@\n\ -CPPFLAGS+=\n\ -LIBS= -ldolfin\n\ +CPPFLAGS+=@@FF_CPPFLAGS@@ -g\n\ +LIBS+=@@FF_LIBS@@\n\ MKOCTFILE = mkoctfile\n\ FFC = ffc\n\ \n\ @@ -35,16 +35,16 @@ fun : @@UFL_NAME@@_Functional.oct\n\ \n\ @@UFL_NAME@@_FunctionSpace.oct: @@UFL_NAME@@.h @@UFL_NAME@@_FunctionSpace.cc\n\ - $(MKOCTFILE) @@UFL_NAME@@_FunctionSpace.cc -I$(DIR) -I. $(LDFLAGS) $(CPPFLAGS) $(LIBS)\n\ + CPPFLAGS='$(CPPFLAGS)' $(MKOCTFILE) @@UFL_NAME@@_FunctionSpace.cc -I$(DIR) -I. $(LDFLAGS) $(LIBS)\n\ \n\ @@UFL_NAME@@_BilinearForm.oct: @@UFL_NAME@@.h @@UFL_NAME@@_BilinearForm.cc\n\ - $(MKOCTFILE) @@UFL_NAME@@_BilinearForm.cc -I$(DIR) -I. $(LDFLAGS) $(CPPFLAGS) $(LIBS)\n\ + CPPFLAGS='$(CPPFLAGS)' $(MKOCTFILE) @@UFL_NAME@@_BilinearForm.cc -I$(DIR) -I. $(LDFLAGS) $(LIBS)\n\ \n\ @@UFL_NAME@@_LinearForm.oct: @@UFL_NAME@@.h @@UFL_NAME@@_LinearForm.cc\n\ - $(MKOCTFILE) @@UFL_NAME@@_LinearForm.cc -I$(DIR) -I. $(LDFLAGS) $(CPPFLAGS) $(LDFLAGS) $(LIBS)\n\ + CPPFLAGS='$(CPPFLAGS)' $(MKOCTFILE) @@UFL_NAME@@_LinearForm.cc -I$(DIR) -I. $(LDFLAGS) $(LIBS)\n\ \n\ @@UFL_NAME@@_Functional.oct: @@UFL_NAME@@.h @@UFL_NAME@@_Functional.cc\n\ - $(MKOCTFILE) @@UFL_NAME@@_Functional.cc -I$(DIR) -I. $(LDFLAGS) $(CPPFLAGS) $(LDFLAGS) $(LIBS)\n\ + CPPFLAGS='$(CPPFLAGS)' $(MKOCTFILE) @@UFL_NAME@@_Functional.cc -I$(DIR) -I. $(LDFLAGS) $(LIBS)\n\ \n\ @@UFL_NAME@@.h: @@UFL_NAME@@.ufl\n\ $(FFC) -l dolfin @@UFL_NAME@@.ufl\n\ @@ -61,6 +61,8 @@ STRING = strrep (STRING, "@@UFL_NAME@@", ufl_name); STRING = strrep (STRING, "@@PATH@@", path); +STRING = strrep (STRING, "@@FF_CPPFLAGS@@", get_vars ("CPPFLAGS")); +STRING = strrep (STRING, "@@FF_LIBS@@", get_vars ("LIBS")); fid = fopen (sprintf ("Makefile_%s", ufl_name), 'w'); if (fid >= 0) diff -r 194f8c66b45a -r 1a3674836579 inst/private/get_vars.m.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inst/private/get_vars.m.in Fri Jun 13 18:45:40 2014 +0200 @@ -0,0 +1,35 @@ +## Copyright (C) 2014 Eugenio Gianniti +## +## This program is free software; you can redistribute it and/or modify it under +## the terms of the GNU General Public License as published by the Free Software +## Foundation; either version 3 of the License, or (at your option) any later +## version. +## +## This program is distributed in the hope that it will be useful, but WITHOUT +## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +## details. +## +## You should have received a copy of the GNU General Public License along with +## this program; if not, see . + + +## -*- texinfo -*- +## function for internal usage only +## @end deftypefn + +function var = get_vars (name) + persistent opts = {"CPPFLAGS", + "LIBS"}; + select = validatestring (name, opts, "get_vars", "name"); + switch (select) + case "CPPFLAGS" + var = "@DENSE_CPPFLAGS@ @DOLFIN_CPPFLAGS@ @EIGEN_CPPFLAGS@"; + case "LIBS" + tokens = strsplit (strtrim ("@EIGEN_LIBS@ @DOLFIN_LIBS@")); + var = strjoin (tokens, '" "'); + var = ['"', var, '"']; + otherwise + error ("get_vars: the requested variable is not available."); + endswitch +endfunction \ No newline at end of file diff -r 194f8c66b45a -r 1a3674836579 src/Makefile.in --- a/src/Makefile.in Thu Jun 05 19:50:52 2014 +0200 +++ b/src/Makefile.in Fri Jun 13 18:45:40 2014 +0200 @@ -121,6 +121,7 @@ $(RM) *.o core octave-core *.oct *~ *.xml *.status *.log \ octave-workspace configure *.pvd *.vtu $(RM) -r autom4te.cache + $(RM) ../inst/private/get_vars.m $(RM) Makefile diff -r 194f8c66b45a -r 1a3674836579 src/configure.ac --- a/src/configure.ac Thu Jun 05 19:50:52 2014 +0200 +++ b/src/configure.ac Fri Jun 13 18:45:40 2014 +0200 @@ -62,5 +62,5 @@ AC_MSG_ERROR([mkoctfile required to install $PACKAGE_NAME]) fi -AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([Makefile ../inst/private/get_vars.m]) AC_OUTPUT