annotate inst/generate_makefile.m @ 68:4ef8dbafcdfc

New octave script for creation of function on the fly
author gedeone-octave <marco.vassallo@outlook.com>
date Sat, 27 Jul 2013 17:21:03 +0200
parents
children 5a4371f45fc4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
68
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
1
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
2 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
3
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
4 STRING ="\n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
5 DIR = @@PATH@@\n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
6 CPPFLAGS=\n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
7 LIBS= -ldolfin\n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
8 MKOCTFILE = mkoctfile\n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
9 FFC = ffc\n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
10 \n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
11 OCTFILES = fem_fs_@@UFL_NAME@@.oct fem_rhs_@@UFL_NAME@@.oct fem_lhs_@@UFL_NAME@@.oct\n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
12 \n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
13 all : $(OCTFILES)\n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
14 fs : fem_fs_@@UFL_NAME@@.oct\n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
15 rhs : fem_rhs_@@UFL_NAME@@.oct\n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
16 lhs : fem_lhs_@@UFL_NAME@@.oct\n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
17 \n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
18 fem_fs_@@UFL_NAME@@.o: fem_fs_@@UFL_NAME@@.cc\n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
19 $(MKOCTFILE) -I$(DIR) -I. $(CPPFLAGS) $(LDFLAGS) $< -c $@\n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
20 \n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
21 fem_fs_@@UFL_NAME@@.oct: @@UFL_NAME@@.h fem_fs_@@UFL_NAME@@.o\n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
22 $(MKOCTFILE) -s fem_fs_@@UFL_NAME@@.o $(DIR)fem_init_env.o $(LDFLAGS) $(LIBS) -o $@\n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
23 \n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
24 fem_rhs_@@UFL_NAME@@.o: fem_rhs_@@UFL_NAME@@.cc\n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
25 $(MKOCTFILE) -I$(DIR) -I. $(LDFLAGS) $(CPPFLAGS) $< -c $@\n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
26 \n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
27 fem_rhs_@@UFL_NAME@@.oct: @@UFL_NAME@@.h fem_rhs_@@UFL_NAME@@.o\n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
28 $(MKOCTFILE) -s fem_rhs_@@UFL_NAME@@.o $(DIR)fem_init_env.o $(LDFLAGS) $(LIBS) -o $@\n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
29 \n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
30 fem_lhs_@@UFL_NAME@@.o: fem_lhs_@@UFL_NAME@@.cc\n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
31 $(MKOCTFILE) -I$(DIR) -I. $(LDFLAGS) $(CPPFLAGS) $< -c $@\n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
32 \n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
33 fem_lhs_@@UFL_NAME@@.oct: @@UFL_NAME@@.h fem_lhs_@@UFL_NAME@@.o\n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
34 $(MKOCTFILE) -s fem_lhs_@@UFL_NAME@@.o $(DIR)fem_init_env.o $(LDFLAGS) $(LIBS) -o $@\n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
35 \n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
36 @@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
37 $(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
38 \n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
39 .PHONY: clean\n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
40 \n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
41 clean:\n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
42 rm -f fem_fs_@@UFL_NAME@@.o fem_fs_@@UFL_NAME@@.cc @@UFL_NAME@@.h\n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
43 rm -f fem_rhs_@@UFL_NAME@@.o fem_rhs_@@UFL_NAME@@.cc\n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
44 rm -f fem_lhs_@@UFL_NAME@@.o fem_lhs_@@UFL_NAME@@.cc\n\
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
45 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
46 ";
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
47
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
48 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
49 STRING = strrep (STRING, "@@PATH@@", path);
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
50
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
51 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
52 if (fid >= 0)
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
53 fputs (fid, STRING);
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
54 output = fclose (fid);
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
55 else
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
56 error ("cannot open file");
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
57 output = 1;
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
58 endif
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
59
4ef8dbafcdfc New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
60 endfunction