source: trunk/HELP_SOURCE/Makefile

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