aboutsummaryrefslogtreecommitdiff
path: root/doc/makefile
blob: fedb8f877ad0717d2135c32d1686f35a9679decc (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
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
# file      : doc/makefile
# copyright : Copyright (c) 2005-2017 Code Synthesis Tools CC
# license   : GNU GPL v2 + exceptions; see accompanying LICENSE file

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

default  := $(out_base)/
install  := $(out_base)/.install
dist     := $(out_base)/.dist
dist-win := $(out_base)/.dist-win
clean    := $(out_base)/.clean

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

# Build.
#
$(default):           \
$(out_base)/cxx/      \
$(out_base)/xsd.xhtml \
$(out_base)/xsd.1

# Man/html pages.
#
$(out_base)/xsd.xhtml $(out_base)/xsd.1: cli := $(cli)
$(out_base)/xsd.xhtml $(out_base)/xsd.1: cli_options += -I $(src_root)/xsd

$(out_base)/xsd.xhtml $(out_base)/xsd.1: \
$(src_root)/xsd/options.cli              \
$(src_root)/xsd/cxx/options.cli          \
$(src_root)/xsd/cxx/tree/options.cli     \
$(src_root)/xsd/cxx/parser/options.cli

# Assemble the options from different files in a specific order.
#

# XHTML
#
$(out_base)/xsd.xhtml: $(src_base)/xsd-prologue.xhtml      \
                       $(src_base)/xsd-epilogue.xhtml      \
                       $(src_base)/xsd-tree-header.xhtml   \
                       $(src_base)/xsd-parser-header.xhtml \
                       | $(out_base)/.
# Common options.
#
	$(call message,cli-html $$1,$(cli) $(cli_options) --generate-html \
--stdout --suppress-undocumented --exclude-base --class CXX::options \
--class options --html-prologue-file $(src_base)/xsd-prologue.xhtml \
$$1 >$@, $(src_root)/xsd/cxx/options.cli)

# C++/Tree options.
#
	$(call message,cli-html $$1,$(cli) $(cli_options) --generate-html \
--stdout --suppress-undocumented --exclude-base \
--html-prologue-file $(src_base)/xsd-tree-header.xhtml \
$$1 >>$@, $(src_root)/xsd/cxx/tree/options.cli)

# C++/Parser options.
#
	$(call message,cli-html $$1,$(cli) $(cli_options) --generate-html \
--stdout --suppress-undocumented --exclude-base \
--html-prologue-file $(src_base)/xsd-parser-header.xhtml \
--html-epilogue-file $(src_base)/xsd-epilogue.xhtml \
$$1 >>$@, $(src_root)/xsd/cxx/parser/options.cli)

# MAN
#
$(out_base)/xsd.1: $(src_base)/xsd-prologue.1      \
                   $(src_base)/xsd-epilogue.1      \
                   $(src_base)/xsd-tree-header.1   \
                   $(src_base)/xsd-parser-header.1 \
                   | $(out_base)/.
# Common options.
#
	$(call message,cli-man $$1,$(cli) $(cli_options) --generate-man \
--stdout --suppress-undocumented --exclude-base --class CXX::options \
--class options --man-prologue-file $(src_base)/xsd-prologue.1 \
$$1 >$@, $(src_root)/xsd/cxx/options.cli)

# C++/Tree options.
#
	$(call message,cli-man $$1,$(cli) $(cli_options) --generate-man \
--stdout --suppress-undocumented --exclude-base \
--man-prologue-file $(src_base)/xsd-tree-header.1 \
$$1 >>$@, $(src_root)/xsd/cxx/tree/options.cli)

# C++/Parser options.
#
	$(call message,cli-man $$1,$(cli) $(cli_options) --generate-man \
--stdout --suppress-undocumented --exclude-base \
--man-prologue-file $(src_base)/xsd-parser-header.1 \
--man-epilogue-file $(src_base)/xsd-epilogue.1 \
$$1 >>$@, $(src_root)/xsd/cxx/parser/options.cli)


# Install.
#
$(install): $(out_base)/cxx/.install \
            $(out_base)/xsd.xhtml    \
            $(out_base)/xsd.1	
	$(call install-data,$(src_base)/default.css,$(install_doc_dir)/xsd/default.css)
	$(call install-data,$(out_base)/xsd.xhtml,$(install_doc_dir)/xsd/xsd.xhtml)
	$(call install-data,$(src_base)/custom-literals.xsd,$(install_doc_dir)/xsd/custom-literals.xsd)
	$(call install-data,$(out_base)/xsd.1,$(install_man_dir)/man1/xsd.1)

# Dist.
#
dist-common := $(out_base)/.dist-common

$(dist-common): $(out_base)/xsd.xhtml \
                $(out_base)/xsd.1
	$(call install-data,$(src_base)/default.css,$(dist_prefix)/doc/default.css)
	$(call install-data,$(out_base)/xsd.xhtml,$(dist_prefix)/doc/xsd.xhtml)
	$(call install-data,$(out_base)/xsd.1,$(dist_prefix)/doc/xsd.1)
	$(call install-data,$(src_base)/custom-literals.xsd,$(dist_prefix)/doc/custom-literals.xsd)

$(dist): $(dist-common) $(out_base)/cxx/.dist
$(dist-win): $(dist-common) $(out_base)/cxx/.dist-win

# Clean.
#
$(clean): $(out_base)/cxx/.clean
ifneq ($(xsd_clean_gen),n)
	$(call message,rm $$1,rm -f $$1,$(out_base)/xsd.1)
	$(call message,rm $$1,rm -f $$1,$(out_base)/xsd.xhtml)
endif

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

$(out_base)/.gitignore: files := xsd.1 xsd.xhtml
$(clean): $(out_base)/.gitignore.clean

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

$(call include,$(bld_root)/install.make)
$(call import,$(src_base)/cxx/makefile)