source: branches/help/HELP_SOURCE/Makefile

Last change on this file was 19530, checked in by westram, 4 days ago
  • automatically remove generated files
    • required after renaming/deleting help sources (otherwise reports bogus errors)
  • dead links now cause an error also during development.
  • resource checker:
    • bugtracker.hlp is autoused.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.3 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
37$(MAIN) : all
38
39prepare: date generated dirs tools nonhlp_formats delzerohtml
40
41all: prepare
42                @echo --------------------------------------------------- [old hlp 2 xml]
43                time $(MAKE) xml
44                @echo --------------------------------------------------- [interdependencies]
45                time $(MAKE) interdepends
46                @echo --------------------------------------------------- [xml 2 hlp]
47                time $(MAKE) "USE_GENERATED_DEPENDS=1" help
48                $(MAKE) $(HLP_DEST)/FORM.hlp
49                @echo --------------------------------------------------- [xml 2 html]
50                time $(MAKE) "USE_GENERATED_DEPENDS=1" html
51
52$(HLP_DEST)/FORM.hlp: $(HLP_SOURCE)/FORM.hlp
53                cp -p $< $@
54
55
56dirs:
57                mkdir -p $(XML_LOCATION)
58                mkdir -p $(XML_LOCATION)/prompt
59
60                mkdir -p $(HTML_LOCATION)
61                mkdir -p $(HTML_LOCATION)/prompt
62
63                mkdir -p $(HLP_DEST)
64                mkdir -p $(HLP_DEST)/prompt
65
66                @ln -s ../arb_help.dtd $(XML_LOCATION) || true
67                @ln -s ../../arb_help.dtd $(XML_LOCATION)/prompt || true
68
69HELP2XML=$(ARBHOME)/bin/arb_help2xml
70
71# --------------------------------------------------------------------------------
72# Generate help files in $(HLP_GENERATED):
73
74generated: dirs
75                (( \
76                        echo --------------------------------------------------- ; \
77                        echo ------------ Generating some help files: ; \
78                        echo "$(SEP) Make genhelp" ; \
79                        cd $(HLP_GENERATED) && \
80                        $(MAKE) all && \
81                        echo "$(SEP) Make genhelp [done]" ; \
82                ) > genhelp.log 2>&1 && (cat genhelp.log;rm genhelp.log)) || (cat genhelp.log;rm genhelp.log;false)
83
84# --------------------------------------------------------------------------------
85
86HELP_INDEX_XML = $(XML_LOCATION)/$(HELP_INDEX_NAME).xml
87
88ifeq ($(ONLY_DO_UNITTEST),1)
89OLD_HELP_ALL= $(HLP_SOURCE)/unittest.hlp
90else
91OLD_HELP_ALL= \
92                $(HLP_SOURCE)/arb.hlp \
93                $(wildcard \
94                                $(HLP_GENERATED)/*.hlp \
95                                $(HLP_SOURCE)/*.hlp \
96                                $(HLP_SOURCE)/prompt/*.hlp \
97                )
98endif
99
100ifeq ($(TEST_ONE),1)
101#OLD_HELP=$(HLP_SOURCE)/arb.hlp $(HLP_SOURCE)/version.hlp $(HLP_SOURCE)/translate_dna_2_pro.hlp $(HLP_SOURCE)/species_join.hlp
102OLD_HELP=$(HLP_SOURCE)/version.hlp
103#OLD_HELP=$(HLP_SOURCE)/arb.hlp
104else
105OLD_HELP=$(OLD_HELP_ALL:$(HLP_SOURCE)/FORM.hlp=)# remove FORM.hlp (this is just a default file)
106endif
107
108XML_TMP=$(OLD_HELP:%.hlp=%.xml)
109XML_TMP2=$(XML_TMP:$(HLP_SOURCE)/%=$(XML_LOCATION)/%)
110XML=$(XML_TMP2:$(HLP_GENERATED)/%=$(XML_LOCATION)/%)
111
112XML_DEPEND=xml.stamp# xml files are rebuild if this stamp is recreated
113DTD=arb_help.dtd
114
115$(XML) : $(XML_DEPEND) Makefile $(QUIETLY)
116
117$(HELP_INDEX_XML): $(OLD_HELP_ALL) $(XML) ./generate_index.pl Makefile
118        ./generate_index.pl $(XML_LOCATION) $(HLP_DEST) $(HTML_LOCATION) $(HELP_INDEX_NAME).xml $(DOTMAP) > $@
119        -dot -Tgif -o$(GIFMAP) $(DOTMAP)
120        rm $(DOTMAP)
121
122xml : $(XML) $(HELP_INDEX_XML)
123
124dump:
125                echo $(XML)
126
127$(XML_LOCATION)/%.xml : $(HLP_SOURCE)/%.hlp $(DTD)
128                @test \! -f $(HLP_GENERATED)/$(<F) || \
129                                ( echo $<:1: exists twice -- only one existence allowed; \
130                                  echo $(HLP_GENERATED)/$(<F):1: other occurrence \
131                                  && false )
132                @$(HELP2XML) $< $@ || (rm -f $@ && echo "Error: generation of $@ failed" && false)
133
134$(XML_LOCATION)/%.xml : $(HLP_GENERATED)/%.hlp $(DTD)
135                @test \! -f $(HLP_SOURCE)/$(<F) || \
136                                ( echo $<:1: exists twice -- only one existence allowed; \
137                                  echo $(HLP_SOURCE)/$(<F):1: other occurrence \
138                                  && false )
139                @$(HELP2XML) $< $@ || (rm -f $@ && echo "Error: generation of $@ failed" && false)
140
141$(XML_LOCATION)/%.validate : $(XML_LOCATION)/%.xml
142                @$(VALIDATE) $<
143
144$(HTML_LOCATION)/help_index.html : $(HELP_INDEX_XML)
145
146HTML_TMP=$(XML:%.xml=%.html)
147HTML=$(HTML_TMP:$(XML_LOCATION)/%=$(HTML_LOCATION)/%)
148
149HELP_TMP=$(XML:%.xml=%.hlp)
150HELP=$(HELP_TMP:$(XML_LOCATION)/%=$(HLP_DEST)/%)
151
152# --------------------------------------------------------------------------------
153
154PS_SRC=$(wildcard $(HLP_SOURCE)/*.ps.gz)
155PDF_SRC=$(wildcard $(HLP_SOURCE)/*.pdf.gz)
156
157PS_DEST=$(PS_SRC:$(HLP_SOURCE)/%=$(HLP_DEST)/%)
158PDF_DEST=$(PDF_SRC:$(HLP_SOURCE)/%=$(HLP_DEST)/%)
159
160ps: $(PS_DEST)
161
162pdf: $(PDF_DEST)
163
164$(PS_DEST) : dirs
165$(PDF_DEST) : dirs
166
167nonhlp_formats: ps pdf
168
169$(HLP_DEST)/%.ps.gz : $(HLP_SOURCE)/%.ps.gz
170        cp -p $< $@
171
172$(HLP_DEST)/%.pdf.gz : $(HLP_SOURCE)/%.pdf.gz
173        cp -p $< $@
174
175# --------------------------------------------------------------------------------
176
177delzerohtml:
178                -if [ -d $(HTML_LOCATION) ] ; then find $(HTML_LOCATION) -name "*.html" -size -1 -exec rm {} \; ; fi
179
180date :
181        $(MAKE) date.xsl.tmp
182        ../SOURCE_TOOLS/mv_if_diff date.xsl.tmp date.xsl
183
184date.xsl.tmp :
185                cat date.xsl.header >$@
186                bash -c "(export LC_ALL=C;date '+%d. %b %Y')" >>$@
187                cat date.xsl.footer >>$@
188
189date.xsl : date
190
191# --------------------------------------------------------------------------------
192
193STYLE_HTML=to_html.xsl
194STYLE_HELP=to_help.xsl
195STYLE_DEPENDS=to_depends.xsl
196
197XSLTPROC_ARGS=--nonet --nomkdir --stringparam xml_location "$(XML_LOCATION)"
198
199# --------------------------------------------------------------------------------
200
201INTERDEPENDS=.depends
202INTERDEPENDS_SOURCE=$(XML)
203XML2DEPENDS=./xml_2_depends.pl
204
205$(INTERDEPENDS): $(INTERDEPENDS_SOURCE) $(XML2DEPENDS) Makefile $(STYLE_DEPENDS)
206        @( ( echo "$(INTERDEPENDS_SOURCE)" | $(XML2DEPENDS) $(XSLTPROC) $(STYLE_DEPENDS) $(XSLTPROC_ARGS) >$@ ) 2>interdep.err && \
207           ( $(XML2DEPENDS) CHECK $@ ) 2>>interdep.err && \
208           rm interdep.err ) || \
209         (cat interdep.err; false)
210
211interdepends: $(INTERDEPENDS)
212
213ifdef USE_GENERATED_DEPENDS
214 ifeq ($(USE_GENERATED_DEPENDS),1)
215  include $(INTERDEPENDS)
216 endif
217endif
218
219# --------------------------------------------------------------------------------
220
221$(HELP) : $(STYLE_HELP) $(DTD) Makefile
222
223$(HLP_DEST)/%.hlp : $(XML_LOCATION)/%.xml $(XML_LOCATION)/%.validate
224                @-rm -f $@
225                @$(XSLTPROC) --output $@ $(XSLTPROC_ARGS) --stringparam myname "$(subst $(XML_LOCATION)/,,$<)" $(STYLE_HELP) $< || rm $@
226                @test -f $@ || (echo "$<:0: did not compile to $@" && false)
227
228# --------------------------------------------------------------------------------
229
230$(HTML) : $(STYLE_HTML) $(DTD) Makefile
231
232# Google logo
233google_logo: $(HTML_LOCATION)/Logo_25wht.gif
234$(HTML_LOCATION)/Logo_25wht.gif : Logo_25wht.gif
235                cp -p $< $@
236                @test -f $@
237
238$(HTML_LOCATION)/%.html : $(XML_LOCATION)/%.xml $(XML_LOCATION)/%.validate
239                @-rm -f $@
240                @$(XSLTPROC) --output $@ $(XSLTPROC_ARGS) --stringparam myname "$(subst $(XML_LOCATION)/,,$<)" $(STYLE_HTML) $< || (rm $@ && test -f $@)
241                @test -f $@ || (echo "$<:0: did not compile to $@" && false)
242
243# --------------------------------------------------------------------------------
244
245html : $(HTML) google_logo $(HTML_LOCATION)/$(HELP_INDEX_NAME).html
246
247help : $(HELP)
248
249# --------------------------------------------------------------------------------
250
251clean:
252        -rm -f $(TOOL_OBJECTS) $(BINARIES)
253        -rm -f $(XML_DEPEND) dummy date.xsl
254        -rm -rf $(XML_LOCATION) $(HLP_DEST) $(HTML_LOCATION) $(INTERDEPENDS)
255        $(MAKE) -C $(HLP_GENERATED) clean
256
257# --------------------------------------------------------------------------------
258
259tools: $(BINARIES)
260
261LIBS=../XML/XML.a
262
263$(HELP2XML): $(LIBS)
264
265$(XML_DEPEND) : arb_help2xml.cxx
266        touch $(XML_DEPEND)
267
268%.o: %.cxx
269        $(A_CXX) $(cflags) $(cxxflags) -c $< $(CXX_INCLUDES) $(POST_COMPILE) $<
270
271$(HELP2XML): arb_help2xml.o $(LIBS) $(use_ARB_main)
272        $(LINK_EXECUTABLE) $@ $(use_ARB_main) $< $(LIBS) $(LIBPATH) $(CORE_LIB)
273
274
275DEPENDS = $(TOOL_OBJECTS:.o=.depend)
276depends: $(DEPENDS)
277        @cat $(DEPENDS) | grep -v '^#' >>Makefile
278        @rm $(DEPENDS)
279$(DEPENDS): depend.init
280depend.init:
281        $(MAKEDEPEND) $(MAKEDEPENDFLAGS) 2>/dev/null # remove dependencies
282.c.depend:
283        $(MAKEDEPEND) -f- $(MAKEDEPENDFLAGS) $< 2>/dev/null >$@
284.cxx.depend:
285        $(MAKEDEPEND) -f- $(MAKEDEPENDFLAGS) $< 2>/dev/null >$@
286
287# DO NOT DELETE
288
289# Do not add dependencies manually - use 'make depend' in $ARBHOME
290# For formatting issues see SOURCE_TOOLS/fix_depends.pl (from main)
291
292arb_help2xml.o: $(ARBHOME)/INCLUDE/arb_assert.h
293arb_help2xml.o: $(ARBHOME)/INCLUDE/arb_core.h
294arb_help2xml.o: $(ARBHOME)/INCLUDE/arb_defs.h
295arb_help2xml.o: $(ARBHOME)/INCLUDE/arb_diff.h
296arb_help2xml.o: $(ARBHOME)/INCLUDE/arb_file.h
297arb_help2xml.o: $(ARBHOME)/INCLUDE/arb_msg.h
298arb_help2xml.o: $(ARBHOME)/INCLUDE/arbtools.h
299arb_help2xml.o: $(ARBHOME)/INCLUDE/attributes.h
300arb_help2xml.o: $(ARBHOME)/INCLUDE/cxxforward.h
301arb_help2xml.o: $(ARBHOME)/INCLUDE/dupstr.h
302arb_help2xml.o: $(ARBHOME)/INCLUDE/gccver.h
303arb_help2xml.o: $(ARBHOME)/INCLUDE/static_assert.h
304arb_help2xml.o: $(ARBHOME)/INCLUDE/stringize.h
305arb_help2xml.o: $(ARBHOME)/INCLUDE/test_global.h
306arb_help2xml.o: $(ARBHOME)/INCLUDE/test_unit.h
307arb_help2xml.o: $(ARBHOME)/INCLUDE/xml.hxx
Note: See TracBrowser for help on using the repository browser.