aboutsummaryrefslogtreecommitdiff
path: root/doc/makefile
blob: 32ad89a5b85e6468ec0301d7d61160ef9d361def (plain)
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
# file      : doc/makefile
# author    : Boris Kolpackov <boris@codesynthesis.com>
# copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
# license   : GNU GPL v3; see accompanying LICENSE file

include $(dir $(lastword $(MAKEFILE_LIST)))../build/bootstrap.make

default := $(out_base)/
dist    := $(out_base)/.dist
clean   := $(out_base)/.clean

# Import.
#
$(call import,\
  $(scf_root)/import/cli/stub.make,\
  cli: cli,cli-rules: cli_rules)

# Build.
#
$(default):                \
$(out_base)/odb.1          \
$(out_base)/odb.xhtml      \
$(out_base)/odb-manual.ps  \
$(out_base)/odb-manual.pdf

# Man/html pages.
#
$(out_base)/odb.xhtml $(out_base)/odb.1: cli := $(cli)

$(out_base)/odb.xhtml: $(src_root)/odb/options.cli    \
                       $(src_base)/odb-prologue.xhtml \
                       $(src_base)/odb-epilogue.xhtml | $(out_base)/.
	$(call message,cli-html $<,$(cli) --generate-html --stdout \
--html-prologue $(src_base)/odb-prologue.xhtml \
--html-epilogue $(src_base)/odb-epilogue.xhtml $< >$@)

$(out_base)/odb.1: $(src_root)/odb/options.cli \
                   $(src_base)/odb-prologue.1  \
                   $(src_base)/odb-epilogue.1 | $(out_base)/.
	$(call message,cli-man $<,$(cli) --generate-man --stdout \
--man-prologue $(src_base)/odb-prologue.1 \
--man-epilogue $(src_base)/odb-epilogue.1 $< >$@)

# Manual.
#
$(out_base)/odb-manual.ps: $(src_base)/manual.xhtml   \
                           $(src_base)/manual.html2ps \
                           $(src_base)/odb-arch.png   \
                           $(src_base)/odb-flow.png | $(out_base)/.
	$(call message,html2ps $<,html2ps -f $(src_base)/manual.html2ps -o $@ $<)

$(out_base)/odb-manual.pdf: $(out_base)/odb-manual.ps
	$(call message,ps2pdf $<,ps2pdf14 $< $@)

# Dist.
#
$(dist): data_dist := default.css odb-arch.png odb-flow.png
$(dist): export docs = $(data_dist) odb.xhtml odb-manual.ps odb-manual.pdf
$(dist): export mans := odb.1
$(dist):                   \
$(out_base)/odb.1          \
$(out_base)/odb.xhtml      \
$(out_base)/odb-manual.ps  \
$(out_base)/odb-manual.pdf
	$(call dist-data,$^)
	$(call dist-data,$(data_dist))
	$(call meta-automake)

# Clean.
#
$(clean):
	$(call message,rm $$1,rm -f $$1,$(out_base)/odb.1)
	$(call message,rm $$1,rm -f $$1,$(out_base)/odb.xhtml)
	$(call message,rm $$1,rm -f $$1,$(out_base)/odb-manual.ps)
	$(call message,rm $$1,rm -f $$1,$(out_base)/odb-manual.pdf)

# Generated .gitignore.
#
ifeq ($(out_base),$(src_base))
$(out_base)/odb.xhtml $(out_base)/odb.1: | $(out_base)/.gitignore

$(out_base)/.gitignore: files := odb.1 odb.xhtml odb-manual.ps odb-manual.pdf
$(clean): $(out_base)/.gitignore.clean

$(call include,$(bld_root)/git/gitignore.make)
endif

$(call include,$(bld_root)/dist.make)
$(call include,$(bld_root)/meta/automake.make)