annotate inst/private/generate_makefile.m @ 268:61830a4f9ab9

Improve formatting
author Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
date Thu, 14 Aug 2014 12:26:55 +0200
parents 1a3674836579
children 897e312cb440
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
268
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 230
diff changeset
20
68
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
21 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
22
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
23 STRING ="\n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
24 DIR = @@PATH@@\n\
230
1a3674836579 Provide flags for just-in-time compilation
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 208
diff changeset
25 CPPFLAGS+=@@FF_CPPFLAGS@@ -g\n\
1a3674836579 Provide flags for just-in-time compilation
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 208
diff changeset
26 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
27 MKOCTFILE = mkoctfile\n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
28 FFC = ffc\n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
29 \n\
110
75780f7dc9f4 Fix nug in the makefile,
gedeone-octave <marcovass89@hotmail.it>
parents: 109
diff changeset
30 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
31 \n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
32 all : $(OCTFILES)\n\
82
5a4371f45fc4 Create the corresponding function following new naming convention.
gedeone-octave <marcovass89@hotmail.it>
parents: 68
diff changeset
33 fs : @@UFL_NAME@@_FunctionSpace.oct\n\
5a4371f45fc4 Create the corresponding function following new naming convention.
gedeone-octave <marcovass89@hotmail.it>
parents: 68
diff changeset
34 rhs : @@UFL_NAME@@_BilinearForm.oct\n\
5a4371f45fc4 Create the corresponding function following new naming convention.
gedeone-octave <marcovass89@hotmail.it>
parents: 68
diff changeset
35 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
36 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
37 \n\
82
5a4371f45fc4 Create the corresponding function following new naming convention.
gedeone-octave <marcovass89@hotmail.it>
parents: 68
diff changeset
38 @@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
39 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
40 \n\
82
5a4371f45fc4 Create the corresponding function following new naming convention.
gedeone-octave <marcovass89@hotmail.it>
parents: 68
diff changeset
41 @@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
42 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
43 \n\
82
5a4371f45fc4 Create the corresponding function following new naming convention.
gedeone-octave <marcovass89@hotmail.it>
parents: 68
diff changeset
44 @@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
45 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
46 \n\
109
50753c3cb0b6 New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents: 82
diff changeset
47 @@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
48 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
49 \n\
68
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
50 @@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
51 $(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
52 \n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
53 .PHONY: clean\n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
54 \n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
55 clean:\n\
268
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 230
diff changeset
56 $(RM) @@UFL_NAME@@_FunctionSpace.o @@UFL_NAME@@_FunctionSpace.cc @@UFL_NAME@@.h\n\
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 230
diff changeset
57 $(RM) @@UFL_NAME@@_BilinearForm.o @@UFL_NAME@@_BilinearForm.cc\n\
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 230
diff changeset
58 $(RM) @@UFL_NAME@@_LinearForm.o @@UFL_NAME@@_LinearForm.cc\n\
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 230
diff changeset
59 $(RM) @@UFL_NAME@@_Functional.o @@UFL_NAME@@_Functional.cc\n\
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 230
diff changeset
60 $(RM) Makefile_@@UFL_NAME@@\n\
68
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
268
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 230
diff changeset
63 STRING = strrep (STRING, "@@UFL_NAME@@", ufl_name);
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 230
diff changeset
64 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
65 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
66 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
67
268
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 230
diff changeset
68 fid = fopen (sprintf ("Makefile_%s", ufl_name), "w");
68
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
69 if (fid >= 0)
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
70 fputs (fid, STRING);
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
71 output = fclose (fid);
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
72 else
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
73 error ("cannot open file");
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
74 output = 1;
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
75 endif
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
76
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
77 endfunction