Mercurial > fem-fenics-eugenio
annotate inst/private/generate_makefile.m @ 230:1a3674836579
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
author | Eugenio Gianniti <eugenio.gianniti@mail.polimi.it> |
---|---|
date | Fri, 13 Jun 2014 18:45:40 +0200 |
parents | 8932e9cd8dd1 |
children | 61830a4f9ab9 |
rev | line source |
---|---|
152
1dbe146bff03
Update license to gpl v3
gedeone-octave <marcovass89@hotmail.it>
parents:
124
diff
changeset
|
1 ## Copyright (C) 2013 Marco Vassallo <gedeone-octave@users.sourceforge.net> |
1dbe146bff03
Update license to gpl v3
gedeone-octave <marcovass89@hotmail.it>
parents:
124
diff
changeset
|
2 ## |
124
2191111a1cad
Maint: add copyright notice
gedeone-octave <marcovass89@hotmail.it>
parents:
110
diff
changeset
|
3 ## This program is free software; you can redistribute it and/or modify it under |
2191111a1cad
Maint: add copyright notice
gedeone-octave <marcovass89@hotmail.it>
parents:
110
diff
changeset
|
4 ## the terms of the GNU General Public License as published by the Free Software |
152
1dbe146bff03
Update license to gpl v3
gedeone-octave <marcovass89@hotmail.it>
parents:
124
diff
changeset
|
5 ## Foundation; either version 3 of the License, or (at your option) any later |
124
2191111a1cad
Maint: add copyright notice
gedeone-octave <marcovass89@hotmail.it>
parents:
110
diff
changeset
|
6 ## version. |
152
1dbe146bff03
Update license to gpl v3
gedeone-octave <marcovass89@hotmail.it>
parents:
124
diff
changeset
|
7 ## |
124
2191111a1cad
Maint: add copyright notice
gedeone-octave <marcovass89@hotmail.it>
parents:
110
diff
changeset
|
8 ## This program is distributed in the hope that it will be useful, but WITHOUT |
2191111a1cad
Maint: add copyright notice
gedeone-octave <marcovass89@hotmail.it>
parents:
110
diff
changeset
|
9 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
2191111a1cad
Maint: add copyright notice
gedeone-octave <marcovass89@hotmail.it>
parents:
110
diff
changeset
|
10 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
2191111a1cad
Maint: add copyright notice
gedeone-octave <marcovass89@hotmail.it>
parents:
110
diff
changeset
|
11 ## details. |
152
1dbe146bff03
Update license to gpl v3
gedeone-octave <marcovass89@hotmail.it>
parents:
124
diff
changeset
|
12 ## |
124
2191111a1cad
Maint: add copyright notice
gedeone-octave <marcovass89@hotmail.it>
parents:
110
diff
changeset
|
13 ## You should have received a copy of the GNU General Public License along with |
2191111a1cad
Maint: add copyright notice
gedeone-octave <marcovass89@hotmail.it>
parents:
110
diff
changeset
|
14 ## this program; if not, see <http://www.gnu.org/licenses/>. |
2191111a1cad
Maint: add copyright notice
gedeone-octave <marcovass89@hotmail.it>
parents:
110
diff
changeset
|
15 |
2191111a1cad
Maint: add copyright notice
gedeone-octave <marcovass89@hotmail.it>
parents:
110
diff
changeset
|
16 |
2191111a1cad
Maint: add copyright notice
gedeone-octave <marcovass89@hotmail.it>
parents:
110
diff
changeset
|
17 ## -*- texinfo -*- |
2191111a1cad
Maint: add copyright notice
gedeone-octave <marcovass89@hotmail.it>
parents:
110
diff
changeset
|
18 ## function for internal usage only |
2191111a1cad
Maint: add copyright notice
gedeone-octave <marcovass89@hotmail.it>
parents:
110
diff
changeset
|
19 ## @end deftypefn |
68
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
20 function output = generate_makefile (ufl_name, path) |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
21 |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
22 STRING ="\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
23 DIR = @@PATH@@\n\ |
230
1a3674836579
Provide flags for just-in-time compilation
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
208
diff
changeset
|
24 CPPFLAGS+=@@FF_CPPFLAGS@@ -g\n\ |
1a3674836579
Provide flags for just-in-time compilation
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
208
diff
changeset
|
25 LIBS+=@@FF_LIBS@@\n\ |
68
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
26 MKOCTFILE = mkoctfile\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
27 FFC = ffc\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
28 \n\ |
110
75780f7dc9f4
Fix nug in the makefile,
gedeone-octave <marcovass89@hotmail.it>
parents:
109
diff
changeset
|
29 OCTFILES = @@UFL_NAME@@_FunctionSpace.oct @@UFL_NAME@@_BilinearForm.oct @@UFL_NAME@@_LinearForm.oct\n\ |
68
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
30 \n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
31 all : $(OCTFILES)\n\ |
82
5a4371f45fc4
Create the corresponding function following new naming convention.
gedeone-octave <marcovass89@hotmail.it>
parents:
68
diff
changeset
|
32 fs : @@UFL_NAME@@_FunctionSpace.oct\n\ |
5a4371f45fc4
Create the corresponding function following new naming convention.
gedeone-octave <marcovass89@hotmail.it>
parents:
68
diff
changeset
|
33 rhs : @@UFL_NAME@@_BilinearForm.oct\n\ |
5a4371f45fc4
Create the corresponding function following new naming convention.
gedeone-octave <marcovass89@hotmail.it>
parents:
68
diff
changeset
|
34 lhs : @@UFL_NAME@@_LinearForm.oct\n\ |
109
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
82
diff
changeset
|
35 fun : @@UFL_NAME@@_Functional.oct\n\ |
68
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
36 \n\ |
82
5a4371f45fc4
Create the corresponding function following new naming convention.
gedeone-octave <marcovass89@hotmail.it>
parents:
68
diff
changeset
|
37 @@UFL_NAME@@_FunctionSpace.oct: @@UFL_NAME@@.h @@UFL_NAME@@_FunctionSpace.cc\n\ |
230
1a3674836579
Provide flags for just-in-time compilation
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
208
diff
changeset
|
38 CPPFLAGS='$(CPPFLAGS)' $(MKOCTFILE) @@UFL_NAME@@_FunctionSpace.cc -I$(DIR) -I. $(LDFLAGS) $(LIBS)\n\ |
68
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
39 \n\ |
82
5a4371f45fc4
Create the corresponding function following new naming convention.
gedeone-octave <marcovass89@hotmail.it>
parents:
68
diff
changeset
|
40 @@UFL_NAME@@_BilinearForm.oct: @@UFL_NAME@@.h @@UFL_NAME@@_BilinearForm.cc\n\ |
230
1a3674836579
Provide flags for just-in-time compilation
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
208
diff
changeset
|
41 CPPFLAGS='$(CPPFLAGS)' $(MKOCTFILE) @@UFL_NAME@@_BilinearForm.cc -I$(DIR) -I. $(LDFLAGS) $(LIBS)\n\ |
68
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
42 \n\ |
82
5a4371f45fc4
Create the corresponding function following new naming convention.
gedeone-octave <marcovass89@hotmail.it>
parents:
68
diff
changeset
|
43 @@UFL_NAME@@_LinearForm.oct: @@UFL_NAME@@.h @@UFL_NAME@@_LinearForm.cc\n\ |
230
1a3674836579
Provide flags for just-in-time compilation
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
208
diff
changeset
|
44 CPPFLAGS='$(CPPFLAGS)' $(MKOCTFILE) @@UFL_NAME@@_LinearForm.cc -I$(DIR) -I. $(LDFLAGS) $(LIBS)\n\ |
68
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
45 \n\ |
109
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
82
diff
changeset
|
46 @@UFL_NAME@@_Functional.oct: @@UFL_NAME@@.h @@UFL_NAME@@_Functional.cc\n\ |
230
1a3674836579
Provide flags for just-in-time compilation
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
208
diff
changeset
|
47 CPPFLAGS='$(CPPFLAGS)' $(MKOCTFILE) @@UFL_NAME@@_Functional.cc -I$(DIR) -I. $(LDFLAGS) $(LIBS)\n\ |
109
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
82
diff
changeset
|
48 \n\ |
68
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
49 @@UFL_NAME@@.h: @@UFL_NAME@@.ufl\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
50 $(FFC) -l dolfin @@UFL_NAME@@.ufl\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
51 \n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
52 .PHONY: clean\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
53 \n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
54 clean:\n\ |
82
5a4371f45fc4
Create the corresponding function following new naming convention.
gedeone-octave <marcovass89@hotmail.it>
parents:
68
diff
changeset
|
55 rm -f @@UFL_NAME@@_FunctionSpace.o @@UFL_NAME@@_FunctionSpace.cc @@UFL_NAME@@.h\n\ |
5a4371f45fc4
Create the corresponding function following new naming convention.
gedeone-octave <marcovass89@hotmail.it>
parents:
68
diff
changeset
|
56 rm -f @@UFL_NAME@@_BilinearForm.o @@UFL_NAME@@_BilinearForm.cc\n\ |
5a4371f45fc4
Create the corresponding function following new naming convention.
gedeone-octave <marcovass89@hotmail.it>
parents:
68
diff
changeset
|
57 rm -f @@UFL_NAME@@_LinearForm.o @@UFL_NAME@@_LinearForm.cc\n\ |
109
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
82
diff
changeset
|
58 rm -f @@UFL_NAME@@_Functional.o @@UFL_NAME@@_Functional.cc\n\ |
68
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
59 rm -f Makefile_@@UFL_NAME@@\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
60 "; |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
61 |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
62 STRING = strrep (STRING, "@@UFL_NAME@@", ufl_name); |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
63 STRING = strrep (STRING, "@@PATH@@", path); |
230
1a3674836579
Provide flags for just-in-time compilation
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
208
diff
changeset
|
64 STRING = strrep (STRING, "@@FF_CPPFLAGS@@", get_vars ("CPPFLAGS")); |
1a3674836579
Provide flags for just-in-time compilation
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
208
diff
changeset
|
65 STRING = strrep (STRING, "@@FF_LIBS@@", get_vars ("LIBS")); |
68
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
66 |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
67 fid = fopen (sprintf ("Makefile_%s", ufl_name), 'w'); |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
68 if (fid >= 0) |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
69 fputs (fid, STRING); |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
70 output = fclose (fid); |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
71 else |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
72 error ("cannot open file"); |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
73 output = 1; |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
74 endif |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
75 |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
76 endfunction |