File: OMakefile

package info (click to toggle)
omake 0.10.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 14,076 kB
  • sloc: ml: 49,729; ansic: 5,163; makefile: 688; sh: 110
file content (259 lines) | stat: -rw-r--r-- 7,119 bytes parent folder | download | duplicates (2)
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
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
196
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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
#
# Manual Page
#

install:
    mkdir -p $(INSTALL_MANDIR)/man1
    cp -f -m 444 omake.1 $(INSTALL_MANDIR)/man1
    ln-or-cp $(INSTALL_MANDIR)/man1/omake.1 $(INSTALL_MANDIR)/man1/osh.1


#
# Documentation files
#

BUILTIN = $(dir $(ROOT)/src/builtin)

MAN_BASE_FILES[] =
    $(BUILTIN)/omake_builtin_base.ml
    $(BUILTIN)/omake_builtin_arith.ml
    $(BUILTIN)/omake_builtin_fun.ml
    $(BUILTIN)/omake_builtin_object.ml
    $(BUILTIN)/omake_builtin_file.ml
    $(BUILTIN)/omake_builtin_test.ml

MAN_SYSTEM_FILES[] =
    $(BUILTIN)/omake_builtin_io.ml
    $(BUILTIN)/omake_builtin_io_fun.ml
    $(BUILTIN)/omake_builtin_sys.ml
    $(BUILTIN)/omake_builtin_shell.ml

MAN_PERVASIVES_FILES[] =
    $(LIB)/Pervasives.om
    $(BUILTIN)/omake_builtin_rule.ml
    $(BUILTIN)/omake_builtin_target.ml

MAN_ROOT_FILES[] =
    $(LIB)/build/Common.om
    $(LIB)/build/C.om
    $(LIB)/build/OCaml.om
    $(LIB)/build/LaTeX.om

MAN_CONFIGURE_FILES[] =
    $(LIB)/configure/Configure.om
    $(LIB)/configure/ncurses.om
    $(LIB)/configure/readline.om
    $(LIB)/configure/snprintf.om

MAN_BASE_FILES       = $(file $(MAN_BASE_FILES))
MAN_SYSTEM_FILES     = $(file $(MAN_SYSTEM_FILES))
MAN_PERVASIVES_FILES = $(file $(MAN_PERVASIVES_FILES))
MAN_ROOT_FILES       = $(file $(MAN_ROOT_FILES))
MAN_CONFIGURE_FILES  = $(file $(MAN_CONFIGURE_FILES))
MAN_ALL_FILES[] =
    $(MAN_BASE_FILES)
    $(MAN_SYSTEM_FILES)
    $(MAN_PERVASIVES_FILES)
    $(MAN_ROOT_FILES)
    $(MAN_CONFIGURE_FILES)

########################################################################
# Documentation
#
Shell. +=
   #
   # Extract the text between the following delimiters.
   #
   # \begin{doc}
   # ...
   # \end{doc}
   #
   extract-doc-text(argv) =
      print = false

      awk(b, $(argv))
      case $'\\end\{doc\}'
         print = false
         export
      case $'\\begin\{doc\}'
         print = true
         export
      default
         if $(print)
            println($0)

   remove-leading-comment-text(argv) =
      fsubst()
      case $'^[ \t]*[*#] ?'
         value

   extract-docs(argv) =
      extract-doc-text $(argv) | remove-leading-comment-text

#
# Extract the documentation from the src files.
#
ExtractManDocument(dst, files) =
    tex/$(dst).tex: $(files)
        extract-docs $(files) > $@

ExtractManDocument(omake-base,       $(MAN_BASE_FILES))
ExtractManDocument(omake-system,     $(MAN_SYSTEM_FILES))
ExtractManDocument(omake-pervasives, $(MAN_PERVASIVES_FILES))
ExtractManDocument(omake-root,       $(MAN_ROOT_FILES))
ExtractManDocument(omake-autoconf,   $(MAN_CONFIGURE_FILES))

#
# All the TeX files - both generated and the source ones.
#
TEX_FILES[] =
    src/omake-doc
    src/omake-index
    src/omake-examples
    src/omake-detail
    src/omake-build-examples
    src/omake-detail
    src/omake-language-naming
    src/omake-language-examples
    src/omake-options
    src/omake-language
    src/omake-detail
    src/omake-rules
    tex/omake-base
    tex/omake-system
    tex/omake-pervasives
    tex/omake-root
    tex/omake-autoconf
    src/osh
    src/omake-grammar

TEX_FILES = $(file $(addsuffix .tex, $(TEX_FILES)))

#
# HTML files that will be generated out of the ocaml-doc one
#
HTML_FILES[] =
    omake-doc.css
    omake-contents.html
    omake.html
    omake-quickstart.html
    omake-build-examples.html
    omake-language.html
    omake-detail.html
    omake-language-naming.html
    omake-language-examples.html
    omake-rules.html
    omake-base.html
    omake-system.html
    omake-shell.html
    omake-pervasives.html
    omake-build.html
    osh.html
    omake-options.html
    omake-grammar.html
    omake-all-index.html
    omake-var-index.html
    omake-fun-index.html
    omake-obj-index.html
    omake-target-index.html
    omake-option-index.html
    omake-references.html
    omake-toc.html
    omake-autoconf.html

HTML_FILES = $(file $(addprefix html/, $(HTML_FILES)))

#
# Generated info files.
#
# XXX: HACK: we do not know how many pieces we'd have. For now we hardcode the number.
#
NUM_INFOS = 11
INFO_BASE = $(file info/omake-doc.info)
INFO_FILES[] = $(INFO_BASE)
section
    i = 1
    while $(le $i, $(NUM_INFOS))
        INFO_FILES[] += $(file $(INFO_BASE)-$(i))
        i = $(add $i, 1)
    export INFO_FILES

public.HEVEA = hevea
public.HACHA = hacha
.STATIC:
    HEVEA_DIR =
    HEVEA_VERSION =
    HAVE_HEVEA_PROG = $(and $(CheckProg $(HEVEA)), $(CheckProg $(HACHA)))
    if $(HAVE_HEVEA_PROG)
        ConfMsgChecking(for $(HEVEA) configs and version)
        HEVEA_VERSION = $(shell $(HEVEA) -version)
        HEVEA_DIR = $(dir $(last $(HEVEA_VERSION)))
        HEVEA_VERSION = $(nth 1, $(HEVEA_VERSION))
        ConfMsgResult($(HEVEA_VERSION) in $(HEVEA_DIR))
        export HEVEA_DIR HEVEA_VERSION
    HEVEA_OK = $(and $(HAVE_HEVEA_PROG) $(test -d $(HEVEA_DIR)) $(test -f $(HEVEA_DIR)/hevea.sty))
    if $(not $(HEVEA_OK))
        ConfMsgWarn($'Hevea not found or Hevea installation is incomplete;')
        ConfMsgWarn($'will neither be able to build plain text, Info,')
        ConfMsgWarn($'nor HTML version of OMake documentation')

HEVEA_OPTIONS = -fix -I $(dir src) -I $(dir tex) -O -exec xxdate.exe
HACHA_OPTIONS = -tocter -nolinks

HEVEA_DEPS[] =
    $(glob src/*.hva)

if $(HEVEA_OK)
    .SUBDIRS: html
        omake-doc.html: $(TEX_FILES) $(HEVEA_DEPS) :value: $(HEVEA_VERSION)
            $(HEVEA) $(HEVEA_OPTIONS) omake-doc

        index.html: ../src/index.html
            cp ../src/index.html .

        $(HTML_FILES): omake-doc.html index.html
            $(HACHA) $(HACHA_OPTIONS) -o omake-toc.html $<

    if $(file-exists txt)
        .SUBDIRS: txt
            omake-doc.txt: $(TEX_FILES) $(HEVEA_DEPS) :value: $(HEVEA_VERSION)
               $(HEVEA) $(HEVEA_OPTIONS) -text omake-doc

    if $(file-exists info)
        .SUBDIRS: info
            $(INFO_FILES): $(TEX_FILES) $(HEVEA_DEPS) :value: $(HEVEA_VERSION)
                rm -f omake-doc.info*
                $(HEVEA) $(HEVEA_OPTIONS) -info omake-doc
                if $(test -e $(INFO_BASE)-$(add $(NUM_INFOS), 1))
                    eprintln($'Wrong number of info files: too many!')
                    eprintln($"Increase the NUM_INFOS (=$(NUM_INFOS)) variable in doc/OMakefile")
                    exit 1
                if $(not $(test -e $(INFO_BASE)-$(NUM_INFOS)))
                    eprintln($'Wrong number of info files: too few!')
                    eprintln($"Decrease the NUM_INFOS (=$(NUM_INFOS)) variable in doc/OMakefile")
                    exit 1

if $(file-exists ps)
   .SUBDIRS: ps
       TEXINPUTS[] += $(dir ../src ../tex $(HEVEA_DIR))

       omake-doc.tex: ../src/omake-doc.tex
           ln-or-cp $< $@

       TEXDEPS[] += $(TEX_FILES)

       LaTeXDocument(omake-doc, omake-doc)

dvi: ps/omake-doc.dvi
html: html/omake-doc.html $(HTML_FILES)
info: $(INFO_FILES)
pdf: ps/omake-doc.pdf
ps: ps/omake-doc.ps
txt: txt/omake-doc.txt

distclean:
    rm -f {txt,html,info}/*.{hind,h{t,o,f,v,opt}ind,htoc,haux} *.omc
    rm -f ps/*.{aux,fls,log,out,{t,o,v,f,opt}ids,ind,toc,ilg,{,v}idx,opts} ps/omake-doc.tex tex/*.tex

clean:
    rm -f html/* info/* ps/* tex/* txt/*