]> git.donarmstrong.com Git - lilypond.git/blob - stepmake/stepmake/texinfo-targets.make
Update documentation targets
[lilypond.git] / stepmake / stepmake / texinfo-targets.make
1 .PHONY : texinfo-all-menus-update
2
3 default: $(INFO_FILES)
4
5 ifeq ($(out),www)
6 local-WWW-1: $(XREF_MAPS_FILES)
7 endif
8
9 local-doc:  $(OUTTXT_FILES)
10
11 check-info: texinfo-all-menus-update
12
13 ## info stuff
14 local-install: install-info
15 local-uninstall: uninstall-info
16 install-info: local-install-info
17 uninstall-info: local-uninstall-info
18
19 install-info: $(INFO_FILES)
20         $(INFO_INSTALL_COMMAND) local-install
21
22 uninstall-info:
23         $(INFO_INSTALL_COMMAND) local-uninstall
24
25 ifeq ($(INFO_FILES),)
26 local-install-info:
27 local-uninstall-info:
28
29 else # $(INFO_FILES) non empty
30 # There are two modes for info: with and without images.
31 ifeq ($(out),www)
32
33 # This builds all .info targets with images, in out-www.
34 # Viewable with a recent Emacs, doing: C-u C-h i out-www/lilypond.info
35
36 ifneq ($(COPY_INFO_IMAGES),)
37 # only Info docs are installed (not HTML nor PDF),
38 # so images should be copied
39
40 install-info-images:
41 # remove $(infodir)/$(INFO_IMAGES_DIR) in case it is a symlink
42         -rm -f $(DESTDIR)$(infodir)/$(INFO_IMAGES_DIR)
43         $(INSTALL) -d $(DESTDIR)$(infodir)/$(INFO_IMAGES_DIR)
44         rsync -r --include '[0-9a-f][0-9a-f]' --include '*.png' --exclude '*' $(outdir)/ $(DESTDIR)$(infodir)/$(INFO_IMAGES_DIR)/
45
46 uninstall-info-images:
47         rm -f $(DESTDIR)$(infodir)/$(INFO_IMAGES_DIR) || rm -rf $(DESTDIR)$(infodir)/$(INFO_IMAGES_DIR)
48
49 else # if HTML and PDF docs are installed too, symlink image directories
50 install-info-images: uninstall-info-images
51         cd $(DESTDIR)$(infodir) && ln -sf $$($(PYTHON) $(buildscript-dir)/relative $(DESTDIR)$(webdir)/$(DEST_INFO_IMAGES_SUBDIR)) $(INFO_IMAGES_DIR)
52
53 uninstall-info-images:
54         rm -f $(DESTDIR)$(infodir)/$(INFO_IMAGES_DIR) || rm -rf $(DESTDIR)$(infodir)/$(INFO_IMAGES_DIR)
55 endif # copying info images
56
57
58 ifneq ($(patsubst %/local,%,$(DESTDIR)$(prefix)),/usr)
59 ## install-info can't do all his job for binary packages build systems.
60 ## Best we can do is to notify the builder or packager.
61 local-install-info: info
62         -$(INSTALL) -d $(DESTDIR)$(infodir)
63         @echo
64         @echo "***************************************************************"
65         @echo "Please add or update the LilyPond direntries,"
66         @echo "do or add in the postinstall script"
67         @echo
68         @echo "    install-info --info-dir=$(infodir) $(DESTDIR)$(infodir)/$(MAIN_INFO_DOC).info"
69         @echo
70         $(MAKE) install-info-images
71
72 local-uninstall-info: uninstall-info-images
73         -rmdir $(DESTDIR)$(infodir)
74
75 else # installing directly into standard /usr/...
76 local-install-info: info
77         -$(INSTALL) -d $(DESTDIR)$(infodir)
78         $(foreach f,$(INFO_FILES),install-info --remove --info-dir=$(infodir) $(f) ; )true
79         install-info --info-dir=$(infodir) $(outdir)/$(MAIN_INFO_DOC).info
80         $(MAKE) install-info-images
81
82 local-uninstall-info: uninstall-info-images
83         $(foreach f,$(INFO_FILES),install-info --remove --info-dir=$(infodir) $(f) ; )true
84
85 endif # installing directly into standard /usr/...
86
87 else # out!=www
88
89 ifneq ($(patsubst %/local,%,$(DESTDIR)$(prefix)),/usr)
90 ## install-info can't do all his job for binary packages build systems.
91 ## Best we can do is to notify the builder or packager.
92 local-install-info: info
93         -$(INSTALL) -d $(DESTDIR)$(infodir)
94         @echo
95         @echo "***************************************************************"
96         @echo "Please add or update the LilyPond direntries, do"
97         @echo
98         @echo "    install-info --info-dir=$(infodir) $(DESTDIR)$(infodir)/$(MAIN_INFO_DOC).info"
99         @echo
100         @echo "To compile Info documentation with images, please read"
101         @echo "Application Usage document, section \"Building documentation\"."
102         @echo
103
104 local-uninstall-info:
105         -rmdir $(DESTDIR)$(infodir)
106
107 else # installing directly into standard /usr/...
108 local-install-info: info
109         -$(INSTALL) -d $(DESTDIR)$(infodir)
110         $(foreach f,$(INFO_FILES),install-info --remove --info-dir=$(infodir) $(f) ; )true
111         install-info --info-dir=$(infodir) $(outdir)/$(MAIN_INFO_DOC).info
112         @echo
113         @echo "***************************************************************"
114         @echo "To compile Info documentation with images, do from top of the build tree"
115         @echo
116         @echo "    make web"
117         @echo
118         @echo "which builds documentation in all formats; to build only Info documentation, do"
119         @echo
120         @echo "    make info"
121         @echo
122         @echo "To list all available targets, do"
123         @echo
124         @echo "    make help"
125         @echo
126         @echo "For details, please read Application Usage document, section \"Building documentation\"."
127         @echo
128
129 local-uninstall-info:
130         $(foreach f,$(INFO_FILES),install-info --remove --info-dir=$(infodir) $(f) ; )true
131
132 endif # installing into standard /usr/* root
133
134 endif # out!=www
135
136 endif # $(INFO_FILES) non empty
137
138 TEXINFO_ALL_MENUS_UPDATE_EL ='\
139   (let ((error nil)\
140         (version-control nil))\
141       (load-library "texinfo")\
142       (texinfo-mode)\
143       (texinfo-all-menus-update)\
144       (if (buffer-modified-p (current-buffer))\
145         (save-buffer))))\
146 '
147
148 # buffer-modified-p is ALWAYS true, even if there were no actual
149 # changes, so we try setting origal (timestamp) back if there
150 # were no changes.
151 #
152 # ugh: emacs20.7 batch mode is not really batch:
153 #
154 # answer `echo q' to the question:
155 # FILE locked by EMAIL (pid PID): (s, q, p, ?)?
156 #
157 texinfo-all-menus-update:
158         -$(foreach i, $(TEXINFO_SOURCES), echo q | emacs --batch --no-site-file $(i) --eval $(TEXINFO_ALL_MENUS_UPDATE_EL); )
159         $(foreach i, $(sort $(TEXINFO_SOURCES)), if diff -u $(i)~ $(i); then mv $(i)~ $(i);  fi && ) true
160
161 local-help: local-texinfo-help
162
163 local-texinfo-help:
164         @echo -e "\
165   info [out=www]  update Info documentation (use \`out=www' for having images)\n\
166   install-info [out=www]   install Info documentation (idem)\n\
167   texinfo-all-menus-update update node menus in Texinfo source files (use with caution)\n"
168