Makefile.am 32 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# 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

## FIXME: Upercase variables should be reserved for special names:
## classical Make variables (e.g. `CXXFLAGS') Automake variables
## (e.g. `SUBDIRS'), etc.
##
## Moreover, do we really need all these variables?  See how things
## evolve during the refurbishing of the build system in doc/.
DOC_SRCDIR = $(top_srcdir)/milena/doc
OUTPUTS_SRCDIR = $(DOC_SRCDIR)/outputs
SPLIT_OUTPUTS_SRCDIR = $(OUTPUTS_SRCDIR)/split
FIGURES_SRCDIR = $(DOC_SRCDIR)/figures
EXAMPLES_SRCDIR = $(DOC_SRCDIR)/examples
SPLIT_EXAMPLES_SRCDIR = $(EXAMPLES_SRCDIR)/split
IMG_SRCDIR = $(DOC_SRCDIR)/img

# FIXME: Adjust when $(DOC_SRCDIR) is renamed or removed.
#
# FIXME: Careful, `doc_dir' is close to `docdir', which is reserved by
# Automake.  Change this name?
doc_dir = $(DOC_SRCDIR)
Guillaume Lazzara's avatar
Guillaume Lazzara committed
45
46

DOXYGEN = doxygen
47

48
49
DOXYFILE = Doxyfile

50
51
52
# Initialiaze variables.
EXTRA_DIST =
dist_doc_DATA =
53

54
55
# FIXME: Simplify all of this.  ``Devel'' targets are really
# secondary.  And we probably don't need so much target aliases!
56

57
58
59
.PHONY: doc						\
	doc-user doc-devel				\
	doc-pdf doc-html doc-devel-pdf doc-devel-html	\
60
61
	ref-doc ref-doc-pdf				\
	ref-doc-devel ref-doc-devel-pdf
62

63
doc: doc-user doc-devel
64

65
66
doc-user: doc-pdf doc-html
doc-devel: doc-devel-pdf doc-devel-html
67

68
doc-pdf: tutorial-pdf white-paper-pdf ref-guide-pdf ref-doc-pdf
69

70
doc-html: tutorial-html white-paper-html ref-guide-html ref-doc
71

72
doc-devel-pdf: tutorial-pdf ref-guide-pdf white-paper-pdf ref-doc-devel-pdf
73

74
doc-devel-html: tutorial-html ref-guide-html white-paper-html \
75
		ref-doc-devel
76

77

78
79
80
81
82
83
84
85
86
87
88
## --------------------- ##
## LaTeX configuration.  ##
## --------------------- ##

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

# FIXME: Check this list.
TEXI2DVI_FLAGS +=							\
  -I $(DOC_SRCDIR) -I $(OUTPUTS_SRCDIR) -I $(SPLIT_OUTPUTS_SRCDIR)	\
  -I $(IMG_SRCDIR) -I $(SPLIT_EXAMPLES_SRCDIR)

Roland Levillain's avatar
Roland Levillain committed
89
90
# Additional files for LaTeX compilations.
DOC_PACKAGES = doxyfuns.sty milena.sty
91
92


93
94
95
96
## --------- ##
## Figures.  ##
## --------- ##

97
98
99
100
101
102
103
104
# Generated figures.
include $(srcdir)/figures.mk
# FIXME: $(FIGURES) is not added to EXTRA_DIST (though it is added to
# MAINTAINERCLEANFILES), because its contents is already in EXTRA_DIST
# thanks to PBM_FIGURES, PGM_FIGURES and PPM_FIGURES.  However, these
# variables may be removed someday (see FIXME below).
MAINTAINERCLEANFILES = $(FIGURES)

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
# ----- #
# PBM.  #
# ----- #

$(srcdir)/pbm-figures.mk: $(srcdir)/gen-make-variable
	rm -f $@.tmp
	$(srcdir)/gen-make-variable PBM_FIGURES				  \
	  `find $(srcdir)/figures/*.pbm | sed 's,^$(srcdir),\$$(srcdir),'` \
	  >$@.tmp
	mv -f $@.tmp $@
	chmod -w $@
include $(srcdir)/pbm-figures.mk
EXTRA_DIST += $(PBM_FIGURES)

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

# ----- #
# PGM.  #
# ----- #

$(srcdir)/pgm-figures.mk: $(srcdir)/gen-make-variable
	rm -f $@.tmp
	$(srcdir)/gen-make-variable PGM_FIGURES				  \
	  `find $(srcdir)/figures/*.pgm | sed 's,^$(srcdir),\$$(srcdir),'` \
	  >$@.tmp
	mv -f $@.tmp $@
	chmod -w $@
include $(srcdir)/pgm-figures.mk
EXTRA_DIST += $(PGM_FIGURES)

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

# ----- #
# PPM.  #
# ----- #

$(srcdir)/ppm-figures.mk: $(srcdir)/gen-make-variable
	rm -f $@.tmp
	$(srcdir)/gen-make-variable PPM_FIGURES				  \
	  `find $(srcdir)/figures/*.ppm | sed 's,^$(srcdir),\$$(srcdir),'` \
	  >$@.tmp
	mv -f $@.tmp $@
	chmod -w $@
include $(srcdir)/ppm-figures.mk
EXTRA_DIST += $(PPM_FIGURES)

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

# ----- #
# PNG.  #
# ----- #

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)
196
MAINTAINERCLEANFILES += $(PNG_FIGURES)
197
198


199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
## ---------- ##
## Examples.  ##
## ---------- ##

$(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

224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# 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 =					\
  examples/accu-wrong-instanciation.cc.raw	\
  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)

241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
## ---------------- ##
## Split examples.  ##
## ---------------- ##

$(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


262
263
264
265
## ----------------------- ##
## Doxygen documentation.  ##
## ----------------------- ##

266
267
268
# FIXME: Check these dependencies.
# 1. They might be redundant.
# 2. It'd be better to depend on actual files rather than timestamps
269
#    corresponding to a bunch of files.
270
refman_dependencies =				\
271
  $(SPLIT_EXAMPLES)				\
272
  $(SPLIT_OUTPUTS)				\
273
  $(PNG_FIGURES)				\
274
275
276
  $(srcdir)/tutorial/tutorial.hh		\
  $(srcdir)/ref_guide/ref_guide.hh

277
278
279
# ----------------------- #
# User reference manual.  #
# ----------------------- #
280

281
all-local: $(srcdir)/$(USER_REFMAN) $(srcdir)/$(USER_REFMAN_PDF)
282

283
284
285
286
287
# 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
288

289
DOXYFILE_USER = Doxyfile_user
290

Roland Levillain's avatar
Roland Levillain committed
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
# 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) $< >$@
309
MAINTAINERCLEANFILES += $(DOXYFILE_USER)
Roland Levillain's avatar
Roland Levillain committed
310

311
## FIXME: Rename USER_REFMAN_PDF to something else?
312
USER_REFMAN_PDF = user-refman.pdf
313
## FIXME: Likewise?
314
USER_REFMAN = user-refman
315

316
ref-doc-pdf: $(srcdir)/$(USER_REFMAN_PDF)
317
ref-doc: $(srcdir)/$(USER_REFMAN)
318
319
320
321

# FIXME: Use texi2dvi instead of Doxygen's generated Makefile?
# (The LaTeX to PDF rule could be factored using a suffix rule, as in
# LRDE's share/).
322
323
324
$(srcdir)/$(USER_REFMAN_PDF): $(srcdir)/$(USER_REFMAN)
	cd $(srcdir)/$(USER_REFMAN)/latex && $(MAKE) $(AM_MAKEFLAGS) pdf
	cp -f $(srcdir)/$(USER_REFMAN)/latex/refman.pdf $@
325

326
327
EXTRA_DIST += $(srcdir)/user-refman.stamp
MAINTAINERCLEANFILES += $(srcdir)/user-refman.stamp
328
329
330
331
332
## FIXME: Are dependencies (`$(refman_dependencies)') set on the right
## rule?  Does Doxygen make a copy of figures, or does it generate
## LaTeX inputs relying on the existence of such figures in the
## initial location?  Investigate.
$(srcdir)/user-refman.stamp: $(srcdir)/$(DOXYFILE).in $(refman_dependencies)
333
334
	@rm -f $@.tmp
	@touch $@.tmp
335
	-rm -rf $(USER_REFMAN).tmp
336
337
	$(MAKE) $(AM_MAKE_FLAGS) $(DOXYFILE_USER)
	$(DOXYGEN) $(DOXYFILE_USER)
338
339
## Doxygen may generate an incomplete output and exit with success!
## Check some files before deeming the output as acceptable.
340
	test -f $(USER_REFMAN).tmp/latex/refman.tex
341
342
	-rm -rf $(srcdir)/$(USER_REFMAN)
## FIXME: Moving directories between file systems is not portable.
343
	mv $(USER_REFMAN).tmp $(srcdir)/$(USER_REFMAN)
344
345
	@mv -f $@.tmp $@

346
$(srcdir)/$(USER_REFMAN): $(srcdir)/user-refman.stamp
347
348
349
350
351
352
## Recover from the removal of $@
	@if test -d $@; then :; else \
	  rm -f $<; \
	  $(MAKE) $(AM_MAKEFLAGS) $<; \
	fi

353
354
355
# ---------------------------- #
# Developer reference manual.  #
# ---------------------------- #
356

357
358
359
360
361
362
# 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
363

364
DOXYFILE_DEVEL = Doxyfile_devel
365

Roland Levillain's avatar
Roland Levillain committed
366
edit_devel = sed							      \
367
  -e 's,OUTPUT_DIRECTORY       = @builddir@/user-refman.tmp/,OUTPUT_DIRECTORY       = @builddir@/devel-refman.tmp/,' \
Roland Levillain's avatar
Roland Levillain committed
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
  -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
388
MAINTAINERCLEANFILES += $(DOXYFILE_DEVEL)
Roland Levillain's avatar
Roland Levillain committed
389

390
391
392
## FIXME: Rename DEVEL_REFMAN_PDF to something else?
DEVEL_REFMAN_PDF = devel-refman-pdf
## FIXME: Likewise?
393
DEVEL_REFMAN = devel-refman
394

395
ref-doc-devel-pdf: $(srcdir)/$(DEVEL_REFMAN_PDF)
396
ref-doc-devel: $(srcdir)/$(DEVEL_REFMAN)
397

398
399
400
401
# 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.
#
402
403
404
## FIXME: Use texi2dvi instead of Doxygen's generated Makefile?  (The
## LaTeX to PDF rule could be factored using a suffix rule, as in
## LRDE's share/).
405
406
407
$(srcdir)/$(DEVEL_REFMAN_PDF): $(srcdir)/$(DEVEL_REFMAN)
	cd $(srcdir)/$(DEVEL_REFMAN)/latex && $(MAKE) $(AM_MAKEFLAGS) pdf
	cp -f $(srcdir)/$(DEVEL_REFMAN)/latex/refman.pdf $@
408

409
410
EXTRA_DIST += $(srcdir)/devel-refman.stamp
MAINTAINERCLEANFILES += $(srcdir)/devel-refman.stamp
411
412
413
414
415
## FIXME: Are dependencies (`$(refman_dependencies)') set on the right
## rule?  Does Doxygen make a copy of figures, or does it generate
## LaTeX inputs relying on the existence of such figures in the
## initial location?  Investigate.
$(srcdir)/devel-refman.stamp: $(srcdir)/$(DOXYFILE).in $(refman_dependencies)
416
417
	@rm -f $@.tmp
	@touch $@.tmp
418
	-rm -rf $(DEVEL_REFMAN).tmp
419
420
	$(MAKE) $(AM_MAKE_FLAGS) $(DOXYFILE_DEVEL)
	$(DOXYGEN) $(DOXYFILE_DEVEL)
421
422
## Doxygen may generate an incomplete output and exit with success!
## Check some files before deeming the output as acceptable.
423
	test -f $(DEVEL_REFMAN).tmp/latex/refman.tex
424
425
	-rm -rf $(srcdir)/$(DEVEL_REFMAN)
## FIXME: Moving directories between file systems is not portable.
426
	mv $(DEVEL_REFMAN).tmp $(srcdir)/$(DEVEL_REFMAN)
427
428
	@mv -f $@.tmp $@

429
$(srcdir)/$(DEVEL_REFMAN): $(srcdir)/devel-refman.stamp
430
431
432
433
434
435
436
437
438
## Recover from the removal of $@
	@if test -d $@; then :; else \
	  rm -f $<; \
	  $(MAKE) $(AM_MAKEFLAGS) $<; \
	fi


# Clean Doxygen products.
maintainer-clean-local:
439
440
	-rm -rf $(USER_REFMAN).tmp $(srcdir)/$(USER_REFMAN)
	-rm -rf $(DEVEL_REFMAN).tmp $(srcdir)/$(DEVEL_REFMAN)
441

Guillaume Lazzara's avatar
Guillaume Lazzara committed
442

443
444
445
446
## ------------------------- ##
## Technical Documentation.  ##
## ------------------------- ##

447
448
449
450
451
452
453
454
455
.PHONY: technical technical-html technical-pdf

technical: technical-html technical-pdf

technical_dir = $(doc_dir)/technical

# FIXME: Check these dependencies.  And it'd be better to depend on
# actual files rather than timestamps corresponding to a bunch of
# files.
Roland Levillain's avatar
Roland Levillain committed
456
technical_dependencies = $(PNG_FIGURES) $(DOC_PACKAGES)
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481

# FIXME: As in milena/doc/Makefile.am, we should probably strip
# $(srcdir) prefixes from target variables, e.g. instead of:
#
#   FOO = $(srcdir)/foo.pdf
#   $(FOO): foo.tex bar.tex
#   dist_doc_DATA = $(FOO)
#
# we should use:
#
#   FOO = foo.pdf
#   $(srcdir)/$(FOO): foo.tex bar.tex
#   dist_doc_DATA = $(FOO)
#
# since it minimizes installation issues (see milena/doc/Makefile.am
# and Vaucanson's doc/Makefile.am).

# FIXME: Distributed products should be generated in the source dir.
# That's actually the case, *but* the current solution is not clean
# and might break sometimes.  The clean approach is to create a
# temporary directory, try to generate the documentation there, and
# move its contents to the source dir in case of success.  If the
# product is a directory, also refresh a timestamp (in the source
# dir).

482
483
484
485
## 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.

486
# Final product.
487
TECHNICAL_HTML = $(technical_dir)/technical.html
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
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 $@
503
	@if test -f $@; then :; else \
504
505
506
	  rm -f $<; \
	  $(MAKE) $(AM_MAKEFLAGS) $<; \
	fi
507

508
509
dist_doc_DATA += $(TECHNICAL_HTML_OUTPUTS)
MAINTAINERCLEANFILES += $(TECHNICAL_HTML_OUTPUTS)
510

511
512
513
514
515
516
517
# 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
518
519
# FIXME: Careful, technical-html depends on $(TECHNICAL_HH), not
# $(TECHNICAL_HTML).  Anyway, this shortcut should vanish soon.
520
technical-html: $(TECHNICAL_HH)
521
$(TECHNICAL_HH): $(TECHNICAL_HTML) $(doc_dir)/tools/todoxygen.sh
522
523
524
525
526
527
528
# 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
	$(doc_dir)/tools/todoxygen.sh $< $@.tmp $(doc_dir)
	mv -f $@.tmp $@
529
530
531
532
533


# Final product.
TECHNICAL_PDF = $(technical_dir)/technical.pdf
technical-pdf: $(TECHNICAL_PDF)
534
535
# Extra dependencies.
$(TECHNICAL_PDF): $(technical_dependencies)
536
537

dist_doc_DATA += $(TECHNICAL_PDF)
538
MAINTAINERCLEANFILES += $(TECHNICAL_PDF)
539
540
541
542
543

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

544
MAINTAINERCLEANFILES += $(TECHNICAL_HH)
545

546
547
548
549
## ---------- ##
## Tutorial.  ##
## ---------- ##

550
551
552
553
554
555
556
557
558
559
560
.PHONY: tutorial tutorial-html tutorial-pdf

tutorial: tutorial-html tutorial-pdf

tutorial_dir = $(doc_dir)/tutorial

# FIXME: Check these dependencies.
# 1. They might be redundant.
# 2. It'd be better to depend on actual files rather than timestamps
#    corresponding to a bunch of files.
tutorial_dependencies =				\
561
  $(SPLIT_EXAMPLES)				\
562
  $(SPLIT_OUTPUTS)				\
Roland Levillain's avatar
Roland Levillain committed
563
564
  $(PNG_FIGURES)				\
  $(DOC_PACKAGES)
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589

# FIXME: As in milena/doc/Makefile.am, we should probably strip
# $(srcdir) prefixes from target variables, e.g. instead of:
#
#   FOO = $(srcdir)/foo.pdf
#   $(FOO): foo.tex bar.tex
#   dist_doc_DATA = $(FOO)
#
# we should use:
#
#   FOO = foo.pdf
#   $(srcdir)/$(FOO): foo.tex bar.tex
#   dist_doc_DATA = $(FOO)
#
# since it minimizes installation issues (see milena/doc/Makefile.am
# and Vaucanson's doc/Makefile.am).

# FIXME: Distributed products should be generated in the source dir.
# That's actually the case, *but* the current solution is not clean
# and might break sometimes.  The clean approach is to create a
# temporary directory, try to generate the documentation there, and
# move its contents to the source dir in case of success.  If the
# product is a directory, also refresh a timestamp (in the source
# dir).

590
# Final product.
591
TUTORIAL_HTML = $(tutorial_dir)/tutorial.html
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
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 $@
607
	@if test -f $@; then :; else \
608
609
610
	  rm -f $<; \
	  $(MAKE) $(AM_MAKEFLAGS) $<; \
	fi
611

612
613
dist_doc_DATA += $(TUTORIAL_HTML_OUTPUTS)
MAINTAINERCLEANFILES += $(TUTORIAL_HTML_OUTPUTS)
614

615
616
617
618
619
620
621
# 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
622
623
# FIXME: Careful, tutorial-html depends on $(TUTORIAL_HH), not
# $(TUTORIAL_HTML).  Anyway, this shortcut should vanish soon.
624
tutorial-html: $(TUTORIAL_HH)
625
$(TUTORIAL_HH): $(TUTORIAL_HTML) $(doc_dir)/tools/todoxygen.sh
626
627
628
629
630
631
632
# 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
	$(doc_dir)/tools/todoxygen.sh $< $@.tmp $(doc_dir)
	mv -f $@.tmp $@
633

634

635
636
637
# Final product.
TUTORIAL_PDF = $(tutorial_dir)/tutorial.pdf
tutorial-pdf: $(TUTORIAL_PDF)
638
639
# Extra dependencies.
$(TUTORIAL_PDF): $(tutorial_dependencies)
640
641

dist_doc_DATA += $(TUTORIAL_PDF)
642
MAINTAINERCLEANFILES += $(TUTORIAL_PDF)
643
644
645
646
647

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

648
MAINTAINERCLEANFILES += $(TUTORIAL_HH)
649

650

651
652
653
654
## ------------- ##
## White Paper.  ##
## ------------- ##

655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
.PHONY: white-paper white-paper-html white-paper-pdf

white_paper_dir = $(doc_dir)/white_paper

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 $< $@

white-paper: white-paper-pdf white-paper-html

# FIXME: As in milena/doc/Makefile.am, we should probably strip
# $(srcdir) prefixes from target variables, e.g. instead of:
#
#   FOO = $(srcdir)/foo.pdf
#   $(FOO): foo.tex bar.tex
#   dist_doc_DATA = $(FOO)
#
# we should use:
#
#   FOO = foo.pdf
#   $(srcdir)/$(FOO): foo.tex bar.tex
#   dist_doc_DATA = $(FOO)
#
# since it minimizes installation issues (see milena/doc/Makefile.am
# and Vaucanson's doc/Makefile.am).

# FIXME: Distributed products should be generated in the source dir.
# That's actually the case, *but* the current solution is not clean
# and might break sometimes.  The clean approach is to create a
# temporary directory, try to generate the documentation there, and
# move its contents to the source dir in case of success.  If the
# product is a directory, also refresh a timestamp (in the source
# dir).

696
697
# Final product.
WHITE_PAPER_HTML = $(white_paper_dir)/white_paper.html
698
white-paper-html: $(WHITE_PAPER_HTML)
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
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 $@
720
	@if test -f $@; then :; else \
721
722
723
	  rm -f $<; \
	  $(MAKE) $(AM_MAKEFLAGS) $<; \
	fi
724

725
726
dist_doc_DATA += $(WHITE_PAPER_HTML_OUTPUTS)
MAINTAINERCLEANFILES += $(WHITE_PAPER_HTML_OUTPUTS)
727
728
729

WHITE_PAPER_PDF = $(white_paper_dir)/white_paper.pdf
white-paper-pdf: $(WHITE_PAPER_PDF)
730
731
# Extra dependencies.
$(WHITE_PAPER_PDF): $(PNGS)
732

733
734
dist_doc_DATA += $(WHITE_PAPER_PDF)
MAINTAINERCLEANFILES += $(WHITE_PAPER_PDF)
735
736
737
738
739
740

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

741
MAINTAINERCLEANFILES += $(EPSS)
742

743

744
745
746
747
## ----------------- ##
## Reference Guide.  ##
## ----------------- ##

748
749
750
751
752
753
754
755
756
757
758
.PHONY: ref-guide ref-guide-html ref-guide-pdf

ref-guide: ref-guide-html ref-guide-pdf

ref_guide_dir = $(doc_dir)/ref_guide

# FIXME: Check these dependencies.
# 1. They might be redundant.
# 2. It'd be better to depend on actual files rather than timestamps
#    corresponding to a bunch of files.
ref_guide_dependencies =			\
759
  $(SPLIT_EXAMPLES)				\
760
  $(SPLIT_OUTPUTS)				\
Roland Levillain's avatar
Roland Levillain committed
761
762
  $(PNG_FIGURES)				\
  $(DOC_PACKAGES)
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787

# FIXME: As in milena/doc/Makefile.am, we should probably strip
# $(srcdir) prefixes from target variables, e.g. instead of:
#
#   FOO = $(srcdir)/foo.pdf
#   $(FOO): foo.tex bar.tex
#   dist_doc_DATA = $(FOO)
#
# we should use:
#
#   FOO = foo.pdf
#   $(srcdir)/$(FOO): foo.tex bar.tex
#   dist_doc_DATA = $(FOO)
#
# since it minimizes installation issues (see milena/doc/Makefile.am
# and Vaucanson's doc/Makefile.am).

# FIXME: Distributed products should be generated in the source dir.
# That's actually the case, *but* the current solution is not clean
# and might break sometimes.  The clean approach is to create a
# temporary directory, try to generate the documentation there, and
# move its contents to the source dir in case of success.  If the
# product is a directory, also refresh a timestamp (in the source
# dir).

788
# Final product.
789
REF_GUIDE_HTML = $(ref_guide_dir)/ref_guide.html
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
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 $@
808
	@if test -f $@; then :; else \
809
810
811
	  rm -f $<; \
	  $(MAKE) $(AM_MAKEFLAGS) $<; \
	fi
812

813
814
dist_doc_DATA += $(REF_GUIDE_HTML_OUTPUTS)
MAINTAINERCLEANFILES += $(REF_GUIDE_HTML_OUTPUTS)
815

816
817
818
819
820
821
822
# 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
823
824
# FIXME: Careful, ref-guide-html depends on $(REF_GUIDE_HH), not
# $(REF_GUIDE_HTML).  Anyway, this shortcut should vanish soon.
825
ref-guide-html: $(REF_GUIDE_HH)
826
$(REF_GUIDE_HH): $(REF_GUIDE_HTML) $(doc_dir)/tools/todoxygen.sh
827
828
829
830
831
832
833
# 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
	$(doc_dir)/tools/todoxygen.sh $< $@.tmp $(doc_dir)
	mv -f $@.tmp $@
834
835
836
837
838


# Final product.
REF_GUIDE_PDF = $(ref_guide_dir)/ref_guide.pdf
ref-guide-pdf: $(REF_GUIDE_PDF)
839
840
# Extra dependencies.
$(REF_GUIDE_PDF): $(ref_guide_dependencies)
841
842

dist_doc_DATA += $(REF_GUIDE_PDF)
843
MAINTAINERCLEANFILES += $(REF_GUIDE_PDF)
844
845
846
847
848

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

849
MAINTAINERCLEANFILES += $(REF_GUIDE_HH)
Guillaume Lazzara's avatar
Guillaume Lazzara committed
850
851


852
## ---------- ##
853
## Programs.  ##
854
855
## ---------- ##

856
include $(srcdir)/programs-examples.mk
857
EXTRA_PROGRAMS = $(PROGRAMS_examples)
858
CLEANFILES = $(PROGRAMS_examples)
859

860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
## --------- ##
## 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
893

Roland Levillain's avatar
Roland Levillain committed
894
## FIXME: These outputs are also required by the (LaTeX)
895
896
897
898
899
900
901
902
903
904
905
## documentation.  However, they have no corresponding program in
## examples/, hence they cannot be regenerated.  Are they hand-made
## outputs?  Or maybe outputs of which program has been removed since?
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
906
EXTRA_DIST += $(MORE_OUTPUTS)
907

908
909
910
911
912
913
914
915
$(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
916
917
	mv -f $@.tmp $@
	chmod -w $@
918
include $(srcdir)/examples-outputs.mk
919

920
921
.PHONY: regen-examples-outputs-mk
regen-examples-outputs-mk:
922
923
924
925
926
927
928
929
	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
930

931
932
933
## --------------- ##
## Split outputs.  ##
## --------------- ##
934

935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
$(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
950

951

952
953
954
955
## -------------- ##
## Regeneration.  ##
## -------------- ##

956
# Regen Make helpers.
957
EXTRA_DIST += generate_dist_files.sh
958
959
include $(top_srcdir)/build-aux/regen-recursive.mk
regen-am:
960
961
962
	$(MAKE) $(AM_MAKEFLAGS) regen-pbm-figures-mk
	$(MAKE) $(AM_MAKEFLAGS) regen-pgm-figures-mk
	$(MAKE) $(AM_MAKEFLAGS) regen-ppm-figures-mk
963
	$(MAKE) $(AM_MAKEFLAGS) regen-examples-mk
964
	$(MAKE) $(AM_MAKEFLAGS) regen-split-examples-mk
965
	$(MAKE) $(AM_MAKEFLAGS) regen-outputs-mk
966
	$(MAKE) $(AM_MAKEFLAGS) regen-examples-outputs-mk
967
	$(MAKE) $(AM_MAKEFLAGS) regen-split-outputs-mk
Guillaume Lazzara's avatar
Guillaume Lazzara committed
968

969

970
971
972
973
974
## -------------- ##
## Installation.  ##
## -------------- ##

# PDF.
975
dist_doc_DATA += $(USER_REFMAN_PDF)
976

977
# HTML.
978
# Installing a directory located in the source dir is not supported by
979
# Automake by default, so we cannot add `$(USER_REFMAN)/html' to
980
981
# `dist_doc_DATA'.  The following two rules are are workaround from
# the Vaucanson project.
982
EXTRA_DIST += $(USER_REFMAN)/html
983
984
985
986
987

# 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:
988
	rm -rf $(DESTDIR)$(htmldir)/$(USER_REFMAN)/html
989
	$(mkdir_p) $(DESTDIR)$(htmldir)
990
	cp -r $(srcdir)/$(USER_REFMAN)/html $(DESTDIR)$(htmldir)/user-refman
991
992
993
994
995
996
997
## 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:
998
999
	chmod -R 700 $(DESTDIR)$(htmldir)/user-refman
	rm -rf $(DESTDIR)$(htmldir)/user-refman
1000