Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

[8932e9]: inst / private / generate_makefile.m Maximize Restore History

Download this file

generate_makefile.m    75 lines (68 with data), 2.7 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
## Copyright (C) 2013 Marco Vassallo <gedeone-octave@users.sourceforge.net>
##
## 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 <http://www.gnu.org/licenses/>.
## -*- texinfo -*-
## function for internal usage only
## @end deftypefn
function output = generate_makefile (ufl_name, path)
STRING ="\n\
DIR = @@PATH@@\n\
CPPFLAGS+=\n\
LIBS= -ldolfin\n\
MKOCTFILE = mkoctfile\n\
FFC = ffc\n\
\n\
OCTFILES = @@UFL_NAME@@_FunctionSpace.oct @@UFL_NAME@@_BilinearForm.oct @@UFL_NAME@@_LinearForm.oct\n\
\n\
all : $(OCTFILES)\n\
fs : @@UFL_NAME@@_FunctionSpace.oct\n\
rhs : @@UFL_NAME@@_BilinearForm.oct\n\
lhs : @@UFL_NAME@@_LinearForm.oct\n\
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\
\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\
\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\
\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\
\n\
@@UFL_NAME@@.h: @@UFL_NAME@@.ufl\n\
$(FFC) -l dolfin @@UFL_NAME@@.ufl\n\
\n\
.PHONY: clean\n\
\n\
clean:\n\
rm -f @@UFL_NAME@@_FunctionSpace.o @@UFL_NAME@@_FunctionSpace.cc @@UFL_NAME@@.h\n\
rm -f @@UFL_NAME@@_BilinearForm.o @@UFL_NAME@@_BilinearForm.cc\n\
rm -f @@UFL_NAME@@_LinearForm.o @@UFL_NAME@@_LinearForm.cc\n\
rm -f @@UFL_NAME@@_Functional.o @@UFL_NAME@@_Functional.cc\n\
rm -f Makefile_@@UFL_NAME@@\n\
";
STRING = strrep (STRING, "@@UFL_NAME@@", ufl_name);
STRING = strrep (STRING, "@@PATH@@", path);
fid = fopen (sprintf ("Makefile_%s", ufl_name), 'w');
if (fid >= 0)
fputs (fid, STRING);
output = fclose (fid);
else
error ("cannot open file");
output = 1;
endif
endfunction