source: branches/lib/HELP_SOURCE/Makefile

Last change on this file was 19575, checked in by westram, 3 weeks ago
  • reintegrates 'help' into 'trunk'
    • preformatted text gets checked for width now (to enforce it fits into the arb help window).
    • fixed help following these checks, using the following steps:
      • ignore problems in foreign documentation.
      • increase default help window width.
      • introduce control comments to
        • accept oversized preformatted sections.
        • enforce preformatted style for whole sections.
        • simply define single-line preformatted sections
          Used intensive for definition of internal script languages.
    • fixed several non-related problems found in documentation.
    • minor layout changes for HTML version of arb help (more compacted; highlight anchored/all sections).
    • refactor system interface (GUI version) and use it from help module.
  • adds: log:branches/help@19532:19574
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.7 KB
Line 
1
2.SUFFIXES: .o .c .cxx .source .hlp .xml .dtd .html .depend .ps.gz .pdf.gz
3.PHONY: prepare all dirs generated xml dump ps pdf nonhlp_formats
4.PHONY: delzerohtml interdepends google_logo html help clean tools depends depend.init
5
6# --------------------------------------------------------------------------------
7
8TEST_ONE:=0# default is 0; if 1 -> only one .hlp file is processed. see below .@TEST_ONE
9ONLY_DO_UNITTEST:=0# default is 0; if 1 -> only unittest.hlp is processed (to make unit-test auto-update work) #@@@ set to 0 before checkin
10
11# --------------------------------------------------------------------------------
12# directories of source/destination files:
13
14HLP_SOURCE=source
15HLP_GENERATED=genhelp
16XML_LOCATION=Xml
17HTML_LOCATION=../lib/help_html
18HLP_DEST=../lib/help
19HELP_INDEX_NAME = help_index
20DOTMAP=./help_map.dot
21GIFMAP=./help_map.gif
22
23# needed tools:
24TOOL_OBJECTS = \
25         arb_help2xml.o
26
27BINARIES = $(TOOL_OBJECTS:%.o=$(ARBHOME)/bin/%)
28
29QUIETLY = ./quietly.pl
30
31# using xsltproc and XMLLINT:
32XSLTPROC = ./arb_xslt.sh
33VALIDATE = $(QUIETLY) XMLLINT
34
35# --------------------------------------------------------------------------------
36# [required by POST_XSLTPROC below]
37
38SHELL := /bin/bash
39.SHELLFLAGS := -ec
40
41# --------------------------------------------------------------------------------
42
43$(MAIN) : all
44
45prepare: date generated dirs tools nonhlp_formats delzerohtml
46
47all: prepare
48                @echo --------------------------------------------------- [old hlp 2 xml]
49                time $(MAKE) xml
50                @echo --------------------------------------------------- [interdependencies]
51                time $(MAKE) interdepends
52                @echo --------------------------------------------------- [xml 2 html]
53                time $(MAKE) "USE_GENERATED_DEPENDS=1" html
54                @echo --------------------------------------------------- [xml 2 hlp]
55                time $(MAKE) "USE_GENERATED_DEPENDS=1" help
56                $(MAKE) $(HLP_DEST)/FORM.hlp
57
58$(HLP_DEST)/FORM.hlp: $(HLP_SOURCE)/FORM.hlp
59                cp -p $< $@
60
61
62dirs:
63                mkdir -p $(XML_LOCATION)
64                mkdir -p $(XML_LOCATION)/prompt
65
66                mkdir -p $(HTML_LOCATION)
67                mkdir -p $(HTML_LOCATION)/prompt
68
69                mkdir -p $(HLP_DEST)
70                mkdir -p $(HLP_DEST)/prompt
71
72                @ln -s ../arb_help.dtd $(XML_LOCATION) || true
73                @ln -s ../../arb_help.dtd $(XML_LOCATION)/prompt || true
74
75HELP2XML=$(ARBHOME)/bin/arb_help2xml
76
77# --------------------------------------------------------------------------------
78# Generate help files in $(HLP_GENERATED):
79
80generated: dirs
81                (( \
82                        echo --------------------------------------------------- ; \
83                        echo ------------ Generating some help files: ; \
84                        echo "$(SEP) Make genhelp" ; \
85                        cd $(HLP_GENERATED) && \
86                        $(MAKE) all && \
87                        echo "$(SEP) Make genhelp [done]" ; \
88                ) > genhelp.log 2>&1 && (cat genhelp.log;rm genhelp.log)) || (cat genhelp.log;rm genhelp.log;false)
89
90# --------------------------------------------------------------------------------
91
92HELP_INDEX_XML = $(XML_LOCATION)/$(HELP_INDEX_NAME).xml
93
94ifeq ($(ONLY_DO_UNITTEST),1)
95OLD_HELP_ALL= $(HLP_SOURCE)/unittest.hlp
96else
97OLD_HELP_ALL= \
98                $(HLP_SOURCE)/arb.hlp \
99                $(wildcard \
100                                $(HLP_GENERATED)/*.hlp \
101                                $(HLP_SOURCE)/*.hlp \
102                                $(HLP_SOURCE)/prompt/*.hlp \
103                )
104endif
105
106ifeq ($(TEST_ONE),1)
107#OLD_HELP=$(HLP_SOURCE)/arb.hlp $(HLP_SOURCE)/version.hlp $(HLP_SOURCE)/translate_dna_2_pro.hlp $(HLP_SOURCE)/species_join.hlp
108OLD_HELP=$(HLP_SOURCE)/version.hlp
109#OLD_HELP=$(HLP_SOURCE)/arb.hlp
110else
111OLD_HELP=$(OLD_HELP_ALL:$(HLP_SOURCE)/FORM.hlp=)# remove FORM.hlp (this is just a default file)
112endif
113
114XML_TMP=$(OLD_HELP:%.hlp=%.xml)
115XML_TMP2=$(XML_TMP:$(HLP_SOURCE)/%=$(XML_LOCATION)/%)
116XML=$(XML_TMP2:$(HLP_GENERATED)/%=$(XML_LOCATION)/%)
117
118XML_DEPEND=xml.stamp# xml files are rebuild if this stamp is recreated
119DTD=arb_help.dtd
120
121$(XML) : $(XML_DEPEND) Makefile $(QUIETLY)
122
123$(HELP_INDEX_XML): $(OLD_HELP_ALL) $(XML) ./generate_index.pl Makefile
124        ./generate_index.pl $(XML_LOCATION) $(HLP_DEST) $(HTML_LOCATION) $(HELP_INDEX_NAME).xml $(DOTMAP) > $@
125        -dot -Tgif -o$(GIFMAP) $(DOTMAP)
126        rm $(DOTMAP)
127
128xml : $(XML) $(HELP_INDEX_XML)
129
130dump:
131                echo $(XML)
132
133$(XML_LOCATION)/%.xml : $(HLP_SOURCE)/%.hlp $(DTD)
134                @test \! -f $(HLP_GENERATED)/$(<F) || \
135                                ( echo $<:1: exists twice -- only one existence allowed; \
136                                  echo $(HLP_GENERATED)/$(<F):1: other occurrence \
137                                  && false )
138                @$(HELP2XML) $< $@ || (rm -f $@ && echo "Error: generation of $@ failed" && false)
139
140$(XML_LOCATION)/%.xml : $(HLP_GENERATED)/%.hlp $(DTD)
141                @test \! -f $(HLP_SOURCE)/$(<F) || \
142                                ( echo $<:1: exists twice -- only one existence allowed; \
143                                  echo $(HLP_SOURCE)/$(<F):1: other occurrence \
144                                  && false )
145                @$(HELP2XML) $< $@ || (rm -f $@ && echo "Error: generation of $@ failed" && false)
146
147$(XML_LOCATION)/%.validate : $(XML_LOCATION)/%.xml
148                @$(VALIDATE) $<
149
150$(HTML_LOCATION)/help_index.html : $(HELP_INDEX_XML)
151
152HTML_TMP=$(XML:%.xml=%.html)
153HTML=$(HTML_TMP:$(XML_LOCATION)/%=$(HTML_LOCATION)/%)
154
155HELP_TMP=$(XML:%.xml=%.hlp)
156HELP=$(HELP_TMP:$(XML_LOCATION)/%=$(HLP_DEST)/%)
157
158# --------------------------------------------------------------------------------
159
160PS_SRC=$(wildcard $(HLP_SOURCE)/*.ps.gz)
161PDF_SRC=$(wildcard $(HLP_SOURCE)/*.pdf.gz)
162
163PS_DEST=$(PS_SRC:$(HLP_SOURCE)/%=$(HLP_DEST)/%)
164PDF_DEST=$(PDF_SRC:$(HLP_SOURCE)/%=$(HLP_DEST)/%)
165
166ps: $(PS_DEST)
167
168pdf: $(PDF_DEST)
169
170$(PS_DEST) : dirs
171$(PDF_DEST) : dirs
172
173nonhlp_formats: ps pdf
174
175$(HLP_DEST)/%.ps.gz : $(HLP_SOURCE)/%.ps.gz
176        cp -p $< $@
177
178$(HLP_DEST)/%.pdf.gz : $(HLP_SOURCE)/%.pdf.gz
179        cp -p $< $@
180
181# --------------------------------------------------------------------------------
182
183delzerohtml:
184                -if [ -d $(HTML_LOCATION) ] ; then find $(HTML_LOCATION) -name "*.html" -size -1 -exec rm {} \; ; fi
185
186date :
187        $(MAKE) date.xsl.tmp
188        ../SOURCE_TOOLS/mv_if_diff date.xsl.tmp date.xsl
189
190date.xsl.tmp :
191                cat date.xsl.header >$@
192                bash -c "(export LC_ALL=C;date '+%d. %b %Y')" >>$@
193                cat date.xsl.footer >>$@
194
195date.xsl : date
196
197# --------------------------------------------------------------------------------
198
199STYLE_HTML=to_html.xsl
200STYLE_HELP=to_help.xsl
201STYLE_DEPENDS=to_depends.xsl
202
203XSLTPROC_ARGS=--nonet --nomkdir --stringparam xml_location "$(XML_LOCATION)"
204
205# --------------------------------------------------------------------------------
206
207INTERDEPENDS=.depends
208INTERDEPENDS_SOURCE=$(XML)
209XML2DEPENDS=./xml_2_depends.pl
210
211$(INTERDEPENDS): $(INTERDEPENDS_SOURCE) $(XML2DEPENDS) Makefile $(STYLE_DEPENDS)
212        @( ( echo "$(INTERDEPENDS_SOURCE)" | $(XML2DEPENDS) $(XSLTPROC) $(STYLE_DEPENDS) $(XSLTPROC_ARGS) >$@ ) 2>interdep.err && \
213           ( $(XML2DEPENDS) CHECK $@ ) 2>>interdep.err && \
214           rm interdep.err ) || \
215         (cat interdep.err; false)
216
217interdepends: $(INTERDEPENDS)
218
219ifdef USE_GENERATED_DEPENDS
220 ifeq ($(USE_GENERATED_DEPENDS),1)
221  include $(INTERDEPENDS)
222 endif
223endif
224
225# --------------------------------------------------------------------------------
226
227POST_XSLTPROC := 2>&1 | ./postxslt.pl
228ifeq ($(STRICT_DOC),1)
229        POST_XSLTPROC += --fail-if-warning
230endif
231
232# --------------------------------------------------------------------------------
233
234$(HELP) : $(STYLE_HELP) $(DTD) Makefile
235
236$(HLP_DEST)/%.hlp : $(XML_LOCATION)/%.xml $(XML_LOCATION)/%.validate
237                @-rm -f $@
238                @set -o pipefail; $(XSLTPROC) --output $@ $(XSLTPROC_ARGS) --stringparam myname "$(subst $(XML_LOCATION)/,,$<)" $(STYLE_HELP) $< $(POST_XSLTPROC) $< || rm $@
239                @test -f $@ || (echo "$<:0: did not compile to $@" && false)
240
241# --------------------------------------------------------------------------------
242
243$(HTML) : $(STYLE_HTML) $(DTD) Makefile
244
245# Google logo
246google_logo: $(HTML_LOCATION)/Logo_25wht.gif
247$(HTML_LOCATION)/Logo_25wht.gif : Logo_25wht.gif
248                cp -p $< $@
249                @test -f $@
250
251$(HTML_LOCATION)/%.html : $(XML_LOCATION)/%.xml $(XML_LOCATION)/%.validate
252                @-rm -f $@
253                @set -o pipefail; $(XSLTPROC) --output $@ $(XSLTPROC_ARGS) --stringparam myname "$(subst $(XML_LOCATION)/,,$<)" $(STYLE_HTML) $< $(POST_XSLTPROC) $< || rm $@
254                @test -f $@ || (echo "$<:0: did not compile to $@" && false)
255
256# --------------------------------------------------------------------------------
257
258html : $(HTML) google_logo $(HTML_LOCATION)/$(HELP_INDEX_NAME).html
259
260help : $(HELP)
261
262# --------------------------------------------------------------------------------
263
264clean:
265        -rm -f $(TOOL_OBJECTS) $(BINARIES)
266        -rm -f $(XML_DEPEND) dummy date.xsl
267        -rm -rf $(XML_LOCATION) $(HLP_DEST) $(HTML_LOCATION) $(INTERDEPENDS)
268        $(MAKE) -C $(HLP_GENERATED) clean
269
270# --------------------------------------------------------------------------------
271
272tools: $(BINARIES)
273
274LIBS=../XML/XML.a
275
276$(HELP2XML): $(LIBS)
277
278$(XML_DEPEND) : arb_help2xml.cxx
279        touch $(XML_DEPEND)
280
281%.o: %.cxx
282        $(A_CXX) $(cflags) $(cxxflags) -c $< $(CXX_INCLUDES) $(POST_COMPILE) $<
283
284$(HELP2XML): arb_help2xml.o $(LIBS) $(use_ARB_main)
285        $(LINK_EXECUTABLE) $@ $(use_ARB_main) $< $(LIBS) $(LIBPATH) $(CORE_LIB)
286
287
288DEPENDS = $(TOOL_OBJECTS:.o=.depend)
289depends: $(DEPENDS)
290        @cat $(DEPENDS) | grep -v '^#' >>Makefile
291        @rm $(DEPENDS)
292$(DEPENDS): depend.init
293depend.init:
294        $(MAKEDEPEND) $(MAKEDEPENDFLAGS) 2>/dev/null # remove dependencies
295.c.depend:
296        $(MAKEDEPEND) -f- $(MAKEDEPENDFLAGS) $< 2>/dev/null >$@
297.cxx.depend:
298        $(MAKEDEPEND) -f- $(MAKEDEPENDFLAGS) $< 2>/dev/null >$@
299
300# DO NOT DELETE
301
302# Do not add dependencies manually - use 'make depend' in $ARBHOME
303# For formatting issues see SOURCE_TOOLS/fix_depends.pl (from main)
304
305arb_help2xml.o: $(ARBHOME)/INCLUDE/arb_assert.h
306arb_help2xml.o: $(ARBHOME)/INCLUDE/arb_core.h
307arb_help2xml.o: $(ARBHOME)/INCLUDE/arb_defs.h
308arb_help2xml.o: $(ARBHOME)/INCLUDE/arb_diff.h
309arb_help2xml.o: $(ARBHOME)/INCLUDE/arb_file.h
310arb_help2xml.o: $(ARBHOME)/INCLUDE/arb_msg.h
311arb_help2xml.o: $(ARBHOME)/INCLUDE/arbtools.h
312arb_help2xml.o: $(ARBHOME)/INCLUDE/attributes.h
313arb_help2xml.o: $(ARBHOME)/INCLUDE/cxxforward.h
314arb_help2xml.o: $(ARBHOME)/INCLUDE/dupstr.h
315arb_help2xml.o: $(ARBHOME)/INCLUDE/gccver.h
316arb_help2xml.o: $(ARBHOME)/INCLUDE/static_assert.h
317arb_help2xml.o: $(ARBHOME)/INCLUDE/stringize.h
318arb_help2xml.o: $(ARBHOME)/INCLUDE/test_global.h
319arb_help2xml.o: $(ARBHOME)/INCLUDE/test_unit.h
320arb_help2xml.o: $(ARBHOME)/INCLUDE/xml.hxx
Note: See TracBrowser for help on using the repository browser.