File: Makefile

package info (click to toggle)
deal.ii 6.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 130,276 kB
  • ctags: 254,694
  • sloc: cpp: 664,750; ansic: 30,376; sh: 3,290; makefile: 3,152; perl: 1,046; asm: 802; fortran: 801; lisp: 84; pascal: 71
file content (200 lines) | stat: -rw-r--r-- 6,821 bytes parent folder | download
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# $Id: Makefile 21333 2010-06-24 21:00:58Z kanschat $
# Create proper HTML output from the different example programs

# include paths and global variables
include ../../../common/Make.global_options

# plain names of those files that we shall treat. simply take all those
# directories in examples/ that have a /doc subdirectory
example-names = $(subst $D/examples/,,    \
                        $(subst /doc,,    \
                                $(shell echo $D/examples/*/doc)))



# prefix names for generated intermediate files
gen-example-names = $(addprefix generated/, $(example-names))

# names of commented program files, plain files, and tocs for the commented
# and commented and plain versions of the program as well as a combined one
example-toc-prog   = $(addsuffix _toc.prog,$(gen-example-names))
example-toc-plain  = $(addsuffix _toc.plain,$(gen-example-names))
example-toc-intro  = $(addsuffix _toc.intro,$(gen-example-names))
example-toc-results= $(addsuffix _toc.results,$(gen-example-names))
example-toc        = $(addsuffix _toc.combined,$(gen-example-names))

# same for intermediate files for doxygen output
example-dox-prog   = $(addsuffix _prog.dox,$(gen-example-names))
example-dox-plain  = $(addsuffix _plain.dox,$(gen-example-names))


# finally a target for combined Doxygen files
example-doxygen     = $(addprefix doxygen/,$(addsuffix .h,$(example-names)))


# a makefile command that extracts the base name of a program
get_basename = $(shell echo $(1) | $(PERL) -pi -e 's/(generated|doxygen).//g; s/\..*//g; s/_(prog|plain|toc.*)//g;')



all: Makefile.dep $(example-doxygen) toc.html

# Generation of the map of the example programs. Note, that the
# following command only merges the map into toc.html. The map itself
# is not generated automatically, but requires to call
#
# make steps.png
#
#  by hand. This way, we avoid testing for neato during
#  configuration. The map only needs to be generated after changes in
#  the structure of the tutorials.
toc.html: steps.cmapx toc.html.in
	@echo ================== Making $@
	@perl make_toc.pl > toc.html

# generate dot file
steps.dot: steps.pl $D/examples/*/doc/tooltip
	@echo ================== Making $@
	@perl $< > $@

steps.png: steps.dot
	@echo ================== Making $@
	@neato -Tpng -Tcmapx -O $<
	@mv steps.dot.png steps.png
	@mv steps.dot.cmapx steps.cmapx


$(example-toc-prog):
	@echo ================== Making $@
	@cat $D/examples/$(call get_basename, $@)/*.cc \
	  | $(PERL) program2toc \
	  > $@


$(example-toc-plain):
	@echo ================== Making $@
	@cat generated/$(call get_basename, $@)_toc.prog \
	  | $(PERL) -pi -e 's/href=\"\#/href=\"\#plain-/g;' \
	  > $@


$(example-toc-intro):
	@echo ================== Making $@
	@cat $D/examples/$(call get_basename, $@)/doc/intro.dox \
	  | egrep -i "<h[3456]>.*</h[3456]>" \
	  | $(PERL) ./intro2toc \
	  > $@


$(example-toc-results):
	@echo ================== Making $@
	@cat $D/examples/$(call get_basename, $@)/doc/results.dox \
	  | egrep -i "<h[3456]>.*</h[3456]>" \
	  | $(PERL) ./intro2toc \
	  > $@


$(example-toc):
	@echo ================== Making $@
	@echo "<table class=\"tutorial\" width=\"50%\">" > $@
	@echo "<tr><th colspan=\"2\"><b><small>Table of contents</small></b></th></tr>" >> $@
	@echo "<tr><td width=\"50%\" valign=\"top\">" >> $@
	@echo "<ol>" >> $@
	@echo "  <li> <a href=\"#Intro\" class=bold>Introduction</a>" >> $@
	@cat generated/$(call get_basename, $@)_toc.intro >> $@
	@echo "  <li> <a href=\"#CommProg\" class=bold>The commented program</a>" >> $@
	@cat generated/$(call get_basename, $@)_toc.prog >> $@
	@echo "</ol></td><td width=\"50%\" valign=\"top\"><ol>" >> $@
	@echo "  <li value=\"3\"> <a href=\"#Results\" class=bold>Results</a>" >> $@
	@cat generated/$(call get_basename, $@)_toc.results >> $@
	@echo "  <li> <a href=\"#PlainProg\" class=bold>The plain program</a>" >> $@
	@cat generated/$(call get_basename, $@)_toc.plain >> $@
	@echo "</ol> </td> </tr> </table>" >> $@



$(example-dox-prog):
	@echo ================== Making $@
	@cat $D/examples/$(call get_basename, $@)/*.cc \
	  | $(PERL) program2doxygen \
	  > $@


$(example-dox-plain):
	@echo ================== Making $@
	@echo " * <a name=\"PlainProg\"></a>" > $@
	@echo " * <h1> The plain program</h1>" >> $@
	@echo " * " >> $@
	@echo " * (If you are looking at a locally installed deal.II version, then the" >> $@
	@echo " * program can be found at <i>" >> $@
	@echo " * " $D/examples/$(call get_basename,$@)/*.cc | $(PERL) -pi -e 's!/! /!g;' >> $@
	@echo " * </i>. Otherwise, this is only" >> $@
	@echo " * the path on some remote server.)" >> $@
	@echo " @code" >> $@
	@cat $D/examples/$(call get_basename, $@)/*.cc | $(PERL) program2doxyplain >> $@
	@echo " @endcode" >> $@


$(example-doxygen):
	@echo ================== Assembling $@
	@echo "/**" > $@
	@echo " * @page $(shell echo $(call get_basename,$@) | $(PERL) -pi -e 's/-/_/g;') \
	                The $(call get_basename,$@) tutorial program" >> $@
	@echo "@htmlonly" >> $@
	@cat generated/$(call get_basename, $@)_toc.combined >> $@
	@echo "@endhtmlonly" >> $@
	@cat $D/examples/$(call get_basename, $@)/doc/intro.dox \
		| $(PERL) create_anchors >> $@
	@cat generated/$(call get_basename, $@)_prog.dox >> $@
	@cat $D/examples/$(call get_basename, $@)/doc/results.dox \
		| $(PERL) create_anchors >> $@
	@cat generated/$(call get_basename, $@)_plain.dox >> $@
	@echo " */" >> $@


validate-xrefs:
	@$(PERL) $D/common/scripts/validate-xrefs.pl \
                $(filter-out head.html foot.html, \
                             $(shell echo *.html))


clean:
	-rm -f $(example-toc) \
		$(example-toc-prog) $(example-toc-plain) \
		$(example-toc-intro) $(example-toc-results) \
		$(example-dox-prog) $(example-dox-plain) $(example-doxygen)
	-rm -f Makefile.dep


.PHONY: validate-xrefs clean


Makefile.dep: $(shell echo $D/examples/*/*.cc $D/examples/*/doc/*.dox) Makefile
	@mkdir -p generated
	@echo ================== Generating $@
	@for i in $(example-names) ; do \
		echo generated/$${i}_prog.html generated/$${i}_plain.html \
		     generated/$${i}_toc.prog \
		     generated/$${i}_prog.dox generated/$${i}_plain.dox : \
			`echo $D/examples/$${i}/*.cc` ; \
		echo generated/$${i}_toc.plain : generated/$${i}_toc.prog ; \
		echo generated/$${i}_toc.combined : \
			generated/$${i}_toc.intro \
			generated/$${i}_toc.results \
			generated/$${i}_toc.prog \
			generated/$${i}_toc.plain ; \
		echo doxygen/$$i.h : generated/$${i}_prog.dox generated/$${i}_plain.dox \
				generated/$${i}_toc.combined \
				$D/examples/$$i/doc/intro.dox \
				$D/examples/$$i/doc/results.dox \
			 ; \
		echo generated/$${i}_toc.intro : \
				$D/examples/$$i/doc/intro.dox \
			 ; \
		echo generated/$${i}_toc.results : \
				$D/examples/$$i/doc/results.dox \
			 ; \
	 done \
	> $@

include Makefile.dep