Unset EMACSLOADPATH in some Makefiles rather than setting it to the default
[bpt/emacs.git] / lisp / Makefile.in
index be7a413..7b0206a 100644 (file)
 SHELL = @SHELL@
 
 srcdir = @srcdir@
-abs_srcdir = @abs_srcdir@
 top_srcdir = @top_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_lisp = $(abs_srcdir)
 lisp = $(srcdir)
 VPATH = $(srcdir)
 
@@ -34,10 +31,10 @@ XARGS_LIMIT = @XARGS_LIMIT@
 # You can specify a different executable on the make command line,
 # e.g. "make EMACS=../src/emacs ...".
 
-# We sometimes change directory before running Emacs (typically when
-# building out-of-tree, we chdir to the source directory), so we need
-# to use an absolute file name.
-EMACS = ${abs_top_builddir}/src/emacs
+# We never change directory before running Emacs, so a relative file
+# name is fine, and makes life easier.  If we need to change
+# directory, we can use emacs --chdir.
+EMACS = ../src/emacs
 
 # Command line flags for Emacs.
 
@@ -108,8 +105,8 @@ COMPILE_FIRST = \
        $(lisp)/emacs-lisp/autoload.elc
 
 # The actual Emacs command run in the targets below.
-
-emacs = EMACSLOADPATH="$(abs_lisp)" LC_ALL=C "$(EMACS)" $(EMACSOPT)
+# Prevent any setting of EMACSLOADPATH in user environment causing problems.
+emacs = unset EMACSLOADPATH; LC_ALL=C "$(EMACS)" $(EMACSOPT)
 
 # Common command to find subdirectories
 setwins=subdirs=`find . -type d -print`; \
@@ -160,25 +157,26 @@ doit:
 $(lisp)/cus-load.el:
        $(MAKE) $(MFLAGS) custom-deps
 custom-deps: doit
-       cd $(lisp) && $(setwins_almost); \
+       thisdir=`pwd`; cd $(lisp) && $(setwins_almost); cd "$$thisdir"; \
        echo Directories: $$wins; \
-       $(emacs) -l cus-dep -f custom-make-dependencies $$wins
+       $(emacs) --chdir $(lisp) -l cus-dep -f custom-make-dependencies $$wins
 
 $(lisp)/finder-inf.el:
        $(MAKE) $(MFLAGS) finder-data
 finder-data: doit
-       cd $(lisp) && $(setwins_almost); \
+       thisdir=`pwd`; cd $(lisp) && $(setwins_almost); cd "$$thisdir"; \
        echo Directories: $$wins; \
-       $(emacs) -l finder -f finder-compile-keywords-make-dist $$wins
+       $(emacs) --chdir $(lisp) -l finder \
+         -f finder-compile-keywords-make-dist $$wins
 
 # The chmod +w is to handle env var CVSREAD=1.
-# Use expand-file-name rather than $abs_lisp so that Emacs does not
+# Use expand-file-name rather than $abs_scrdir so that Emacs does not
 # get confused when it compares file-names for equality.
 autoloads: $(LOADDEFS) doit
        cd $(lisp) && chmod +w $(AUTOGEN_VCS)
-       cd $(lisp) && $(setwins_almost); \
+       thisdir=`pwd`; cd $(lisp) && $(setwins_almost); cd "$$thisdir"; \
        echo Directories: $$wins; \
-       $(emacs) -l autoload \
+       $(emacs) --chdir $(lisp) -l autoload \
            --eval '(setq autoload-builtin-package-versions t)' \
            --eval '(setq generated-autoload-file (expand-file-name "loaddefs.el"))' \
            -f batch-update-autoloads $$wins
@@ -214,25 +212,23 @@ update-authors:
 
 ETAGS = ../lib-src/etags
 
-## NB We use absolute filenames because ../src/Makefile calls this via
-## make -f ../lisp/Makefile.
-## FIXME?  Can etags work ok with relative filenames?
-lisptagsfiles1 = $(abs_srcdir)/*.el
-lisptagsfiles2 = $(abs_srcdir)/*/*.el
-lisptagsfiles3 = $(abs_srcdir)/*/*/*.el
-lisptagsfiles4 = $(abs_srcdir)/*/*/*/*.el
-
-## Apparently the echo | sed | xargs is to stop the command line
-## getting too long on MS Windows.  It will make no difference on
-## POSIX systems, where the shell does the globbing right away, before
-## passing the expanded arguments to echo.
-TAGS TAGS-LISP: $(lisptagsfiles1) $(lisptagsfiles2) $(lisptagsfiles3) $(lisptagsfiles4)
+lisptagsfiles1 = $(srcdir)/*.el
+lisptagsfiles2 = $(srcdir)/*/*.el
+lisptagsfiles3 = $(srcdir)/*/*/*.el
+lisptagsfiles4 = $(srcdir)/*/*/*/*.el
+
+## The echo | sed | xargs is to stop the command line getting too long
+## on MS Windows, when the MSYS Bash passes it to a MinGW compiled
+## etags.  It might be better to use find in a similar way to
+## compile-main.  But maybe this is not even necessary any more now
+## that this uses relative filenames.
+TAGS: $(lisptagsfiles1) $(lisptagsfiles2) $(lisptagsfiles3) $(lisptagsfiles4)
        rm -f $@
        touch $@
        echo $(lisptagsfiles1) $(lisptagsfiles2) $(lisptagsfiles3) $(lisptagsfiles4) | \
-         sed -e 's,$(abs_srcdir)/[^ ]*loaddefs[^ ]*,,g' \
-           -e 's,$(abs_srcdir)/ldefs-boot[^ ]*,,' \
-           -e 's,$(abs_srcdir)/[^ ]*esh-groups.el[^ ]*,,' | \
+         sed -e 's,$(srcdir)/[^ ]*loaddefs[^ ]*,,g' \
+           -e 's,$(srcdir)/ldefs-boot[^ ]*,,' \
+           -e 's,$(srcdir)/[^ ]*esh-groups.el[^ ]*,,' | \
            xargs $(XARGS_LIMIT) "$(ETAGS)" -a -o $@
 
 
@@ -458,7 +454,7 @@ distclean:
        -rm -f ./Makefile $(lisp)/loaddefs.el~
 
 maintainer-clean: distclean bootstrap-clean
-       rm -f TAGS TAGS-LISP
+       rm -f TAGS
 
 .PHONY: check-declare