Merge from emacs-23
[bpt/emacs.git] / lisp / Makefile.in
index fd87b12..7c42d1a 100644 (file)
@@ -1,6 +1,6 @@
 # Maintenance productions for the Lisp directory
 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
-#   2009  Free Software Foundation, Inc.
+#   2009, 2010  Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
 
 SHELL = /bin/sh
 
-lisp=@srcdir@
-VPATH=@srcdir@
-srcdir=@srcdir@/..
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+abs_top_builddir = @abs_top_builddir@
+lisp = $(srcdir)
+VPATH = $(srcdir)
 
 # You can specify a different executable on the make command line,
 # e.g. "make EMACS=../src/emacs ...".
 
-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
 
-# Command line flags for Emacs.  This must include --multibyte,
-# otherwise some files will not compile.
+# Command line flags for Emacs.
 
-EMACSOPT = -batch --no-site-file --multibyte
+EMACSOPT = -batch --no-site-file
 
 # Extra flags to pass to the byte compiler
 BYTE_COMPILE_EXTRA_FLAGS =
@@ -52,7 +56,8 @@ ETAGS = ../lib-src/etags
 LOADDEFS = $(lisp)/calendar/cal-loaddefs.el \
        $(lisp)/calendar/diary-loaddefs.el \
        $(lisp)/calendar/hol-loaddefs.el \
-       $(lisp)/mh-e/mh-loaddefs.el
+       $(lisp)/mh-e/mh-loaddefs.el \
+       $(lisp)/net/tramp-loaddefs.el
 
 # Elisp files auto-generated.
 AUTOGENEL = loaddefs.el \
@@ -79,29 +84,26 @@ COMPILE_FIRST = \
 emacs = EMACSLOADPATH=$(lisp) LC_ALL=C $(EMACS) $(EMACSOPT)
 
 # Common command to find subdirectories
-
-setwins=subdirs=`(cd $$wd; find . -type d -print)`; \
+setwins=subdirs=`(find . -type d -print)`; \
        for file in $$subdirs; do \
-          case $$file in */Old | */RCS | */CVS | */CVS/* | */.* | */.*/* | */=* ) ;; \
-               *) wins="$$wins $$wd/$$file" ;; \
+          case $$file in */.* | */.*/* | */=* ) ;; \
+               *) wins="$$wins $$file" ;; \
           esac; \
         done
 
 # Find all subdirectories except `obsolete' and `term'.
-
-setwins_almost=subdirs=`(cd $$wd; find . -type d -print)`; \
+setwins_almost=subdirs=`(find . -type d -print)`; \
        for file in $$subdirs; do \
-          case $$file in */Old | */RCS | */CVS | */CVS/* | */.* | */.*/* | */=* | */obsolete | */term ) ;; \
-               *) wins="$$wins $$wd/$$file" ;; \
+          case $$file in */.* | */.*/* | */=* | */obsolete | */term ) ;; \
+               *) wins="$$wins $$file" ;; \
           esac; \
         done
 
 # Find all subdirectories in which we might want to create subdirs.el
-
-setwins_for_subdirs=subdirs=`(cd $$wd; find . -type d -print)`; \
+setwins_for_subdirs=subdirs=`(find . -type d -print)`; \
        for file in $$subdirs; do \
-          case $$file in */Old | */RCS | */CVS | */CVS/* | */.* | */.*/* | */=* | */cedet* ) ;; \
-               *) wins="$$wins $$wd/$$file" ;; \
+          case $$file in */.* | */.*/* | */=* | */cedet* ) ;; \
+               *) wins="$$wins $$file" ;; \
           esac; \
         done
 
@@ -109,7 +111,7 @@ setwins_for_subdirs=subdirs=`(cd $$wd; find . -type d -print)`; \
 # with "make -j" and results in more deterministic compilation warnings.
 # cus-load and finder-inf are not explicitly requested by anything, so
 # we add them here to make sure they get built.
-all: compile-main $(lisp)/cus-load.el $(lisp)/finder-inf.el compile-clean
+all: compile-main $(lisp)/cus-load.el $(lisp)/finder-inf.el
 
 doit:
 
@@ -130,14 +132,14 @@ doit:
 $(lisp)/cus-load.el:
        $(MAKE) $(MFLAGS) custom-deps
 custom-deps: doit
-       wd=$(lisp); $(setwins_almost); \
+       cd $(lisp); $(setwins_almost); \
        echo Directories: $$wins; \
        $(emacs) -l cus-dep --eval '(setq generated-custom-dependencies-file "$(lisp)/cus-load.el")' -f custom-make-dependencies $$wins
 
 $(lisp)/finder-inf.el:
        $(MAKE) $(MFLAGS) finder-data
 finder-data: doit
-       wd=$(lisp); $(setwins_almost); \
+       cd $(lisp); $(setwins_almost); \
        echo Directories: $$wins; \
        $(emacs) -l finder --eval '(setq generated-finder-keywords-file "$(lisp)/finder-inf.el")' -f finder-compile-keywords-make-dist $$wins
 
@@ -146,8 +148,8 @@ finder-data: doit
 autoloads: $(LOADDEFS) doit
        chmod +w $(lisp)/ps-print.el $(lisp)/emulation/tpu-edt.el \
          $(lisp)/emacs-lisp/cl-loaddefs.el $(lisp)/mail/rmail.el \
-         $(lisp)/dired.el $(lisp)/ibuffer.el
-       wd=$(lisp); $(setwins_almost); \
+         $(lisp)/dired.el $(lisp)/ibuffer.el $(lisp)/htmlfontify.el
+       cd $(lisp); $(setwins_almost); \
        echo Directories: $$wins; \
        $(emacs) -l autoload --eval '(setq generated-autoload-file "$(lisp)/loaddefs.el")' -f batch-update-autoloads $$wins
 
@@ -156,25 +158,29 @@ autoloads: $(LOADDEFS) doit
 $(lisp)/subdirs.el:
        $(MAKE) $(MFLAGS) update-subdirs
 update-subdirs: doit
-       wd=$(lisp); $(setwins_for_subdirs); \
+       cd $(lisp); $(setwins_for_subdirs); \
        for file in $$wins; do \
-          $(srcdir)/update-subdirs $$file; \
+          $(top_srcdir)/update-subdirs $$file; \
        done;
 
 updates: update-subdirs autoloads finder-data custom-deps
 
-# This is useful after "cvs up".
-cvs-update: recompile autoloads finder-data custom-deps
+# This is useful after "bzr up".
+bzr-update: recompile autoloads finder-data custom-deps
+
+# For backwards compatibility:
+cvs-update: bzr-update
 
 # Update the AUTHORS file.
 
 update-authors:
-       $(emacs) -l authors -f batch-update-authors $(srcdir)/etc/AUTHORS $(srcdir)
+       $(emacs) -l authors -f batch-update-authors $(top_srcdir)/etc/AUTHORS $(top_srcdir)
 
 TAGS TAGS-LISP: $(lisptagsfiles1) $(lisptagsfiles2) $(lisptagsfiles3) $(lisptagsfiles4)
        els=`echo $(lisptagsfiles1) $(lisptagsfiles2) $(lisptagsfiles3) $(lisptagsfiles4) | sed -e "s,$(lisp)/[^ ]*loaddefs[^ ]*,," -e "s,$(lisp)/ldefs-boot[^ ]*,,"`; \
        ${ETAGS} -o $@ $$els
 
+       $(lisp)/emacs-lisp/smie.elc \
 # The src/Makefile.in has its own set of dependencies and when they decide
 # that one Lisp file needs to be re-compiled, we had better recompile it as
 # well, otherwise every subsequent make will again call us, until we finally
@@ -207,30 +213,44 @@ compile-onefile:
        @echo Compiling $<
        @$(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $<
 
-.PHONY: compile-first compile-main compile compile-always compile-elcfiles
+.PHONY: compile-first compile-main compile compile-always
 
 compile-first: $(COMPILE_FIRST)
 
-# ELCFILES is set dynamically in the recursive call from `compile-main'.
-compile-elcfiles: $(ELCFILES)
+# In `compile-main' we could directly do
+#    ... | xargs $(MAKE) $(MFLAGS) EMACS="$(EMACS)"
+# and it works, but it generates a lot of messages like
+#    make[2]: « gnus/gnus-mlspl.elc » is up to date.
+# so instead, we use "xargs echo" to split the list of file into manageable
+# chunks and then use an intermediate `compile-targets' target so the
+# actual targets (the .elc files) are not mentioned as targets on the
+# make command line.
+
+
+.PHONY: compile-targets
+# TARGETS is set dynamically in the recursive call from `compile-main'.
+compile-targets: $(TARGETS)
 
 # Compile all the Elisp files that need it.  Beware: it approximates
 # `no-byte-compile', so watch out for false-positives!
-compile-main:
-       @wd=$(lisp); $(setwins); \
+compile-main: compile-clean
+       @(cd $(lisp); $(setwins); \
        els=`echo "$$wins " | sed -e 's|/\./|/|g' -e 's|/\. | |g' -e 's| |/*.el |g'`; \
        for el in $$els; do \
          test -f $$el || continue; \
          test ! -f $${el}c && GREP_OPTIONS= grep '^;.*no-byte-compile: t' $$el > /dev/null && continue; \
-         files="$$files $${el}c"; \
-       done; \
-       $(MAKE) $(MFLAGS) compile-elcfiles EMACS=$(EMACS) ELCFILES="$$files"
+         echo "$${el}c"; \
+       done | xargs echo) | \
+       while read chunk; do \
+         $(MAKE) $(MFLAGS) compile-targets EMACS="$(EMACS)" TARGETS="$$chunk"; \
+       done
 
+.PHONY: compile-clean
 # Erase left-over .elc files that do not have a corresponding .el file.
 compile-clean:
-       @wd=$(lisp); $(setwins); \
+       @cd $(lisp); $(setwins); \
        elcs=`echo "$$wins " | sed -e 's|/\./|/|g' -e 's|/\. | |g' -e 's| |/*.elc |g'`; \
-       for el in $$(echo $$elcs | sed -e 's/\.elc/\.el/g'); do \
+       for el in `echo $$elcs | sed -e 's/\.elc/\.el/g'`; do \
          if test -f "$$el" -o \! -f "$${el}c"; then :; else \
            echo rm "$${el}c"; \
            rm "$${el}c"; \
@@ -243,12 +263,9 @@ compile-clean:
 # Calling make recursively because suffix rule cannot have prerequisites.
 # Explicitly pass EMACS (sometimes ../src/bootstrap-emacs) to those
 # sub-makes that run rules that use it, for the sake of some non-GNU makes.
-compile: $(LOADDEFS) autoloads compile-first compile-clean
+compile: $(LOADDEFS) autoloads compile-first
        $(MAKE) $(MFLAGS) compile-main EMACS=$(EMACS)
 
-## Doing this causes make install to dump another emacs.
-#      $(MAKE) $(MFLAGS) update-elclist
-
 # Compile all Lisp files.  This is like `compile' but compiles files
 # unconditionally.  Some files don't actually get compiled because they
 # set the local variable no-byte-compile.
@@ -256,6 +273,12 @@ compile-always: doit
        cd $(lisp); rm -f *.elc */*.elc */*/*.elc */*/*/*.elc
        $(MAKE) $(MFLAGS) compile EMACS=$(EMACS)
 
+compile-calc:
+       for el in $(lisp)/calc/*.el; do \
+         echo Compiling $$el; \
+         $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $$el || exit 1; \
+       done
+
 # Backup compiled Lisp files in elc.tar.gz.  If that file already
 # exists, make a backup of it.
 
@@ -269,8 +292,7 @@ compile-after-backup: backup-compiled-files compile-always
 
 # Recompile all Lisp files which are newer than their .elc files and compile
 # new ones.
-# This has the same effect as compile-main (followed up with compile-last,
-# if ELCFILES is out of date).  recompile has some advantages:
+# This has the same effect as compile-main.  recompile has some advantages:
 # i) It is faster (on a single processor), since it only has to start
 # Emacs once.  It was 33% faster on a test with a random 10% of the .el
 # files needing recompilation.
@@ -309,6 +331,24 @@ $(MH_E_DIR)/mh-loaddefs.el: $(MH_E_SRC)
           --eval "(setq make-backup-files nil)" \
           -f batch-update-autoloads $(MH_E_DIR)
 
+# Update TRAMP internal autoloads. Maybe we could move trmp*.el into
+# an own subdirectory. OTOH, it does not hurt to keep them in
+# lisp/net.
+TRAMP_DIR = $(lisp)/net
+TRAMP_SRC = $(TRAMP_DIR)/tramp.el  $(TRAMP_DIR)/tramp-cache.el  \
+       $(TRAMP_DIR)/tramp-cmds.el $(TRAMP_DIR)/tramp-compat.el \
+       $(TRAMP_DIR)/tramp-ftp.el  $(TRAMP_DIR)/tramp-gvfs.el   \
+       $(TRAMP_DIR)/tramp-gw.el   $(TRAMP_DIR)/tramp-imap.el   \
+       $(TRAMP_DIR)/tramp-sh.el   $(TRAMP_DIR)/tramp-smb.el    \
+       $(TRAMP_DIR)/tramp-uu.el   $(TRAMP_DIR)/trampver.el
+
+$(TRAMP_DIR)/tramp-loaddefs.el: $(TRAMP_SRC)
+       $(emacs) -l autoload \
+          --eval "(setq generate-autoload-cookie \";;;###tramp-autoload\")" \
+          --eval "(setq generated-autoload-file \"$@\")" \
+          --eval "(setq make-backup-files nil)" \
+          -f batch-update-autoloads $(TRAMP_DIR)
+
 CAL_DIR = $(lisp)/calendar
 ## Those files that may contain internal calendar autoload cookies.
 ## Avoids circular dependency warning for *-loaddefs.el.