Makefile.am 22.9 KB
Newer Older
1
# Copyright (C) 2007, 2008, 2009, 2010 EPITA Research and Development
2
# Laboratory (LRDE).
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#
# 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/>.

18
19
# FIXME: To be overhauled! (See ticket #134).

20
21
22
23
24
25
# Look for Milena header in srcdir and for (generated) test headers
# (like data.hh) in builddir.
AM_CPPFLAGS =						\
  -I$(top_srcdir)/milena -I$(top_builddir)/milena	\
  -I$(top_srcdir)/milena/doc/tutorial/tools

Guillaume Lazzara's avatar
Guillaume Lazzara committed
26
DOXYGEN = doxygen
27

28
29
DOXYFILE = Doxyfile

30

31
32
33
34
35
36
37
38
## --------------------- ##
## LaTeX configuration.  ##
## --------------------- ##

include $(top_srcdir)/build-aux/tex.mk

# FIXME: Check this list.
TEXI2DVI_FLAGS +=							\
Roland Levillain's avatar
Roland Levillain committed
39
40
  -I $(srcdir) -I $(srcdir)/outputs -I $(srcdir)/outputs/split		\
  -I $(srcdir)/img -I $(srcdir)/examples/split
41

Roland Levillain's avatar
Roland Levillain committed
42
43
# Additional files for LaTeX compilations.
DOC_PACKAGES = doxyfuns.sty milena.sty
44
45


46
47
48
49
## --------- ##
## Figures.  ##
## --------- ##

50
# Generate a Makefile helper containing the list of generated figures.
51
EXTRA_DIST = gen-figures-mk
52
53
54
55
56
$(srcdir)/figures.mk: $(srcdir)/gen-figures-mk
	rm -f $@.tmp
	cd $(srcdir) && ./gen-figures-mk >figures.mk.tmp
	mv -f $@.tmp $@
	chmod -w $@
57
include $(srcdir)/figures.mk
58
EXTRA_DIST += $(FIGURES)
59
60
MAINTAINERCLEANFILES = $(FIGURES)

61
62
63
64
65
66
67
.PHONY: regen-figures-mk
regen-figures-mk:
	rm -f $(srcdir)/figures.mk.tmp
	cd $(srcdir) && ./gen-figures-mk >figures.mk.tmp
	mv -f $(srcdir)/figures.mk.tmp $(srcdir)/figures.mk
	chmod -w $(srcdir)/figures.mk

68
69
70
# ------------- #
# PNG figures.  #
# ------------- #
71

72
# PNG figures are generated from PBM, PGM and PPM figures.
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91

convert_to_png = convert -scale 250 -bordercolor black -border 2x2

SUFFIXES += .pbm .pgm .ppm .png

.pbm.png:
	$(convert_to_png) $< $@

.pgm.png:
	$(convert_to_png) $< $@

.ppm.png:
	$(convert_to_png) $< $@

PNG_FIGURES =					\
  $(PBM_FIGURES:.pbm=.png)			\
  $(PGM_FIGURES:.pgm=.png)			\
  $(PPM_FIGURES:.ppm=.png)
EXTRA_DIST += $(PNG_FIGURES)
92
MAINTAINERCLEANFILES += $(PNG_FIGURES)
93

94
95
96
97
98
99
100
101
# --------------- #
# Other figures.  #
# --------------- #

# This image seems to be used nowhere.
MORE_FIGURES = figures/accu_image_morpher_big_picture.pdf
EXTRA_DIST += $(MORE_FIGURES)

102

103
104
105
106
## ---------- ##
## Examples.  ##
## ---------- ##

107
108
109
# Generate a Makefile helper containing a variable assignment.
EXTRA_DIST += gen-make-variable

110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
$(srcdir)/examples.mk: $(srcdir)/gen-make-variable
	rm -f $@.tmp
	$(srcdir)/gen-make-variable EXAMPLES	\
	  `find $(srcdir)/examples -name '*.cc'	\
	     | sed 's,^$(srcdir),\$$(srcdir),'`	\
	  >$@.tmp
	mv -f $@.tmp $@
	chmod -w $@
include $(srcdir)/examples.mk
EXTRA_DIST += $(EXAMPLES)

.PHONY: regen-examples-mk
regen-examples-mk:
	rm -f $(srcdir)/examples.mk.tmp
	$(srcdir)/gen-make-variable EXAMPLES	\
	  `find $(srcdir)/examples -name '*.cc'	\
	     | sed 's,^$(srcdir),\$$(srcdir),'`	\
	  >$(srcdir)/examples.mk.tmp
	mv -f $(srcdir)/examples.mk.tmp $(srcdir)/examples.mk
	chmod -w $(srcdir)/examples.mk

131
132
133
134
135
136
137
138
139
# Examples used in the technical documentation. 
TECHNICAL_EXAMPLES =				\
  examples/devel/dispatch.cc.raw		\
  examples/devel/facade.cc.raw			\
  examples/devel/impl.cc.raw
EXTRA_DIST += $(TECHNICAL_EXAMPLES)

# Non generated examples.
MORE_EXAMPLES =					\
Roland Levillain's avatar
Roland Levillain committed
140
  examples/accu-wrong-instantiation.cc.raw	\
141
142
143
144
145
146
147
  examples/fill-proto.cc.raw			\
  examples/ima2d-restricted-1.cc.raw		\
  examples/ima2d-restricted-2.cc.raw		\
  examples/ima2d-restricted-3.cc.raw		\
  examples/tuto3/fill_non_generic.cc.raw
EXTRA_DIST += $(MORE_EXAMPLES)

148
149
150
151
## ---------------- ##
## Split examples.  ##
## ---------------- ##

152
153
# Generate a Makefile helper handling the generation of split examples.
EXTRA_DIST += gen-split-examples-mk
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
$(srcdir)/split-examples.mk: $(srcdir)/gen-split-examples-mk
	rm -f $@.tmp
	cd $(srcdir) && ./gen-split-examples-mk >split-examples.mk.tmp
	mv -f $@.tmp $@
	chmod -w $@
include $(srcdir)/split-examples.mk
EXTRA_DIST += $(SPLIT_EXAMPLES)
MAINTAINERCLEANFILES += $(SPLIT_EXAMPLES)

.PHONY: regen-split-examples-mk
regen-split-examples-mk:
	rm -f $(srcdir)/split-examples.mk.tmp
	cd $(srcdir) && ./gen-split-examples-mk >split-examples.mk.tmp
	mv -f $(srcdir)/split-examples.mk.tmp $(srcdir)/split-examples.mk
	chmod -w $(srcdir)/split-examples.mk


171
172
173
174
## ----------------------- ##
## Doxygen documentation.  ##
## ----------------------- ##

175
refman_dependencies =				\
176
  $(PNG_FIGURES)				\
177
178
179
  $(srcdir)/tutorial/tutorial.hh		\
  $(srcdir)/ref_guide/ref_guide.hh

180
181
182
# ----------------------- #
# User reference manual.  #
# ----------------------- #
183

184
all-local: $(srcdir)/$(USER_REFMAN) $(srcdir)/$(USER_REFMAN_PDF)
185

186
187
188
189
190
# Run "make regen-doc" to forcefully rebuild the Doxygen documentation.
.PHONY: regen-doc
regen-doc:
	-rm -f $(srcdir)/user-refman.stamp
	$(MAKE) $(AM_MAKEFLAGS) $(srcdir)/user-refman.stamp
191

192
DOXYFILE_USER = Doxyfile_user
193

Roland Levillain's avatar
Roland Levillain committed
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# Sed is used to generate Doxyfile from Doxyfile.in instead of
# configure, because the former is way faster than the latter.
#
## FIXME: This is because, as in TC, we depend on $Id$ from the
## ChangeLog.  Maybe we should depend from something less prone to
## change.  See Bison's build system.
edit = sed -e "s|@ID@|$$Id|"					\
	   -e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g'		\
	   -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g'	\
	   -e 's,@top_srcdir\@,$(top_srcdir),g'			\
	   -e 's,@top_builddir\@,$(top_builddir),g'		\
	   -e 's,@srcdir\@,$(srcdir),g'				\
	   -e 's,@builddir\@,$(builddir),g'

$(DOXYFILE_USER): $(srcdir)/$(DOXYFILE).in
	Id=`grep '^\$$Id' $(top_srcdir)/milena/ChangeLog	\
	      | sed -e 's/\\\$$//g'`;				\
	  $(edit) $< >$@
212
MAINTAINERCLEANFILES += $(DOXYFILE_USER)
Roland Levillain's avatar
Roland Levillain committed
213

214
USER_REFMAN_PDF = user-refman.pdf
215
USER_REFMAN = user-refman
216

217
218
219
$(srcdir)/$(USER_REFMAN_PDF): $(srcdir)/$(USER_REFMAN)
	cd $(srcdir)/$(USER_REFMAN)/latex && $(MAKE) $(AM_MAKEFLAGS) pdf
	cp -f $(srcdir)/$(USER_REFMAN)/latex/refman.pdf $@
220

221
222
EXTRA_DIST += $(srcdir)/user-refman.stamp
MAINTAINERCLEANFILES += $(srcdir)/user-refman.stamp
223
$(srcdir)/user-refman.stamp: $(srcdir)/$(DOXYFILE).in $(refman_dependencies)
224
225
	@rm -f $@.tmp
	@touch $@.tmp
226
	-rm -rf $(USER_REFMAN).tmp
227
228
	$(MAKE) $(AM_MAKE_FLAGS) $(DOXYFILE_USER)
	$(DOXYGEN) $(DOXYFILE_USER)
229
230
## Doxygen may generate an incomplete output and exit with success!
## Check some files before deeming the output as acceptable.
231
	test -f $(USER_REFMAN).tmp/latex/refman.tex
232
233
	-rm -rf $(srcdir)/$(USER_REFMAN)
## FIXME: Moving directories between file systems is not portable.
234
	mv $(USER_REFMAN).tmp $(srcdir)/$(USER_REFMAN)
235
236
	@mv -f $@.tmp $@

237
$(srcdir)/$(USER_REFMAN): $(srcdir)/user-refman.stamp
238
239
240
241
242
243
## Recover from the removal of $@
	@if test -d $@; then :; else \
	  rm -f $<; \
	  $(MAKE) $(AM_MAKEFLAGS) $<; \
	fi

244
245
246
# ---------------------------- #
# Developer reference manual.  #
# ---------------------------- #
247

248
249
250
251
252
253
# Run "make regen-devel-doc" to forcefully rebuild the Doxygen
# developer documentation.
.PHONY: regen-devel-doc
regen-devel-doc:
	-rm -f $(srcdir)/devel-refman.stamp
	$(MAKE) $(AM_MAKEFLAGS) $(srcdir)/devel-refman.stamp
254

255
DOXYFILE_DEVEL = Doxyfile_devel
256

Roland Levillain's avatar
Roland Levillain committed
257
edit_devel = sed							      \
258
  -e 's,OUTPUT_DIRECTORY       = @builddir@/user-refman.tmp/,OUTPUT_DIRECTORY       = @builddir@/devel-refman.tmp/,' \
Roland Levillain's avatar
Roland Levillain committed
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
  -e 's,EXTRACT_ALL            = NO,EXTRACT_ALL            = YES,'	      \
  -e 's,EXTRACT_PRIVATE        = NO,EXTRACT_PRIVATE        = YES,'	      \
  -e 's,EXTRACT_STATIC         = NO,EXTRACT_STATIC         = YES,'	      \
  -e 's,EXTRACT_LOCAL_CLASSES  = NO,EXTRACT_LOCAL_CLASSES  = YES,'	      \
  -e 's,HIDE_UNDOC_MEMBERS     = YES,HIDE_UNDOC_MEMBERS     = NO,'	      \
  -e 's,HIDE_UNDOC_CLASSES     = YES,HIDE_UNDOC_CLASSES     = NO,'	      \
  -e 's,HIDE_FRIEND_COMPOUNDS  = YES,HIDE_FRIEND_COMPOUNDS  = NO,'	      \
  -e 's,HIDE_IN_BODY_DOCS      = YES,HIDE_IN_BODY_DOCS      = NO,'	      \
  -e 's,INTERNAL_DOCS          = NO,INTERNAL_DOCS          = YES,'	      \
  -e 's,GENERATE_TODOLIST      = NO,GENERATE_TODOLIST      = YES,'	      \
  -e 's,PROJECT_NUMBER         = \"User documentation ,PROJECT_NUMBER         = \",'	 \
  -e 's,EXCLUDE_SYMBOLS	       = \*::internal\* \*_ mln::trait::\*,EXCLUDE_SYMBOLS	       =,'

$(DOXYFILE_DEVEL): $(srcdir)/$(DOXYFILE).in
	rm -f $@.tmp
	Id=`grep '^\$$Id' $(top_srcdir)/milena/ChangeLog	\
	      | sed -e 's/\\\$$//g'`;				\
	  $(edit) $< >$@.tmp
	$(edit_devel) $@.tmp >$@
	rm -f $@.tmp
279
MAINTAINERCLEANFILES += $(DOXYFILE_DEVEL)
Roland Levillain's avatar
Roland Levillain committed
280

281
DEVEL_REFMAN_PDF = devel-refman.pdf
282
DEVEL_REFMAN = devel-refman
283

284
285
286
287
288
289
# Be warned, most LaTeX installations will not be able to compile the
# PDF development documentation as-is, as TeX's default memory
# capacities are usually too small to handle such a large document.
$(srcdir)/$(DEVEL_REFMAN_PDF): $(srcdir)/$(DEVEL_REFMAN)
	cd $(srcdir)/$(DEVEL_REFMAN)/latex && $(MAKE) $(AM_MAKEFLAGS) pdf
	cp -f $(srcdir)/$(DEVEL_REFMAN)/latex/refman.pdf $@
290

291
MAINTAINERCLEANFILES += $(srcdir)/devel-refman.stamp
292
$(srcdir)/devel-refman.stamp: $(srcdir)/$(DOXYFILE).in $(refman_dependencies)
293
294
	@rm -f $@.tmp
	@touch $@.tmp
295
	-rm -rf $(DEVEL_REFMAN).tmp
296
297
	$(MAKE) $(AM_MAKE_FLAGS) $(DOXYFILE_DEVEL)
	$(DOXYGEN) $(DOXYFILE_DEVEL)
298
299
## Doxygen may generate an incomplete output and exit with success!
## Check some files before deeming the output as acceptable.
300
	test -f $(DEVEL_REFMAN).tmp/latex/refman.tex
301
302
	-rm -rf $(srcdir)/$(DEVEL_REFMAN)
## FIXME: Moving directories between file systems is not portable.
303
	mv $(DEVEL_REFMAN).tmp $(srcdir)/$(DEVEL_REFMAN)
304
305
	@mv -f $@.tmp $@

306
$(srcdir)/$(DEVEL_REFMAN): $(srcdir)/devel-refman.stamp
307
308
309
310
311
312
313
314
315
## Recover from the removal of $@
	@if test -d $@; then :; else \
	  rm -f $<; \
	  $(MAKE) $(AM_MAKEFLAGS) $<; \
	fi


# Clean Doxygen products.
maintainer-clean-local:
316
317
	-rm -rf $(USER_REFMAN).tmp $(srcdir)/$(USER_REFMAN)
	-rm -rf $(DEVEL_REFMAN).tmp $(srcdir)/$(DEVEL_REFMAN)
318

Guillaume Lazzara's avatar
Guillaume Lazzara committed
319

320
321
322
323
## ------------------------- ##
## Technical Documentation.  ##
## ------------------------- ##

Roland Levillain's avatar
Roland Levillain committed
324
technical_dir = $(srcdir)/technical
325

Roland Levillain's avatar
Roland Levillain committed
326
327
328
329
technical_dependencies =			\
  $(TECHNICAL_EXAMPLES)				\
  $(PNG_FIGURES)				\
  $(DOC_PACKAGES)
330

331
# Final product.
332
TECHNICAL_HTML = $(technical_dir)/technical.html
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
TECHNICAL_HTML_OUTPUTS = $(TECHNICAL_HTML) $(technical_dir)/technical.css

EXTRA_DIST += $(TECHNICAL_HTML).stamp
MAINTAINERCLEANFILES += $(TECHNICAL_HTML).stamp
# HTML outputs contains several files (the HTML file itself, its CSS
# style sheet, possibly some images).  Therefore, we cannot rely on a
# simple suffix rule to produce them.
$(TECHNICAL_HTML).stamp: $(technical_dir)/technical.tex $(technical_dependencies)
	@rm -f $@.tmp
	@touch $@.tmp
	$(TEXI2HTML) $(TEXI2HTML_FLAGS) -o $(TECHNICAL_HTML) $<
	@mv -f $@.tmp $@

$(TECHNICAL_HTML_OUTPUTS): $(TECHNICAL_HTML).stamp
## Recover from the removal of $@
348
	@if test -f $@; then :; else \
349
350
351
	  rm -f $<; \
	  $(MAKE) $(AM_MAKEFLAGS) $<; \
	fi
352

353
dist_html_DATA = $(TECHNICAL_HTML_OUTPUTS)
354

355
356
357
358
## FIXME: technical technical.hh does not seem to be used (by the
## Doyxgen documentation); remove its generation? Careful,
## technical/technical.html *is* probably required, though.

359
360
361
362
363
364
365
# Intermediate product for the various doc targets of the parent
# directory.
#
# This is not a bug: TECHNICAL_HH is meant to have a `.hh'
# extension, since it is later parsed by Doxygen, which complains
# about `.html' files.
TECHNICAL_HH = $(technical_dir)/technical.hh
Roland Levillain's avatar
Roland Levillain committed
366
$(TECHNICAL_HH): $(TECHNICAL_HTML) $(srcdir)/tools/todoxygen.sh
367
368
369
370
371
# The script `todoxygen.sh' may fail and still create a (partial and
# invalid) file, thus preventing Make from trying to generate it
# again.  The solution is to use a temporary file as output and rename
# it if the script succeeds.
	rm -f $@.tmp
Roland Levillain's avatar
Roland Levillain committed
372
	$(srcdir)/tools/todoxygen.sh $< $@.tmp $(srcdir)
373
	mv -f $@.tmp $@
374
375
376
377


# Final product.
TECHNICAL_PDF = $(technical_dir)/technical.pdf
378
379
# Extra dependencies.
$(TECHNICAL_PDF): $(technical_dependencies)
380

381
dist_pdf_DATA = $(TECHNICAL_PDF)
382
383
384
385
386

EXTRA_DIST +=					\
  $(technical_dir)/technical.tex		\
  $(TECHNICAL_HH)

387
MAINTAINERCLEANFILES += $(TECHNICAL_HH)
388

389
390
391
392
## ---------- ##
## Tutorial.  ##
## ---------- ##

Roland Levillain's avatar
Roland Levillain committed
393
tutorial_dir = $(srcdir)/tutorial
394
395

tutorial_dependencies =				\
Roland Levillain's avatar
Roland Levillain committed
396
  $(EXAMPLES)					\
397
  $(SPLIT_EXAMPLES)				\
Roland Levillain's avatar
Roland Levillain committed
398
  $(OUTPUTS)					\
399
  $(SPLIT_OUTPUTS)				\
Roland Levillain's avatar
Roland Levillain committed
400
401
  $(PNG_FIGURES)				\
  $(DOC_PACKAGES)
402

403
# Final product.
404
TUTORIAL_HTML = $(tutorial_dir)/tutorial.html
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
TUTORIAL_HTML_OUTPUTS = $(TUTORIAL_HTML) $(tutorial_dir)/tutorial.css

EXTRA_DIST += $(TUTORIAL_HTML).stamp
MAINTAINERCLEANFILES += $(TUTORIAL_HTML).stamp
# HTML outputs contains several files (the HTML file itself, its CSS
# style sheet, possibly some images).  Therefore, we cannot rely on a
# simple suffix rule to produce them.
$(TUTORIAL_HTML).stamp: $(tutorial_dir)/tutorial.tex $(tutorial_dependencies)
	@rm -f $@.tmp
	@touch $@.tmp
	$(TEXI2HTML) $(TEXI2HTML_FLAGS) -o $(TUTORIAL_HTML) $<
	@mv -f $@.tmp $@

$(TUTORIAL_HTML_OUTPUTS): $(TUTORIAL_HTML).stamp
## Recover from the removal of $@
420
	@if test -f $@; then :; else \
421
422
423
	  rm -f $<; \
	  $(MAKE) $(AM_MAKEFLAGS) $<; \
	fi
424

425
dist_html_DATA += $(TUTORIAL_HTML_OUTPUTS)
426

427
428
429
430
431
432
433
# Intermediate product for the various doc targets of the parent
# directory.
#
# This is not a bug: TUTORIAL_HH is meant to have a `.hh' extension,
# since it is later parsed by Doxygen, which complains about `.html'
# files.
TUTORIAL_HH = $(tutorial_dir)/tutorial.hh
Roland Levillain's avatar
Roland Levillain committed
434
$(TUTORIAL_HH): $(TUTORIAL_HTML) $(srcdir)/tools/todoxygen.sh
435
436
437
438
439
# The script `todoxygen.sh' may fail and still create a (partial and
# invalid) file, thus preventing Make from trying to generate it
# again.  The solution is to use a temporary file as output and rename
# it if the script succeeds.
	rm -f $@.tmp
Roland Levillain's avatar
Roland Levillain committed
440
	$(srcdir)/tools/todoxygen.sh $< $@.tmp $(srcdir)
441
	mv -f $@.tmp $@
442

443

444
445
# Final product.
TUTORIAL_PDF = $(tutorial_dir)/tutorial.pdf
446
447
# Extra dependencies.
$(TUTORIAL_PDF): $(tutorial_dependencies)
448

449
dist_pdf_DATA += $(TUTORIAL_PDF)
450
451
452
453
454

EXTRA_DIST +=					\
  $(tutorial_dir)/tutorial.tex			\
  $(TUTORIAL_HH)

455
MAINTAINERCLEANFILES += $(TUTORIAL_HH)
456

457

458
459
460
461
## ------------- ##
## White Paper.  ##
## ------------- ##

Roland Levillain's avatar
Roland Levillain committed
462
white_paper_dir = $(srcdir)/white_paper
463
464
465
466
467
468
469
470
471
472
473
474

PNGS =								\
  $(white_paper_dir)/figures/house.png				\
  $(white_paper_dir)/figures/house_rag.png			\
  $(white_paper_dir)/figures/house_wshed.png			\
  $(white_paper_dir)/figures/house_wshed_mean_colors.png

EPSS = $(PNGS:png=eps)

.png.eps:
	convert $< $@

475
476
# Final product.
WHITE_PAPER_HTML = $(white_paper_dir)/white_paper.html
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
WHITE_PAPER_HTML_OUTPUTS =			\
  $(WHITE_PAPER_HTML)				\
  $(white_paper_dir)/white_paper.css		\
  $(white_paper_dir)/white_paper0x.png		\
  $(white_paper_dir)/white_paper1x.png		\
  $(white_paper_dir)/white_paper2x.png		\
  $(white_paper_dir)/white_paper3x.png

EXTRA_DIST += $(WHITE_PAPER_HTML).stamp
MAINTAINERCLEANFILES += $(WHITE_PAPER_HTML).stamp
# HTML outputs contains several files (the HTML file itself, its CSS
# style sheet, possibly some images).  Therefore, we cannot rely on a
# simple suffix rule to produce them.
$(WHITE_PAPER_HTML).stamp: $(white_paper_dir)/white_paper.tex $(EPSS)
	@rm -f $@.tmp
	@touch $@.tmp
	$(TEXI2HTML) $(TEXI2HTML_FLAGS) -o $(WHITE_PAPER_HTML) $<
	@mv -f $@.tmp $@

$(WHITE_PAPER_HTML_OUTPUTS): $(WHITE_PAPER_HTML).stamp
## Recover from the removal of $@
498
	@if test -f $@; then :; else \
499
500
501
	  rm -f $<; \
	  $(MAKE) $(AM_MAKEFLAGS) $<; \
	fi
502

503
dist_html_DATA += $(WHITE_PAPER_HTML_OUTPUTS)
504
505

WHITE_PAPER_PDF = $(white_paper_dir)/white_paper.pdf
506
507
# Extra dependencies.
$(WHITE_PAPER_PDF): $(PNGS)
508

509
dist_pdf_DATA += $(WHITE_PAPER_PDF)
510
511
512
513
514
515

EXTRA_DIST +=					\
  $(white_paper_dir)/white_paper.tex		\
  $(PNGS)					\
  $(EPSS)

516
MAINTAINERCLEANFILES += $(EPSS)
517

518

519
520
521
522
## ----------------- ##
## Reference Guide.  ##
## ----------------- ##

Roland Levillain's avatar
Roland Levillain committed
523
ref_guide_dir = $(srcdir)/ref_guide
524
525

ref_guide_dependencies =			\
Roland Levillain's avatar
Roland Levillain committed
526
  $(EXAMPLES)					\
527
  $(SPLIT_EXAMPLES)				\
Roland Levillain's avatar
Roland Levillain committed
528
  $(OUTPUTS)					\
529
  $(SPLIT_OUTPUTS)				\
Roland Levillain's avatar
Roland Levillain committed
530
531
  $(PNG_FIGURES)				\
  $(DOC_PACKAGES)
532

533
# Final product.
534
REF_GUIDE_HTML = $(ref_guide_dir)/ref_guide.html
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
REF_GUIDE_HTML_OUTPUTS =			\
  $(REF_GUIDE_HTML)				\
  $(ref_guide_dir)/ref_guide.css		\
  $(ref_guide_dir)/ref_guide0x.png

EXTRA_DIST += $(REF_GUIDE_HTML).stamp
MAINTAINERCLEANFILES += $(REF_GUIDE_HTML).stamp
# HTML outputs contains several files (the HTML file itself, its CSS
# style sheet, possibly some images).  Therefore, we cannot rely on a
# simple suffix rule to produce them.
$(REF_GUIDE_HTML).stamp: $(ref_guide_dir)/ref_guide.tex $(ref_guide_dependencies)
	@rm -f $@.tmp
	@touch $@.tmp
	$(TEXI2HTML) $(TEXI2HTML_FLAGS) -o $(REF_GUIDE_HTML) $<
	@mv -f $@.tmp $@

$(REF_GUIDE_HTML_OUTPUTS): $(REF_GUIDE_HTML).stamp
## Recover from the removal of $@
553
	@if test -f $@; then :; else \
554
555
556
	  rm -f $<; \
	  $(MAKE) $(AM_MAKEFLAGS) $<; \
	fi
557

558
dist_html_DATA += $(REF_GUIDE_HTML_OUTPUTS)
559

560
561
562
563
564
565
566
# Intermediate product for the various doc targets of the parent
# directory.
#
# This is not a bug: REF_GUIDE_HH is meant to have a `.hh' extension,
# since it is later parsed by Doxygen, which complains about `.html'
# files.
REF_GUIDE_HH = $(ref_guide_dir)/ref_guide.hh
Roland Levillain's avatar
Roland Levillain committed
567
$(REF_GUIDE_HH): $(REF_GUIDE_HTML) $(srcdir)/tools/todoxygen.sh
568
569
570
571
572
# The script `todoxygen.sh' may fail and still create a (partial and
# invalid) file, thus preventing Make from trying to generate it
# again.  The solution is to use a temporary file as output and rename
# it if the script succeeds.
	rm -f $@.tmp
Roland Levillain's avatar
Roland Levillain committed
573
	$(srcdir)/tools/todoxygen.sh $< $@.tmp $(srcdir)
574
	mv -f $@.tmp $@
575
576
577
578


# Final product.
REF_GUIDE_PDF = $(ref_guide_dir)/ref_guide.pdf
579
580
# Extra dependencies.
$(REF_GUIDE_PDF): $(ref_guide_dependencies)
581

582
dist_pdf_DATA += $(REF_GUIDE_PDF)
583
584
585
586
587

EXTRA_DIST +=					\
  $(ref_guide_dir)/ref_guide.tex		\
  $(REF_GUIDE_HH)

588
MAINTAINERCLEANFILES += $(REF_GUIDE_HH)
Guillaume Lazzara's avatar
Guillaume Lazzara committed
589
590


591
## ---------- ##
592
## Programs.  ##
593
594
## ---------- ##

595
include $(srcdir)/programs-examples.mk
596
EXTRA_PROGRAMS = $(PROGRAMS_examples)
597
CLEANFILES = $(PROGRAMS_examples)
598

599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
## --------- ##
## Outputs.  ##
## --------- ##

$(srcdir)/outputs.mk: $(srcdir)/gen-make-variable
	rm -f $@.tmp
# Ignore sources in examples/trash/.
	$(srcdir)/gen-make-variable OUTPUTS				\
	  `find $(srcdir)/examples					\
               -name \*.cc -a \! -path $(srcdir)/examples/trash/\*	\
	     | sed -e 's,$(srcdir)/examples/,,'				\
	           -e 'y,/,_,'						\
	           -e 's,\(.*\)\.cc$$,$$(srcdir)/outputs/\1.txt,'`	\
	  >$@.tmp
	mv -f $@.tmp $@
	chmod -w $@
include $(srcdir)/outputs.mk
EXTRA_DIST += $(OUTPUTS)
MAINTAINERCLEANFILES += $(OUTPUTS)

.PHONY: regen-outputs-mk
regen-outputs-mk:
	rm -f $(srcdir)/outputs.mk.tmp
# Ignore sources in examples/trash/.
	$(srcdir)/gen-make-variable OUTPUTS				\
	  `find $(srcdir)/examples					\
               -name \*.cc -a \! -path $(srcdir)/examples/trash/\*	\
	     | sed -e 's,$(srcdir)/examples/,,'				\
	           -e 'y,/,_,'						\
	           -e 's,\(.*\)\.cc$$,$$(srcdir)/outputs/\1.txt,'`	\
	  >$(srcdir)/outputs.mk.tmp
	mv -f $(srcdir)/outputs.mk.tmp $(srcdir)/outputs.mk
	chmod -w $(srcdir)/outputs.mk
632

633
634
635
## These outputs are also required by the (LaTeX) documentation.
## However, they have no corresponding program in examples/, hence
## they cannot be regenerated.
636
637
638
639
640
641
642
643
MORE_OUTPUTS =					\
  $(srcdir)/outputs/graph-output-1.txt		\
  $(srcdir)/outputs/ima2d-display-1.txt		\
  $(srcdir)/outputs/ima2d-display-2.txt		\
  $(srcdir)/outputs/ima2d-display-output-1.txt	\
  $(srcdir)/outputs/ima2d-display-output-2.txt	\
  $(srcdir)/outputs/parray-display-1.txt	\
  $(srcdir)/outputs/win-create-1-display.txt
Roland Levillain's avatar
Roland Levillain committed
644
EXTRA_DIST += $(MORE_OUTPUTS)
645

646
# Generate a Makefile helper containing outputs rules and timestamps.
647
648
EXTRA_DIST += gen-examples-outputs-mk

649
650
651
652
653
654
655
656
$(srcdir)/examples-outputs.mk: $(srcdir)/gen-examples-outputs-mk
	rm -f $@.tmp
# Ignore sources in examples/trash/.
	cd $(srcdir) &&							\
	  ./gen-examples-outputs-mk					\
	    `find examples -name \*.cc -a \! -path examples/trash/\*	\
	       | env LC_ALL=C sort`					\
	    >examples-outputs.mk.tmp
657
658
	mv -f $@.tmp $@
	chmod -w $@
659
include $(srcdir)/examples-outputs.mk
660

661
662
.PHONY: regen-examples-outputs-mk
regen-examples-outputs-mk:
663
664
665
666
667
668
669
670
	rm -f $(srcdir)/examples-outputs.mk.tmp
	cd $(srcdir) &&							\
	  ./gen-examples-outputs-mk					\
	    `find examples -name \*.cc -a \! -path examples/trash/\*	\
	       | env LC_ALL=C sort`					\
	    >examples-outputs.mk.tmp
	mv -f $(srcdir)/examples-outputs.mk.tmp $(srcdir)/examples-outputs.mk
	chmod -w $(srcdir)/examples-outputs.mk
671

672
673
674
## --------------- ##
## Split outputs.  ##
## --------------- ##
675

676
677
# Generate a Makefile helper handling the generation of split outputs.
EXTRA_DIST += gen-split-outputs-mk
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
$(srcdir)/split-outputs.mk: $(srcdir)/gen-split-outputs-mk
	rm -f $@.tmp
	cd $(srcdir) && ./gen-split-outputs-mk >split-outputs.mk.tmp
	mv -f $@.tmp $@
	chmod -w $@
include $(srcdir)/split-outputs.mk
EXTRA_DIST += $(SPLIT_OUTPUTS)
MAINTAINERCLEANFILES += $(SPLIT_OUTPUTS)

.PHONY: regen-split-outputs-mk
regen-split-outputs-mk:
	rm -f $(srcdir)/split-outputs.mk.tmp
	cd $(srcdir) && ./gen-split-outputs-mk >split-outputs.mk.tmp
	mv -f $(srcdir)/split-outputs.mk.tmp $(srcdir)/split-outputs.mk
	chmod -w $(srcdir)/split-outputs.mk
693

694

695
696
697
698
## -------------- ##
## Regeneration.  ##
## -------------- ##

699
# Regen Make helpers.
700
EXTRA_DIST += generate_dist_files.sh
701
702
include $(top_srcdir)/build-aux/regen-recursive.mk
regen-am:
703
	$(MAKE) $(AM_MAKEFLAGS) regen-figures-mk
704
705
706
	$(MAKE) $(AM_MAKEFLAGS) regen-pbm-figures-mk
	$(MAKE) $(AM_MAKEFLAGS) regen-pgm-figures-mk
	$(MAKE) $(AM_MAKEFLAGS) regen-ppm-figures-mk
707
	$(MAKE) $(AM_MAKEFLAGS) regen-examples-mk
708
	$(MAKE) $(AM_MAKEFLAGS) regen-split-examples-mk
709
	$(MAKE) $(AM_MAKEFLAGS) regen-outputs-mk
710
	$(MAKE) $(AM_MAKEFLAGS) regen-examples-outputs-mk
711
	$(MAKE) $(AM_MAKEFLAGS) regen-split-outputs-mk
Guillaume Lazzara's avatar
Guillaume Lazzara committed
712

713

714
715
716
717
718
## -------------- ##
## Installation.  ##
## -------------- ##

# PDF.
719
dist_pdf_DATA += $(USER_REFMAN_PDF)
720

721
# HTML.
722
# Installing a directory located in the source dir is not supported by
723
# Automake by default, so we cannot add `$(USER_REFMAN)/html' to
724
725
# `dist_doc_DATA'.  The following two rules are are workaround from
# the Vaucanson project.
726
EXTRA_DIST += $(USER_REFMAN)/html
727
728
729
730
731

# We install by hand, otherwise Automake produces "install .../srcdoc
# .../srcdoc", which installs our dir into the previous one, instead
# of replacing it.
install-data-local:
732
	rm -rf $(DESTDIR)$(htmldir)/$(USER_REFMAN)/html
733
	$(mkdir_p) $(DESTDIR)$(htmldir)
734
	cp -r $(srcdir)/$(USER_REFMAN)/html $(DESTDIR)$(htmldir)/user-refman
735
736
737
738
739
740
741
## Try GNU chmod's X mode before resorting to something slower but
## more standard.
	chmod -R a+rX $(DESTDIR)$(htmldir) || \
	find $(DESTDIR)$(htmldir) \( -type d -a -exec chmod a+rx {} \; \) \
             -o -exec chmod a+r {} \;

uninstall-local:
742
743
	chmod -R 700 $(DESTDIR)$(htmldir)/user-refman
	rm -rf $(DESTDIR)$(htmldir)/user-refman
744

745

746
747
748
MAINTAINERCLEANFILES += $(dist_html_DATA) $(dist_pdf_DATA)


Roland Levillain's avatar
Roland Levillain committed
749
EXTRA_DIST +=					\
750
  $(DOXYFILE).in				\
751
752
753
754
755
756
757
758
759
760
  groups/accu.hh				\
  groups/graph.hh				\
  groups/images.hh				\
  groups/main.hh				\
  groups/neighb.hh				\
  groups/site_set.hh				\
  groups/util.hh				\
  groups/win.hh					\
  img/small-enlarged.png			\
  img/small.png					\
Roland Levillain's avatar
Roland Levillain committed
761
762
763
764
765
  doxyfuns.sty					\
  milena.sty					\
  tools/clearbanner.sh				\
  tools/sample_utils.hh				\
  tools/split_sample.sh				\
766
  tools/todoxygen.sh