Subject: bug#8302: 23.3; Parallel make: some *.el files are byte-compiled twice

From: Ulrich Mueller <[email-masked]>
Date: Sun, 20 Mar 2011 21:26:48 +0100

Tags: patch

With parallel make (-j3), some elisp files, for example lisp/select.el
and lisp/scroll-bar.el, are byte-compiled twice. From the build log:

   Compiling /var/tmp/portage/app-editors/emacs-23.3/work/emacs-23.3/src/../lisp/select.el
   [...]
   Wrote /var/tmp/portage/app-editors/emacs-23.3/work/emacs-23.3/lisp/select.elc
   [...]
   Compiling ../lisp/select.el
   [...]
   Wrote /var/tmp/portage/app-editors/emacs-23.3/work/emacs-23.3/lisp/select.elc

The reason seems to be that select.elc occurs twice in
src/Makefile.in: in variable "lisp" as $(lispsource)select.elc and in
variable "SOME_MACHINE_LISP" as ../lisp/select.elc, so that make
doesn't recognise them as identical targets.

Attached patch makes the problem go away for me. My humble solution is
to change SOME_MACHINE_LISP to use $(lispsource), and introduce a new
variable SOME_MACHINE_SHORTLISP for the ../lisp/ entries. (Quite the
same as for the lisp and shortlisp variables).

As a side remark, mouse.elc is listed twice in the variable
assignment. Attached patch fixes this too.

--- emacs-23.3-orig/src/Makefile.in
+++ emacs-23.3/src/Makefile.in
@@ -887,9 +887,26 @@
 	../lisp/window.elc \
 	../lisp/version.el
 
+SOME_MACHINE_LISP = $(lispsource)mouse.elc \
+  $(lispsource)select.elc $(lispsource)scroll-bar.elc \
+  $(lispsource)ls-lisp.elc $(lispsource)dos-fns.elc \
+  $(lispsource)w32-fns.elc $(lispsource)dos-w32.elc \
+  $(lispsource)disp-table.elc $(lispsource)dos-vars.elc \
+  $(lispsource)tooltip.elc $(lispsource)image.elc \
+  $(lispsource)fringe.elc $(lispsource)dnd.elc \
+  $(lispsource)mwheel.elc $(lispsource)tool-bar.elc \
+  $(lispsource)x-dnd.elc $(lispsource)font-setting.elc \
+  $(lispsource)international/ccl.elc \
+  $(lispsource)international/fontset.elc \
+  $(lispsource)term/common-win.elc \
+  $(lispsource)term/x-win.elc \
+  $(lispsource)term/pc-win.elc $(lispsource)term/internal.elc \
+  $(lispsource)term/ns-win.elc $(lispsource)term/w32-win.elc \
+  $(lispsource)emacs-lisp/easymenu.elc
+
 /* Like $shortlisp, but includes only those files from $lisp that are loaded
    conditionally (i.e., only on some platforms).  */
-SOME_MACHINE_LISP = ../lisp/mouse.elc \
+SOME_MACHINE_SHORTLISP = ../lisp/mouse.elc \
   ../lisp/select.elc ../lisp/scroll-bar.elc \
   ../lisp/ls-lisp.elc ../lisp/dos-fns.elc \
   ../lisp/w32-fns.elc ../lisp/dos-w32.elc \
@@ -900,7 +917,6 @@
   ../lisp/x-dnd.elc ../lisp/font-setting.elc \
   ../lisp/international/ccl.elc \
   ../lisp/international/fontset.elc \
-  ../lisp/mouse.elc \
   ../lisp/term/common-win.elc \
   ../lisp/term/x-win.elc \
   ../lisp/term/pc-win.elc ../lisp/term/internal.elc \
@@ -955,7 +971,7 @@
 ${etc}DOC: ${libsrc}make-docfile${EXEEXT} ${obj} ${lisp} ${SOME_MACHINE_LISP}
 	-rm -f ${etc}DOC
 	${libsrc}make-docfile -d ${srcdir} ${SOME_MACHINE_OBJECTS} ${obj} > ${etc}DOC
-	${libsrc}make-docfile -a ${etc}DOC -d ${srcdir} ${SOME_MACHINE_LISP} ${shortlisp}
+	${libsrc}make-docfile -a ${etc}DOC -d ${srcdir} ${SOME_MACHINE_SHORTLISP} ${shortlisp}
 
 ${libsrc}make-docfile${EXEEXT}:
 	cd ${libsrc}; ${MAKE} ${MFLAGS} make-docfile${EXEEXT}