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 | |
---|
8 | TEST_ONE:=0# default is 0; if 1 -> only one .hlp file is processed. see below .@TEST_ONE |
---|
9 | ONLY_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 | |
---|
14 | HLP_SOURCE=source |
---|
15 | HLP_GENERATED=genhelp |
---|
16 | XML_LOCATION=Xml |
---|
17 | HTML_LOCATION=../lib/help_html |
---|
18 | HLP_DEST=../lib/help |
---|
19 | HELP_INDEX_NAME = help_index |
---|
20 | DOTMAP=./help_map.dot |
---|
21 | GIFMAP=./help_map.gif |
---|
22 | |
---|
23 | # needed tools: |
---|
24 | TOOL_OBJECTS = \ |
---|
25 | arb_help2xml.o |
---|
26 | |
---|
27 | BINARIES = $(TOOL_OBJECTS:%.o=$(ARBHOME)/bin/%) |
---|
28 | |
---|
29 | QUIETLY = ./quietly.pl |
---|
30 | |
---|
31 | # using xsltproc and XMLLINT: |
---|
32 | XSLTPROC = ./arb_xslt.sh |
---|
33 | VALIDATE = $(QUIETLY) XMLLINT |
---|
34 | |
---|
35 | # -------------------------------------------------------------------------------- |
---|
36 | |
---|
37 | $(MAIN) : all |
---|
38 | |
---|
39 | prepare: date generated dirs tools nonhlp_formats delzerohtml |
---|
40 | |
---|
41 | all: 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 | |
---|
56 | dirs: |
---|
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 | |
---|
69 | HELP2XML=$(ARBHOME)/bin/arb_help2xml |
---|
70 | |
---|
71 | # -------------------------------------------------------------------------------- |
---|
72 | # Generate help files in $(HLP_GENERATED): |
---|
73 | |
---|
74 | generated: dirs |
---|
75 | @echo --------------------------------------------------- |
---|
76 | @echo ------------ Generating some help files: |
---|
77 | (cd $(HLP_GENERATED);$(MAKE) all) |
---|
78 | |
---|
79 | # -------------------------------------------------------------------------------- |
---|
80 | |
---|
81 | HELP_INDEX_XML = $(XML_LOCATION)/$(HELP_INDEX_NAME).xml |
---|
82 | |
---|
83 | ifeq ($(ONLY_DO_UNITTEST),1) |
---|
84 | OLD_HELP_ALL= $(HLP_SOURCE)/unittest.hlp |
---|
85 | else |
---|
86 | OLD_HELP_ALL= \ |
---|
87 | $(HLP_SOURCE)/arb.hlp \ |
---|
88 | $(wildcard \ |
---|
89 | $(HLP_GENERATED)/*.hlp \ |
---|
90 | $(HLP_SOURCE)/*.hlp \ |
---|
91 | $(HLP_SOURCE)/prompt/*.hlp \ |
---|
92 | ) |
---|
93 | endif |
---|
94 | |
---|
95 | ifeq ($(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 |
---|
97 | OLD_HELP=$(HLP_SOURCE)/version.hlp |
---|
98 | #OLD_HELP=$(HLP_SOURCE)/arb.hlp |
---|
99 | else |
---|
100 | OLD_HELP=$(OLD_HELP_ALL:$(HLP_SOURCE)/FORM.hlp=)# remove FORM.hlp (this is just a default file) |
---|
101 | endif |
---|
102 | |
---|
103 | XML_TMP=$(OLD_HELP:%.hlp=%.xml) |
---|
104 | XML_TMP2=$(XML_TMP:$(HLP_SOURCE)/%=$(XML_LOCATION)/%) |
---|
105 | XML=$(XML_TMP2:$(HLP_GENERATED)/%=$(XML_LOCATION)/%) |
---|
106 | |
---|
107 | XML_DEPEND=xml.stamp# xml files are rebuild if this stamp is recreated |
---|
108 | DTD=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 | |
---|
117 | xml : $(XML) $(HELP_INDEX_XML) |
---|
118 | |
---|
119 | dump: |
---|
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 | |
---|
140 | HTML_TMP=$(XML:%.xml=%.html) |
---|
141 | HTML=$(HTML_TMP:$(XML_LOCATION)/%=$(HTML_LOCATION)/%) |
---|
142 | |
---|
143 | HELP_TMP=$(XML:%.xml=%.hlp) |
---|
144 | HELP=$(HELP_TMP:$(XML_LOCATION)/%=$(HLP_DEST)/%) |
---|
145 | |
---|
146 | # -------------------------------------------------------------------------------- |
---|
147 | |
---|
148 | PS_SRC=$(wildcard $(HLP_SOURCE)/*.ps.gz) |
---|
149 | PDF_SRC=$(wildcard $(HLP_SOURCE)/*.pdf.gz) |
---|
150 | |
---|
151 | PS_DEST=$(PS_SRC:$(HLP_SOURCE)/%=$(HLP_DEST)/%) |
---|
152 | PDF_DEST=$(PDF_SRC:$(HLP_SOURCE)/%=$(HLP_DEST)/%) |
---|
153 | |
---|
154 | ps: $(PS_DEST) |
---|
155 | |
---|
156 | pdf: $(PDF_DEST) |
---|
157 | |
---|
158 | $(PS_DEST) : dirs |
---|
159 | $(PDF_DEST) : dirs |
---|
160 | |
---|
161 | nonhlp_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 | |
---|
171 | delzerohtml: |
---|
172 | -if [ -d $(HTML_LOCATION) ] ; then find $(HTML_LOCATION) -name "*.html" -size -1 -exec rm {} \; ; fi |
---|
173 | |
---|
174 | date : |
---|
175 | $(MAKE) date.xsl.tmp |
---|
176 | ../SOURCE_TOOLS/mv_if_diff date.xsl.tmp date.xsl |
---|
177 | |
---|
178 | date.xsl.tmp : |
---|
179 | cat date.xsl.header >$@ |
---|
180 | bash -c "(export LC_ALL=C;date '+%d. %b %Y')" >>$@ |
---|
181 | cat date.xsl.footer >>$@ |
---|
182 | |
---|
183 | date.xsl : date |
---|
184 | |
---|
185 | # -------------------------------------------------------------------------------- |
---|
186 | |
---|
187 | STYLE_HTML=to_html.xsl |
---|
188 | STYLE_HELP=to_help.xsl |
---|
189 | STYLE_DEPENDS=to_depends.xsl |
---|
190 | |
---|
191 | XSLTPROC_ARGS=--nonet --nomkdir --stringparam xml_location "$(XML_LOCATION)" |
---|
192 | |
---|
193 | # -------------------------------------------------------------------------------- |
---|
194 | |
---|
195 | INTERDEPENDS=.depends |
---|
196 | INTERDEPENDS_SOURCE=$(XML) |
---|
197 | XML2DEPENDS=./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 | |
---|
205 | interdepends: $(INTERDEPENDS) |
---|
206 | |
---|
207 | ifdef USE_GENERATED_DEPENDS |
---|
208 | ifeq ($(USE_GENERATED_DEPENDS),1) |
---|
209 | include $(INTERDEPENDS) |
---|
210 | endif |
---|
211 | endif |
---|
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 |
---|
227 | google_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 | |
---|
239 | html : $(HTML) google_logo $(HTML_LOCATION)/$(HELP_INDEX_NAME).html |
---|
240 | |
---|
241 | help : $(HELP) |
---|
242 | |
---|
243 | # -------------------------------------------------------------------------------- |
---|
244 | |
---|
245 | clean: |
---|
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 | |
---|
253 | tools: $(BINARIES) |
---|
254 | |
---|
255 | LIBS=../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 | |
---|
269 | DEPENDS = $(TOOL_OBJECTS:.o=.depend) |
---|
270 | depends: $(DEPENDS) |
---|
271 | @cat $(DEPENDS) | grep -v '^#' >>Makefile |
---|
272 | @rm $(DEPENDS) |
---|
273 | $(DEPENDS): depend.init |
---|
274 | depend.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 | |
---|
286 | arb_help2xml.o: $(ARBHOME)/INCLUDE/arb_assert.h |
---|
287 | arb_help2xml.o: $(ARBHOME)/INCLUDE/arb_core.h |
---|
288 | arb_help2xml.o: $(ARBHOME)/INCLUDE/arb_defs.h |
---|
289 | arb_help2xml.o: $(ARBHOME)/INCLUDE/arb_diff.h |
---|
290 | arb_help2xml.o: $(ARBHOME)/INCLUDE/arb_file.h |
---|
291 | arb_help2xml.o: $(ARBHOME)/INCLUDE/arb_msg.h |
---|
292 | arb_help2xml.o: $(ARBHOME)/INCLUDE/arbtools.h |
---|
293 | arb_help2xml.o: $(ARBHOME)/INCLUDE/attributes.h |
---|
294 | arb_help2xml.o: $(ARBHOME)/INCLUDE/cxxforward.h |
---|
295 | arb_help2xml.o: $(ARBHOME)/INCLUDE/dupstr.h |
---|
296 | arb_help2xml.o: $(ARBHOME)/INCLUDE/gccver.h |
---|
297 | arb_help2xml.o: $(ARBHOME)/INCLUDE/static_assert.h |
---|
298 | arb_help2xml.o: $(ARBHOME)/INCLUDE/stringize.h |
---|
299 | arb_help2xml.o: $(ARBHOME)/INCLUDE/test_global.h |
---|
300 | arb_help2xml.o: $(ARBHOME)/INCLUDE/test_unit.h |
---|
301 | arb_help2xml.o: $(ARBHOME)/INCLUDE/xml.hxx |
---|