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