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