| 1 | # -*-Mode: Makefile;-*-  (emacs! this is a makefile!) | 
|---|
| 2 |  | 
|---|
| 3 | .SUFFIXES: .doc .help .html | 
|---|
| 4 |  | 
|---|
| 5 | # GENHELPDEST, GENDOCDEST and HELPFILELIST are passed from 'Makefile' | 
|---|
| 6 |  | 
|---|
| 7 | HELP_NAMES=$(shell cat $(HELPFILELIST)) | 
|---|
| 8 | HELP_TARGETS=$(addprefix $(GENHELPDEST)/,$(HELP_NAMES)) | 
|---|
| 9 | HELP_PLAIN=./HELP_PLAIN | 
|---|
| 10 | HELP_WRITTEN=./HELP_WRITTEN | 
|---|
| 11 | HEADER=arb_help.head | 
|---|
| 12 | SED:=$(ARBHOME)/SH/arb_sed | 
|---|
| 13 | all: info forcedoc $(HELP_TARGETS) | 
|---|
| 14 |  | 
|---|
| 15 | info: | 
|---|
| 16 | @echo "----------------------------------------------------------------" | 
|---|
| 17 | @echo "Collecting documentation for external programs used in GDE menus" | 
|---|
| 18 | #       @echo "HELP_TARGETS=$(HELP_TARGETS)" | 
|---|
| 19 |  | 
|---|
| 20 | # ------------------------------------------------------------ | 
|---|
| 21 | # rules to generate helpfiles | 
|---|
| 22 | # we need rules here for each helpfile specified on an 'itemhelp' line in GDE menus. | 
|---|
| 23 |  | 
|---|
| 24 | ARBHOME=.. | 
|---|
| 25 | GDE=$(ARBHOME)/GDE | 
|---|
| 26 |  | 
|---|
| 27 | GENHELP_DEPENDS=genhelp.sh Makefile.helpfiles | 
|---|
| 28 | GENHELPTREE_DEPENDS=genhelptree.sh $(GENHELP_DEPENDS) | 
|---|
| 29 |  | 
|---|
| 30 | # ---------- CLUSTALW | 
|---|
| 31 |  | 
|---|
| 32 | CLUSTALW=$(GDE)/CLUSTALW | 
|---|
| 33 | CLUSTALW_HELP=$(CLUSTALW)/clustalw_help | 
|---|
| 34 | CLUSTALW_DOC=$(CLUSTALW)/clustalw.doc | 
|---|
| 35 |  | 
|---|
| 36 | $(GENHELPDEST)/clustalw.help: $(CLUSTALW_HELP) $(CLUSTALW_DOC) $(GENHELPTREE_DEPENDS) | 
|---|
| 37 | ./genhelptree.sh $@ "$(subst .help,,$(notdir $@))" $(HEADER) $(CLUSTALW_HELP) $(CLUSTALW_DOC) | 
|---|
| 38 |  | 
|---|
| 39 | # ---------- AXML / FASTDNAML | 
|---|
| 40 |  | 
|---|
| 41 | AXML_HELP=$(GDE)/AxML/AxML.doc | 
|---|
| 42 | FASTDNAML_DOC=$(GDE)/FASTDNAML/fastDNAml.doc | 
|---|
| 43 |  | 
|---|
| 44 | $(GENHELPDEST)/dnaml.help: $(AXML_HELP) $(FASTDNAML_DOC) $(GENHELPTREE_DEPENDS) | 
|---|
| 45 | ./genhelptree.sh $@ "$(subst .help,,$(notdir $@))" $(HEADER) $(AXML_HELP) $(FASTDNAML_DOC) | 
|---|
| 46 |  | 
|---|
| 47 | # ---------- READSEQ | 
|---|
| 48 |  | 
|---|
| 49 | READSEQ=$(ARBHOME)/READSEQ | 
|---|
| 50 | READSEQ_DOC_NAMES=Readme Formats Readseq.help | 
|---|
| 51 | READSEQ_DOCS=$(addprefix $(READSEQ)/,$(READSEQ_DOC_NAMES)) | 
|---|
| 52 |  | 
|---|
| 53 | $(GENHELPDEST)/readseq.help: $(READSEQ_DOCS) $(GENHELPTREE_DEPENDS) | 
|---|
| 54 | ./genhelptree.sh $@ "$(subst .help,,$(notdir $@))" $(HEADER) $(READSEQ_DOCS) | 
|---|
| 55 |  | 
|---|
| 56 | # ---------- PHYLIP | 
|---|
| 57 |  | 
|---|
| 58 | PHYLIP_DISTANCE_HELP_NAMES=fitch kitsch neighbor dnadist protdist | 
|---|
| 59 | PHYLIP_DISTANCE_HELPS=$(addsuffix .doc,$(addprefix $(GENDOCDEST)/,$(PHYLIP_DISTANCE_HELP_NAMES))) | 
|---|
| 60 |  | 
|---|
| 61 | $(GENHELPDEST)/phylip_distance.help: $(PHYLIP_DISTANCE_HELPS) $(GENHELPTREE_DEPENDS) | 
|---|
| 62 | ./genhelptree.sh $@ "$(subst .help,,$(notdir $@))" $(HEADER) $(PHYLIP_DISTANCE_HELPS) | 
|---|
| 63 |  | 
|---|
| 64 | # ------------------------------------------------------------ | 
|---|
| 65 | # all help files in ./HELP_PLAIN are automatically found | 
|---|
| 66 |  | 
|---|
| 67 | $(GENHELPDEST)/%.help: $(HELP_PLAIN)/%.help $(HEADER) $(GENHELP_DEPENDS) | 
|---|
| 68 | ./genhelp.sh $@ "$(subst .help,,$(notdir $@))" $(HEADER) $< | 
|---|
| 69 |  | 
|---|
| 70 | # all help files in ./HELP_DOC_GEN are automatically found | 
|---|
| 71 |  | 
|---|
| 72 | $(GENHELPDEST)/%.help: $(GENDOCDEST)/%.doc $(HEADER) $(GENHELP_DEPENDS) | 
|---|
| 73 | ./genhelp.sh $@ "$(subst .help,,$(notdir $@))" $(HEADER) $< | 
|---|
| 74 |  | 
|---|
| 75 | # ------------------------------------------------------------ | 
|---|
| 76 | # rules to generate plain doc from provided html files | 
|---|
| 77 |  | 
|---|
| 78 | HELP_TREEPUZZLE=../GDE/TREEPUZZLE/doc | 
|---|
| 79 | PHYLIP_MAIN=../GDE/PHYLIP | 
|---|
| 80 | HELP_PHYLIP=$(PHYLIP_MAIN)/doc | 
|---|
| 81 | HELP_PHYML=../GDE/PHYML | 
|---|
| 82 |  | 
|---|
| 83 | FORCED_DOC_NAMES=proml dnapars protpars phyml phylip | 
|---|
| 84 | LYNX_PARA=-dump -nolist -display_charset=iso-8859-1 | 
|---|
| 85 |  | 
|---|
| 86 | # - convert copyright symbol dumped by lynx | 
|---|
| 87 | # - remove underscore lines dumped for "<HR/>" (causes paragraph-reflow to fail) | 
|---|
| 88 | FILTER_LYNX_OUTPUT=$(SED) -e 's/©/(C)/' -e 's/^\s\s*__*$$//' | 
|---|
| 89 |  | 
|---|
| 90 | $(GENDOCDEST)/%.doc: $(HELP_PHYLIP)/%.html Makefile.helpfiles | 
|---|
| 91 | @(test -f $@ && chmod u+w $@) || true | 
|---|
| 92 | (echo "   [ generated from ../$< ]"; echo ""; lynx $(LYNX_PARA) $<) | $(FILTER_LYNX_OUTPUT) > $@ | 
|---|
| 93 | @test -s $@ || (echo $@ not generated or empty && rm $@ && false) | 
|---|
| 94 | @chmod a-w $@ | 
|---|
| 95 |  | 
|---|
| 96 | $(GENDOCDEST)/treepuzzle.doc: $(HELP_TREEPUZZLE)/manual.html Makefile.helpfiles | 
|---|
| 97 | @(test -f $@ && chmod u+w $@) || true | 
|---|
| 98 | (echo "   [ generated from ../$< ]"; echo ""; lynx $(LYNX_PARA) $<) | $(FILTER_LYNX_OUTPUT) > $@ | 
|---|
| 99 | @test -s $@ || (echo $@ not generated or empty && rm $@ && false) | 
|---|
| 100 | @chmod a-w $@ | 
|---|
| 101 |  | 
|---|
| 102 | $(GENDOCDEST)/phyml.doc: $(HELP_PHYML)/usersguide_phyliplike.html Makefile.helpfiles | 
|---|
| 103 | @(test -f $@ && chmod u+w $@) || true | 
|---|
| 104 | (echo "   [ generated from ../$< ]"; echo ""; lynx $(LYNX_PARA) $<) | $(FILTER_LYNX_OUTPUT) > $@ | 
|---|
| 105 | @test -s $@ || (echo $@ not generated or empty && rm $@ && false) | 
|---|
| 106 | @chmod a-w $@ | 
|---|
| 107 |  | 
|---|
| 108 | $(GENDOCDEST)/phylip.doc: $(PHYLIP_MAIN)/phylip.html Makefile.helpfiles | 
|---|
| 109 | @(test -f $@ && chmod u+w $@) || true | 
|---|
| 110 | (echo "   [ generated from ../$< ]"; echo ""; lynx $(LYNX_PARA) $<) | $(FILTER_LYNX_OUTPUT) > $@ | 
|---|
| 111 | @test -s $@ || (echo $@ not generated or empty && rm $@ && false) | 
|---|
| 112 | @chmod a-w $@ | 
|---|
| 113 |  | 
|---|
| 114 | FORCED_DOCS=$(addsuffix .doc,$(addprefix $(GENDOCDEST)/,$(FORCED_DOC_NAMES))) | 
|---|
| 115 | forcedoc: $(FORCED_DOCS) Makefile | 
|---|
| 116 |  | 
|---|
| 117 | # ------------------------------------------------------------ | 
|---|
| 118 | # default rule to raise error if no rule is given to generate a helpfile. | 
|---|
| 119 | # dont warn if there's a help file in HELP_WRITTEN | 
|---|
| 120 | # (files there are processed by ../HELP_SOURCE/genhelp/Makefile ) | 
|---|
| 121 |  | 
|---|
| 122 | $(GENHELPDEST)/%.help: | 
|---|
| 123 | @( test -f $(HELP_WRITTEN)/$(notdir $@) ) \ | 
|---|
| 124 | || \ | 
|---|
| 125 | ( \ | 
|---|
| 126 | echo "Makefile.helpfiles:22: Error: No rule to make $(notdir $@) (to which is referred-to inside GDE menus, see hits below)" ; \ | 
|---|
| 127 | grep -n $(notdir $@) MENUS/*.menu ; \ | 
|---|
| 128 | false ) | 
|---|
| 129 |  | 
|---|
| 130 | clean: | 
|---|
| 131 | rm -rf $(GENHELPDEST) $(GENDOCDEST) | 
|---|