]> git.donarmstrong.com Git - lilypond.git/blob - stepmake/stepmake/texinfo-targets.make
Fix "make uninstall"
[lilypond.git] / stepmake / stepmake / texinfo-targets.make
1 .PHONY : texinfo-all-menus-update
2
3 default: $(INFO_FILES)
4
5 local-WWW: $(addprefix $(outdir)/,$(TEXI_FILES:.texi=.html))
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 local-install-info: info
35         -$(INSTALL) -d $(DESTDIR)$(infodir)
36 ifneq ($(patsubst %/local,%,$(DESTDIR)$(prefix)),/usr)
37 ## Can not have absolute symlinks because some binary packages build schemes
38 ## install files in nonstandard root.  Best we can do is to notify the
39 ## builder or packager.
40         @echo
41         @echo "***************************************************************"
42         @echo "Please add or update the LilyPond direntries, do"
43         @echo
44         @echo "    install-info --info-dir=$(infodir) $(outdir)/$(MAIN_INFO_DOC).info"
45         @echo
46         @echo "For images in the INFO docs to work, do: "
47         @echo
48         @echo "    (cd $(infodir) && ln -sfT ../doc/lilypond/html/$(DEST_INFO_IMAGES_SUBDIR) $(INFO_IMAGES_DIR))"
49         @echo "or add something like that to the postinstall script."
50         @echo
51 else # installing directly into standard /usr/...
52         -$(INSTALL) -d $(DESTDIR)$(infodir)
53         $(foreach f,$(INFO_FILES),install-info --remove --info-dir=$(infodir) $(f) ; )true
54         install-info --info-dir=$(infodir) $(outdir)/$(MAIN_INFO_DOC).info
55         cd $(infodir) && ln -sfT $(webdir)/$(DEST_INFO_IMAGES_SUBDIR) $(INFO_IMAGES_DIR)
56 endif # installing directly into standard /usr/...
57
58 local-uninstall-WWW:
59         rm -f $(infodir)/$(INFO_IMAGES_DIR)
60
61 else # out!=www
62
63 ifneq ($(patsubst %/local,%,$(DESTDIR)$(prefix)),/usr)
64 ## Can not have absolute symlinks because some binary packages build schemes
65 ## install files in nonstandard root.  Best we can do is to notify the
66 ## builder or packager.
67 local-install-info: info
68         -$(INSTALL) -d $(DESTDIR)$(package_infodir)
69         @echo
70         @echo "***************************************************************"
71         @echo "Please add or update the LilyPond direntries, do"
72         @echo
73         @echo "    install-info --info-dir=$(infodir) out/$(MAIN_INFO_DOC).info"
74         @echo
75         @echo "For images in the INFO docs to work, do"
76         @echo
77         @echo "    make out=www install-info "
78         @echo
79         @echo "and read the extra instructions."
80         @echo
81
82 local-uninstall-info:
83         -rmdir $(DESTDIR)$(package_infodir)
84
85 else # installing directly into standard /usr/...
86 local-install-info: info
87         -$(INSTALL) -d $(DESTDIR)$(package_infodir)
88         -$(INSTALL) -d $(DESTDIR)$(infodir)
89         $(foreach f,$(INFO_FILES),install-info --remove --info-dir=$(infodir) $(f) ; )true
90         install-info --info-dir=$(infodir) $(outdir)/$(MAIN_INFO_DOC).info
91         @echo
92         @echo "***************************************************************"
93         @echo "For images in the INFO docs to work, do"
94         @echo
95         @echo "    make out=www install-info "
96         @echo
97
98 local-uninstall-info:
99         $(foreach f,$(INFO_FILES),install-info --remove --info-dir=$(infodir) $(f) ; )true
100         -rmdir $(DESTDIR)$(infodir)
101         -rmdir $(DESTDIR)$(package_infodir)
102
103 endif # installing into standard /usr/* root
104
105 endif # out!=www
106
107 endif # $(INFO_FILES) non empty
108
109 TEXINFO_ALL_MENUS_UPDATE_EL ='\
110   (let ((error nil)\
111         (version-control nil))\
112       (load-library "texinfo")\
113       (texinfo-mode)\
114       (texinfo-all-menus-update)\
115       (if (buffer-modified-p (current-buffer))\
116         (save-buffer))))\
117 '
118
119 # buffer-modified-p is ALWAYS true, even if there were no actual
120 # changes, so we try setting origal (timestamp) back if there
121 # were no changes.
122 #
123 # ugh: emacs20.7 batch mode is not really batch:
124 #
125 # answer `echo q' to the question:
126 # FILE locked by EMAIL (pid PID): (s, q, p, ?)?
127 #
128 texinfo-all-menus-update:
129         -$(foreach i, $(TEXINFO_SOURCES), echo q | emacs --batch --no-site-file $(i) --eval $(TEXINFO_ALL_MENUS_UPDATE_EL); )
130         $(foreach i, $(sort $(TEXINFO_SOURCES)), if diff -u $(i)~ $(i); then mv $(i)~ $(i);  fi && ) true
131
132 local-help: local-texinfo-help
133
134 local-texinfo-help:
135         @echo -e "\
136   info [out=www]  update Info documentation (use \`out=www' for having images)\n\
137   install-info [out=www]   install Info documentation (idem)\n\
138   texinfo-all-menus-update update node menus in Texinfo source files (use with caution)\n"
139