Backport from trunk.
[bpt/emacs.git] / Makefile.in
index 20d680e..78630ef 100644 (file)
@@ -259,8 +259,9 @@ GZIP_INFO = @GZIP_INFO@
 TRANSFORM = @program_transform_name@
 
 # What emacs should be called when installed.
-EMACS = `echo emacs${EXEEXT} | sed '$(TRANSFORM)'`
-EMACSFULL = `echo emacs-${version}${EXEEXT} | sed '$(TRANSFORM)'`
+EMACS_NAME = `echo emacs | sed '$(TRANSFORM)'`
+EMACS = ${EMACS_NAME}${EXEEXT}
+EMACSFULL = `echo emacs-${version} | sed '$(TRANSFORM)'`${EXEEXT}
 
 # Subdirectories to make recursively.
 SUBDIR = lib lib-src src lisp leim
@@ -633,12 +634,12 @@ install-man:
 ## Install those items from etc/ that need to end up elsewhere.
 install-etc:
        umask 022; ${MKDIR_P} $(DESTDIR)${desktopdir}
-       dest=`echo emacs | sed '$(TRANSFORM)'`; \
        tmp=etc/emacs.tmpdesktop; rm -f $${tmp}; \
-       sed -e "/^Exec=emacs/ s/emacs/$${dest}/" \
-         -e "/^Icon=emacs/ s/emacs/$${dest}/" \
+       emacs_name=`echo emacs | sed '$(TRANSFORM)'`; \
+       sed -e "/^Exec=emacs/ s/emacs/$${emacs_name}/" \
+         -e "/^Icon=emacs/ s/emacs/$${emacs_name}/" \
          ${srcdir}/etc/emacs.desktop > $${tmp}; \
-       ${INSTALL_DATA} $${tmp} $(DESTDIR)${desktopdir}/$${dest}.desktop; \
+       ${INSTALL_DATA} $${tmp} $(DESTDIR)${desktopdir}/${EMACS_NAME}.desktop; \
        rm -f $${tmp}
        thisdir=`/bin/pwd`; \
        cd ${iconsrcdir} || exit 1; umask 022 ; \
@@ -685,21 +686,28 @@ uninstall:
        -rm -rf $(DESTDIR)${libexecdir}/emacs/${version}
        thisdir=`/bin/pwd`; \
        (info_misc=`cd doc/misc; ${MAKE} echo-info | sed '/ing directory/d'`; \
-         cd $(DESTDIR)${infodir} && \
-         for elt in ${INFO_NONMISC} $${info_misc}; do \
-           (cd $${thisdir}; \
-            $(INSTALL_INFO) --remove --info-dir=$(DESTDIR)${infodir} $(DESTDIR)${infodir}/$$elt); \
-           if [ -n "${GZIP_INFO}" ] && [ -n "${GZIP_PROG}" ]; then \
-              ext=.gz; else ext=; fi; \
-           rm -f $$elt$$ext $$elt-[1-9]$$ext $$elt-[1-9][0-9]$$ext; \
-         done;)
+        if cd $(DESTDIR)${infodir}; then \
+          for elt in ${INFO_NONMISC} $${info_misc}; do \
+            (cd $${thisdir}; \
+             $(INSTALL_INFO) --remove --info-dir=$(DESTDIR)${infodir} $(DESTDIR)${infodir}/$$elt); \
+            if [ -n "${GZIP_INFO}" ] && [ -n "${GZIP_PROG}" ]; then \
+               ext=.gz; else ext=; fi; \
+            rm -f $$elt$$ext $$elt-[1-9]$$ext $$elt-[1-9][0-9]$$ext; \
+          done; \
+        fi)
        (if [ -n "${GZIP_INFO}" ] && [ -n "${GZIP_PROG}" ]; then \
            ext=.gz; else ext=; fi; \
-        cd ${mansrcdir} && for page in *.1; do \
-          rm -f $(DESTDIR)${man1dir}/$$page$$ext; done )
-       (cd $(DESTDIR)${bindir}  && rm -f $(EMACSFULL) $(EMACS))
-       (cd $(DESTDIR)${icondir} && rm -f hicolor/*x*/apps/emacs.png hicolor/*x*/apps/emacs22.png hicolor/scalable/apps/emacs.svg hicolor/scalable/mimetypes/emacs-document.svg )
-       -rm -f $(DESTDIR)${desktopdir}/emacs.desktop
+        if cd ${mansrcdir}; then \
+          for page in *.1; do \
+            rm -f $(DESTDIR)${man1dir}/`echo "$${page}" | sed -e 's/\.1$$//' -e '$(TRANSFORM)'`.1$$ext; done; \
+        fi)
+       (cd $(DESTDIR)${bindir} && rm -f $(EMACSFULL) $(EMACS) || true)
+       (if cd $(DESTDIR)${icondir}; then \
+          rm -f hicolor/*x*/apps/${EMACS_NAME}.png \
+            hicolor/scalable/apps/${EMACS_NAME}.svg \
+            hicolor/scalable/mimetypes/`echo emacs-document | sed '$(TRANSFORM)'`.svg; \
+       fi)
+       -rm -f $(DESTDIR)${desktopdir}/${EMACS_NAME}.desktop
        for file in snake-scores tetris-scores; do \
          file=$(DESTDIR)${gamedir}/$${file}; \
          [ -s $${file} ] || rm -f $$file; \