* Makefile.in (install-arch-indep): Combine adjacent loops.
[bpt/emacs.git] / Makefile.in
index d409bce..4398fe5 100644 (file)
@@ -446,25 +446,25 @@ $(srcdir)/src/stamp-h.in: $(AUTOCONF_INPUTS)
 
 .PHONY: install mkdir
 
-## We delete each directory in ${COPYDESTS} before we copy into it;
-## that way, we can reinstall over directories that have been put in
-## place with their files read-only (perhaps because they are checked
-## into RCS).  In order to make this safe, we make sure that the
-## source exists and is distinct from the destination.
 ### We do install-arch-indep first because
 ### the executable needs the Lisp files and DOC file to work properly.
 install: all install-arch-indep install-arch-dep install-leim blessmail
        @true
 
 ## Ensure that $subdir contains a subdirs.el file.
+## Here and elsewhere, we set the umask so that any created files are
+## world-readable.
+## TODO it might be good to warn about non-standard permissions of
+## pre-existing directories, but that does not seem easy.
 write_subdir=if [ -f $${subdir}/subdirs.el ]; \
        then true; \
        else \
+         umask 022; \
+         ${MKDIR_P} $${subdir}; \
          (echo "(if (fboundp 'normal-top-level-add-subdirs-to-load-path)"; \
           echo "    (normal-top-level-add-subdirs-to-load-path))") \
            > $${subdir}/subdirs.el; \
-       fi; \
-       chmod a+r $${subdir}/subdirs.el
+       fi
 
 ### Install the executables that were compiled specifically for this machine.
 ### It would be nice to do something for a parallel make
@@ -484,7 +484,6 @@ install-arch-dep: mkdir
          ln $(DESTDIR)${bindir}/$(EMACSFULL) $(DESTDIR)${bindir}/$(EMACS) || true ; \
        else \
          subdir=${ns_appresdir}/site-lisp; \
-         ${MKDIR_P} $${subdir}; \
          ${write_subdir} || exit 1; \
          rm -rf ${ns_appresdir}/share; \
        fi
@@ -527,42 +526,40 @@ set_installuser=for installuser in $${LOGNAME} $${USERNAME} $${USER} \
 ## Note that the Makefiles in the etc directory are potentially useful
 ## in an installed Emacs, so should not be excluded.
 
+## We delete each directory in ${COPYDESTS} before we copy into it;
+## that way, we can reinstall over directories that have been put in
+## place with their files read-only (perhaps because they are checked
+## into RCS).  In order to make this safe, we make sure that the
+## source exists and is distinct from the destination.
 install-arch-indep: mkdir info install-etc
        -set ${COPYDESTS} ; \
        unset CDPATH; \
-       for dir in ${COPYDIR} ; do \
-         if [ `(cd $$1 && /bin/pwd)` != `(cd $${dir} && /bin/pwd)` ] ; then \
-           rm -rf $$1 ; \
-         fi ; \
-         shift ; \
-       done
-       -set ${COPYDESTS} ; \
-       mkdir ${COPYDESTS} ; \
-       chmod ugo+rx ${COPYDESTS} ; \
-       unset CDPATH; \
        $(set_installuser); \
        for dir in ${COPYDIR} ; do \
+         [ -d $${dir} ] || exit 1 ; \
          dest=$$1 ; shift ; \
-         [ -d $${dir} ] \
-         && [ `(cd $${dir} && /bin/pwd)` != `(cd $${dest} && /bin/pwd)` ] \
-         && (echo "Copying $${dir} to $${dest}..." ; \
-             (cd $${dir}; tar -chf - . ) \
-               | (cd $${dest}; umask 022; \
-                   tar -xvf - && cat > /dev/null) || exit 1; \
-             find $${dest} -exec chown $${installuser} {} ';' ;\
-             for subdir in `find $${dest} -type d -print` ; do \
-               chmod a+rx $${subdir} ; \
-               rm -f  $${subdir}/.gitignore ; \
-               rm -f  $${subdir}/.arch-inventory ; \
-               rm -f  $${subdir}/.DS_Store ; \
-               rm -f  $${subdir}/\#* ; \
-               rm -f  $${subdir}/.\#* ; \
-               rm -f  $${subdir}/*~ ; \
-               rm -f  $${subdir}/*.orig ; \
-               [ "$${dir}" != "${srcdir}/etc" ] && \
-                rm -f $${subdir}/[mM]akefile*[.-]in $${subdir}/[mM]akefile ; \
-               rm -f  $${subdir}/ChangeLog* ; \
-             done) ; \
+         [ `(cd $${dest} && /bin/pwd)` = `(cd $${dir} && /bin/pwd)` ] && \
+           continue ; \
+         rm -rf $${dest} ; \
+         umask 022; ${MKDIR_P} $${dest} ; \
+         (echo "Copying $${dir} to $${dest}..." ; \
+          (cd $${dir}; tar -chf - . ) \
+            | (cd $${dest}; umask 022; \
+               tar -xvf - && cat > /dev/null) || exit 1; \
+          find $${dest} -exec chown $${installuser} {} ';' ;\
+          for subdir in `find $${dest} -type d -print` ; do \
+            chmod a+rx $${subdir} ; \
+            rm -f  $${subdir}/.gitignore ; \
+            rm -f  $${subdir}/.arch-inventory ; \
+            rm -f  $${subdir}/.DS_Store ; \
+            rm -f  $${subdir}/\#* ; \
+            rm -f  $${subdir}/.\#* ; \
+            rm -f  $${subdir}/*~ ; \
+            rm -f  $${subdir}/*.orig ; \
+            [ "$${dir}" != "${srcdir}/etc" ] && \
+             rm -f $${subdir}/[mM]akefile*[.-]in $${subdir}/[mM]akefile ; \
+            rm -f  $${subdir}/ChangeLog* ; \
+          done) ; \
        done
        -rm -f $(DESTDIR)${lispdir}/subdirs.el
        $(srcdir)/update-subdirs $(DESTDIR)${lispdir}
@@ -637,15 +634,21 @@ install-arch-indep: mkdir info install-etc
        done
 
 ## Install those items from etc/ that need to end up elsewhere.
-install-etc: mkdir
+install-etc:
+       umask 022; ${MKDIR_P} $(DESTDIR)${desktopdir}
        ${INSTALL_DATA} ${srcdir}/etc/emacs.desktop \
          $(DESTDIR)${desktopdir}/emacs.desktop
-       for icon in $(iconsrcdir)/*/*/apps/*.* \
-         $(iconsrcdir)/*/*/mimetypes/*.*; do \
-         if [ -r $${icon} ]; then \
-           iicon=`echo "$${icon}" | sed 's,$(srcdir)/etc/images/icons,$(DESTDIR)${icondir},'` ; \
-           ${INSTALL_DATA} $${icon} $${iicon} ; \
-         fi ; \
+       thisdir=`/bin/pwd`; \
+       cd ${iconsrcdir} || exit 1; umask 022 ; \
+       for dir in */*/apps */*/mimetypes; do \
+         [ -d $${dir} ] || continue ; \
+         ( cd $${thisdir}; ${MKDIR_P} ${icondir}/$${dir} ) ; \
+         for icon in $${dir}/*.*; do \
+           [ -r $${icon} ] || continue ; \
+           ( cd $${thisdir}; \
+             ${INSTALL_DATA} ${iconsrcdir}/$${icon} ${icondir}/$${icon} ) \
+           || exit 1; \
+         done ; \
        done
 
 ### Install LEIM files.  Although they are machine-independent, we
@@ -659,26 +662,13 @@ install-leim: leim/Makefile mkdir
 install-strip:
        $(MAKE) $(MFLAGS) INSTALL_STRIP=-s install
 
-### Build all the directories we're going to install Emacs in.
-### We set the umask so that any created directories are world-readable.
-### FIXME it would be good to warn about non-standard permissions of
-### pre-existing directories, but that does not seem easy.
+### Build some of the directories we're going to install Emacs in.
 mkdir: FRC
-       icondirs= ; \
-       for dir in $(iconsrcdir)/*/*/apps $(iconsrcdir)/*/*/mimetypes; do \
-         if [ -d $${dir} ]; then \
-           icondirs="$${icondirs} $${dir}" ; \
-         fi ; \
-       done ; \
-       icondirs=`echo "$${icondirs}" | sed 's,$(srcdir)/etc/images/icons,$(DESTDIR)${icondir},g'` ; \
        umask 022 ; \
        $(MKDIR_P) $(DESTDIR)${datadir} ${COPYDESTS} \
          $(DESTDIR)${infodir} $(DESTDIR)${man1dir} \
          $(DESTDIR)${bindir} $(DESTDIR)${docdir} $(DESTDIR)${libexecdir} \
-         $(DESTDIR)${datadir}/emacs/site-lisp \
-         $(DESTDIR)${datadir}/emacs/${version}/site-lisp \
-         $(DESTDIR)`echo ${locallisppath} | sed 's,:, $(DESTDIR),g'` \
-         $(DESTDIR)${desktopdir} $${icondirs}
+         $(DESTDIR)`echo ${locallisppath} | sed 's,:, $(DESTDIR),g'`
 
 ### Delete all the installed files that the `install' target would
 ### create (but not the noninstalled files such as `make all' would create).