make.mk 9.75 KB
Newer Older
1
2
3
#							-*- Automake -*-

# Copyright (C) 2009, 2010 EPITA Research and Development Laboratory (LRDE).
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#
# This file is part of Olena.
#
# Olena 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, version 2 of the License.
#
# Olena 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 Olena.  If not, see <http://www.gnu.org/licenses/>.
#

20
## Process this file through Automake to create Makefile.in.
Guillaume Lazzara's avatar
Guillaume Lazzara committed
21

22
examples_dir = $(doc_dir)/examples
Guillaume Lazzara's avatar
Guillaume Lazzara committed
23

24
PROGRAMS_examples =	\
Guillaume Lazzara's avatar
Guillaume Lazzara committed
25
  accu-right-instanciation 	\
Guillaume Lazzara's avatar
Guillaume Lazzara committed
26
  borderthickness 		\
Guillaume Lazzara's avatar
Guillaume Lazzara committed
27
28
  box2d-bbox 			\
  domain-display 		\
Guillaume Lazzara's avatar
Guillaume Lazzara committed
29
  dpoint-1 			\
Guillaume Lazzara's avatar
Guillaume Lazzara committed
30
  estim-sites 			\
Guillaume Lazzara's avatar
Guillaume Lazzara committed
31
  extend 			\
Guillaume Lazzara's avatar
Guillaume Lazzara committed
32
33
34
35
36
37
  extension-ignore 		\
  fill 				\
  fill-call-1			\
  fill-part-image 		\
  fill-subdomain 		\
  fill-subdomain-shorter	\
Guillaume Lazzara's avatar
Guillaume Lazzara committed
38
  fill-imageif-cfun 		\
39
  first_routine 		\
Guillaume Lazzara's avatar
Guillaume Lazzara committed
40
41
42
43
  forall-piter  		\
  fun-p2v-1 			\
  graph-data 			\
  graph-iter 			\
Guillaume Lazzara's avatar
Guillaume Lazzara committed
44
  ima-has 			\
Guillaume Lazzara's avatar
Guillaume Lazzara committed
45
  ima-save 			\
Guillaume Lazzara's avatar
Guillaume Lazzara committed
46
47
  ima-size 			\
  ima2d-1 			\
Guillaume Lazzara's avatar
Guillaume Lazzara committed
48
49
50
51
52
53
  ima2d-2 			\
  ima2d-3 			\
  ima2d-4 			\
  ima2d-5 			\
  ima2d-6-clone			\
  ima2d-7 			\
Guillaume Lazzara's avatar
Guillaume Lazzara committed
54
  ima2d-rot 			\
Guillaume Lazzara's avatar
Guillaume Lazzara committed
55
56
  ima-size 			\
  labeling-compute 		\
Guillaume Lazzara's avatar
Guillaume Lazzara committed
57
  logical-not 			\
Guillaume Lazzara's avatar
Guillaume Lazzara committed
58
59
60
  mln_var 			\
  parray-bbox 			\
  paste 			\
Guillaume Lazzara's avatar
Guillaume Lazzara committed
61
  paste-call-1 			\
Guillaume Lazzara's avatar
Guillaume Lazzara committed
62
63
64
65
66
  parray-append 		\
  point-1 			\
  predicate-1 			\
  win-create-1 			\
  win-create-2
Guillaume Lazzara's avatar
Guillaume Lazzara committed
67

68
PROGRAMS_examples += 	\
69
70
71
  tuto2_first_image 		\
  tuto3_rw_image 		\
  tuto4_genericity_and_algorithms
Guillaume Lazzara's avatar
Guillaume Lazzara committed
72

73
# Tuto3
74
PROGRAMS_examples += 	\
75
76
77
  tuto3_colorize 		\
  tuto3_println 		\
  tuto3_trace
78

Guillaume Lazzara's avatar
Guillaume Lazzara committed
79
# Tuto4
80
PROGRAMS_examples += 	\
81
82
83
  tuto4_point2d			\
  tuto4_site_set_create

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
EXTRA_PROGRAMS = $(PROGRAMS_examples)

# FIXME: Is this really needed?
CLEANFILES += $(PROGRAMS_examples)

accu_right_instanciation_SOURCES = $(examples_dir)/accu-right-instanciation.cc
borderthickness_SOURCES = $(examples_dir)/borderthickness.cc
box2d_bbox_SOURCES = $(examples_dir)/box2d-bbox.cc
domain_display_SOURCES = $(examples_dir)/domain-display.cc
dpoint_1_SOURCES = $(examples_dir)/dpoint-1.cc
estim_sites_SOURCES = $(examples_dir)/estim-sites.cc
extend_SOURCES = $(examples_dir)/extend.cc
extension_ignore_SOURCES = $(examples_dir)/extension-ignore.cc
fill_SOURCES = $(examples_dir)/fill.cc
fill_call_1_SOURCES = $(examples_dir)/fill-call-1.cc
fill_part_image_SOURCES = $(examples_dir)/fill-part-image.cc
fill_subdomain_SOURCES = $(examples_dir)/fill-subdomain.cc
fill_subdomain_shorter_SOURCES = $(examples_dir)/fill-subdomain-shorter.cc
fill_imageif_cfun_SOURCES = $(examples_dir)/fill-imageif-cfun.cc
first_routine_SOURCES = $(examples_dir)/tuto3/first_routine.cc
forall_piter_SOURCES = $(examples_dir)/forall-piter.cc
fun_p2v_1_SOURCES = $(examples_dir)/fun-p2v-1.cc
graph_data_SOURCES = $(examples_dir)/graph-data.cc
graph_iter_SOURCES = $(examples_dir)/graph-iter.cc
ima_has_SOURCES = $(examples_dir)/ima-has.cc
ima_save_SOURCES = $(examples_dir)/ima-save.cc
ima_size_SOURCES = $(examples_dir)/ima-size.cc
ima2d_1_SOURCES = $(examples_dir)/ima2d-1.cc
ima2d_2_SOURCES = $(examples_dir)/ima2d-2.cc
ima2d_3_SOURCES = $(examples_dir)/ima2d-3.cc
ima2d_4_SOURCES = $(examples_dir)/ima2d-4.cc
ima2d_5_SOURCES = $(examples_dir)/ima2d-5.cc
ima2d_6_clone_SOURCES = $(examples_dir)/ima2d-6-clone.cc
ima2d_7_SOURCES = $(examples_dir)/ima2d-7.cc
ima2d_rot_SOURCES = $(examples_dir)/ima2d-rot.cc
labeling_compute_SOURCES = $(examples_dir)/labeling-compute.cc
logical_not_SOURCES = $(examples_dir)/logical-not.cc
mln_var_SOURCES = $(examples_dir)/mln_var.cc
paste_SOURCES = $(examples_dir)/paste.cc
paste_call_1_SOURCES = $(examples_dir)/paste-call-1.cc
parray_append_SOURCES = $(examples_dir)/parray-append.cc
parray_bbox_SOURCES = $(examples_dir)/parray-bbox.cc
point_1_SOURCES = $(examples_dir)/point-1.cc
predicate_1_SOURCES = $(examples_dir)/predicate-1.cc
win_create_1_SOURCES = $(examples_dir)/win-create-1.cc
win_create_2_SOURCES = $(examples_dir)/win-create-2.cc

tuto2_first_image_SOURCES = $(examples_dir)/tuto2_first_image.cc
tuto3_rw_image_SOURCES = $(examples_dir)/tuto3_rw_image.cc
tuto4_genericity_and_algorithms_SOURCES = $(examples_dir)/tuto4_genericity_and_algorithms.cc
Guillaume Lazzara's avatar
Guillaume Lazzara committed
134

135
# Tuto 3
136
137
138
tuto3_colorize_SOURCES = $(examples_dir)/tuto3/colorize.cc
tuto3_println_SOURCES = $(examples_dir)/tuto3/println.cc
tuto3_trace_SOURCES = $(examples_dir)/tuto3/trace.cc
139

Guillaume Lazzara's avatar
Guillaume Lazzara committed
140
# Tuto 4
141
142
tuto4_site_set_create_SOURCES = $(examples_dir)/tuto4/site_set_create.cc
tuto4_point2d_SOURCES = $(examples_dir)/tuto4/point2d.cc
Guillaume Lazzara's avatar
Guillaume Lazzara committed
143

144

145
146
147
.PHONY : examples run-examples diff-data fix-refdata 		\
	 split-examples split-outputs

148
examples: $(PROGRAMS_examples)
149

150
run-examples: examples
151
152
	test -d $(top_builddir)/milena/doc/figures  			\
		|| mkdir $(top_builddir)/milena/doc/figures;		\
153
154
	failcom='exit 1'; 						\
	list='$(PROGRAMS_examples)'; for bin in $$list; do	\
155
	  echo "Running $$bin"; 					\
156
	  ./$$bin > $(OUTPUTS_SRCDIR)/$$bin.txt || eval $$failcom; 	\
Guillaume Lazzara's avatar
Guillaume Lazzara committed
157
158
	done

159
160
## FIXME: This is wrong.  Make is not an imperative language, and this
## rule probably does not work as expected.
161
data-regen: examples run-examples split-examples split-outputs diff-data
Guillaume Lazzara's avatar
Guillaume Lazzara committed
162
163


164
diff-data: run-examples split-examples
Guillaume Lazzara's avatar
Guillaume Lazzara committed
165
	@failcom='exit 1'; 						\
166
	has_txt_diff="";						\
167
	txtlist="$(OUTPUTS_SRCDIR)/*.txt"; for txt in $$txtlist; do 	\
168
169
	  echo "Diff `basename $$txt`";					\
	  diff $$txt $(OUTPUTS_SRCDIR)/`basename $$txt` >/dev/null 2>&1	\
170
		|| has_txt_diff="$$has_txt_diff `basename $$txt`";	\
171
172
	done;								\
	has_fig_diff="";						\
173
	figlist="$(FIGURES_SRCDIR)/*.p*m"; for fig in $$figlist; do 	\
174
175
	  echo "Diff `basename $$fig`";					\
	  diff $$fig $(FIGURES_SRCDIR)/`basename $$fig` >/dev/null 2>&1 \
176
		|| has_fig_diff="$$has_fig_diff `basename $$fig`";	\
177
178
	done; 								\
	has_split_out_diff="";						\
179
	split_outlist="$(SPLIT_OUTPUTS_SRCDIR)/*"; for split_out in $$split_outlist; do \
180
181
	  echo "Diff `basename $$split_out`";				\
	  diff $$split_out $(SPLIT_OUTPUTS_SRCDIR)/`basename $$split_out` >/dev/null 2>&1 \
182
		|| has_split_out_diff="$$has_split_out_diff `basename $$split_out`";	\
183
184
	done; 								\
	has_split_ex_diff="";						\
185
	split_exlist="$(SPLIT_EXAMPLES_SRCDIR)/*"; for split_ex in $$split_exlist; do \
186
187
	  echo "Diff `basename $$split_ex`";				\
	  diff $$split_ex $(SPLIT_EXAMPLES_SRCDIR)/`basename $$split_ex` >/dev/null 2>&1 \
188
		|| has_split_ex_diff="$$has_split_ex_diff `basename $$split_ex`";	\
189
	done; 								\
190
191
	(test -z "$$has_txt_diff" && test -z "$$has_fig_diff" && 	\
	 test -z "$$has_split_out_diff" && test -z "$$has_split_ex_diff")\
192
193
194
195
196
	 || (echo "--------";						\
	     echo "ERROR: please check if the tutorial needs an update.";\
	     echo "       The following files differ from their \
reference or their reference file does not exist:";  			\
	     echo "--------"; 						\
197
198
199
200
	     echo "* Outputs:";						\
	     echo "";							\
	     echo "$$has_txt_diff"; 					\
	     echo "";							\
201
	     echo "--------"; 						\
202
203
204
205
	     echo "* Figures:"; 					\
	     echo "";							\
	     echo "$$has_fig_diff"; 					\
	     echo "";							\
206
	     echo "--------"; 						\
207
208
209
210
	     echo "* Split outputs:"; 					\
	     echo "";							\
	     echo "$$has_split_out_diff"; 				\
	     echo "";							\
211
	     echo "--------"; 						\
212
213
214
215
	     echo "* Split examples:"; 					\
	     echo "";							\
	     echo "$$has_split_ex_diff"; 				\
	     echo "";							\
216
	     echo "--------"; 						\
217
218
	     echo "* Please update manually the reference files located in:" \
	     echo "";							\
Guillaume Lazzara's avatar
Guillaume Lazzara committed
219
220
	     echo " $(OUTPUTS_SRCDIR)"; 				\
	     echo " $(FIGURES_SRCDIR)"; 				\
221
222
	     echo " $(SPLIT_EXAMPLES_SRCDIR)"; 				\
	     echo " $(SPLIT_OUTPUTS_SRCDIR)"; 				\
223
224
225
226
227
	     echo "";							\
	     echo "* Reference files can updated automatically with 'make fix-refdata'"; \
	     echo "";							\
	     echo "";							\
	     eval $$failcom);
228

Guillaume Lazzara's avatar
Guillaume Lazzara committed
229

Guillaume Lazzara's avatar
Guillaume Lazzara committed
230
231
fix-refdata:
	@failcom='exit 1'; 						\
232
	txtlist="$(OUTPUTS_SRCDIR)/*.txt"; for txt in $$txtlist; do 	\
233
234
	  diff $$txt $(OUTPUTS_SRCDIR)/`basename $$txt` >/dev/null 2>&1	\
		|| echo "Updating reference file for $$txt"; 		\
Guillaume Lazzara's avatar
Guillaume Lazzara committed
235
		   cp $$txt $(OUTPUTS_SRCDIR);				\
236
	done;								\
237
	figlist="$(FIGURES_SRCDIR)/*.p*m"; for fig in $$figlist; do 	\
238
239
	  diff $$fig $(FIGURES_SRCDIR)/`basename $$fig` >/dev/null 2>&1 \
		|| echo "Updating reference file for $$fig";		\
Guillaume Lazzara's avatar
Guillaume Lazzara committed
240
		   cp $$fig $(FIGURES_SRCDIR);				\
241
	done; 								\
242
	split_outlist="$(SPLIT_OUTPUTS_SRCDIR)/*.txt"; for split_out in $$split_outlist; do \
243
244
	  diff $$split_out $(SPLIT_OUTPUTS_SRCDIR)/`basename $$split_out` >/dev/null 2>&1 \
		|| echo "Updating reference file for $$split_out";	\
245
		   cp $$split_out $(SPLIT_OUTPUTS_SRCDIR);		\
246
	done; 								\
247
	split_exlist="$(SPLIT_EXAMPLES_SRCDIR)/*.cc"; for split_ex in $$split_exlist; do \
248
249
	  diff $$split_ex $(SPLIT_EXAMPLES_SRCDIR)/`basename $$split_ex` >/dev/null 2>&1 \
		|| echo "Updating reference file for $$split_ex";	\
250
		   cp $$split_ex $(SPLIT_EXAMPLES_SRCDIR);		\
251
	done;
Guillaume Lazzara's avatar
Guillaume Lazzara committed
252
253


254
split-examples:
255
	test -d $(SPLIT_EXAMPLES_SRCDIR) || mkdir $(SPLIT_EXAMPLES_SRCDIR)
Guillaume Lazzara's avatar
Guillaume Lazzara committed
256
	@failcom='exit 1'; 						\
257
	list=`find $(EXAMPLES_SRCDIR) -type f -name '*.cc'`; for file in $$list; do \
258
	$(DOC_SRCDIR)/tools/split_sample.sh $$file cc raw $(SPLIT_EXAMPLES_SRCDIR)\
Guillaume Lazzara's avatar
Guillaume Lazzara committed
259
260
261
262
					      || eval $$failcom; 	\
	done

split-outputs:
263
	test -d $(SPLIT_OUTPUTS_SRCDIR) || mkdir $(SPLIT_OUTPUTS_SRCDIR)
Guillaume Lazzara's avatar
Guillaume Lazzara committed
264
	@failcom='exit 1'; 						\
265
	list='$(OUTPUTS_SRCDIR)/*.txt'; for file in $$list; do 	\
266
	$(DOC_SRCDIR)/tools/split_sample.sh $$file txt "" $(SPLIT_OUTPUTS_SRCDIR)\
Guillaume Lazzara's avatar
Guillaume Lazzara committed
267
268
269
					      || eval $$failcom; 	\
	done

270
271
## FIXME: Generated products recored in the repository should be
## listed in MAINTAINERCLEANFILES.
Guillaume Lazzara's avatar
Guillaume Lazzara committed
272
clean-local: clean-figures
273
274
##	rm -Rf $(OUTPUTS_BUILDDIR)
##	rm -f $(EXAMPLES_BUILDDIR)/*.cc
Guillaume Lazzara's avatar
Guillaume Lazzara committed
275

276
277
## FIXME: Generated products recored in the repository should be
## listed in MAINTAINERCLEANFILES.
Guillaume Lazzara's avatar
Guillaume Lazzara committed
278
clean-figures:
279
##	rm -Rf $(FIGURES_BUILDDIR)