Merged from emacs@sv.gnu.org
[bpt/emacs.git] / nt / makefile.w32-in
index ab8940c..f579855 100644 (file)
@@ -1,24 +1,28 @@
-#  Makefile for GNU Emacs on the Microsoft W32 API.\r
-#  Copyright (c) 2000-2001 Free Software Foundation, Inc.\r
+#  -*- Makefile -*- for GNU Emacs on the Microsoft W32 API.\r
+#  Copyright (C) 2000, 2001, 2002, 2003, 2004,\r
+#    2005, 2006, 2007 Free Software Foundation, Inc.\r
 #\r
 #  Top level makefile for building GNU Emacs on Windows NT\r
 #\r
 #  This file is part of GNU Emacs.\r
-#  \r
+#\r
 #  GNU Emacs is free software; you can redistribute it and/or modify\r
 #  it under the terms of the GNU General Public License as published by\r
 #  the Free Software Foundation; either version 2, or (at your option)\r
 #  any later version.\r
-#  \r
+#\r
 #  GNU Emacs is distributed in the hope that it will be useful,\r
 #  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
 #  GNU General Public License for more details.\r
-#  \r
+#\r
 #  You should have received a copy of the GNU General Public License\r
 #  along with GNU Emacs; see the file COPYING.  If not, write to\r
-#  the Free Software Foundation, Inc., 59 Temple Place - Suite 330,\r
-#  Boston, MA 02111-1307, USA.\r
+#  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,\r
+#  Boston, MA 02110-1301, USA.\r
+\r
+# FIXME: This file uses DOS EOLs.  Convert to Unix after 22.1 is out\r
+#        (and remove or replace this comment).\r
 \r
 ALL            = addpm ddeclient runemacs cmdproxy addsection preprep\r
 \r
@@ -26,27 +30,29 @@ ALL         = addpm ddeclient runemacs cmdproxy addsection preprep
 \r
 TRES           = $(BLD)/emacs.res\r
 \r
-addpm:           $(BLD) $(BLD)/addpm.exe\r
+XMFLAGS                =\r
+\r
+addpm:           stamp_BLD $(BLD)/addpm.exe\r
 $(BLD)/addpm.exe: $(BLD)/addpm.$(O)\r
                  $(LINK) $(LINK_OUT)$@ \\r
                  $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32)\r
 \r
-ddeclient:       $(BLD) $(BLD)/ddeclient.exe\r
+ddeclient:       stamp_BLD $(BLD)/ddeclient.exe\r
 $(BLD)/ddeclient.exe: $(BLD)/ddeclient.$(O)\r
                  $(LINK) $(LINK_OUT)$@ \\r
                  $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32)\r
 \r
-cmdproxy:        $(BLD) $(BLD)/cmdproxy.exe\r
+cmdproxy:        stamp_BLD $(BLD)/cmdproxy.exe\r
 $(BLD)/cmdproxy.exe: $(BLD)/cmdproxy.$(O)\r
                  $(LINK) $(LINK_OUT)$@ \\r
                  $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(USER32)\r
 \r
-addsection:      $(BLD) $(BLD)/addsection.exe\r
+addsection:      stamp_BLD $(BLD)/addsection.exe\r
 $(BLD)/addsection.exe: $(BLD)/addsection.$(O)\r
                  $(LINK) $(LINK_OUT)$@ \\r
                  $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(USER32)\r
 \r
-preprep:         $(BLD) $(BLD)/preprep.exe\r
+preprep:         stamp_BLD $(BLD)/preprep.exe\r
 $(BLD)/preprep.exe: $(BLD)/preprep.$(O)\r
                  $(LINK) $(LINK_OUT)$@ \\r
                  $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS)\r
@@ -55,10 +61,10 @@ $(BLD)/preprep.exe: $(BLD)/preprep.$(O)
 # The resource file.  NT 3.10 requires the use of cvtres; even though\r
 # it is not necessary on later versions, it is still ok to use it.\r
 #\r
-$(TRES):       emacs.rc\r
-               $(RC) $(RC_OUT)$(BLD)/emacs.res $(ALL_DEPS)\r
+$(TRES):       emacs.rc stamp_BLD\r
+               $(RC) $(RC_OUT)$(BLD)/emacs.res emacs.rc\r
 \r
-runemacs:        $(BLD) $(BLD)/runemacs.exe\r
+runemacs:        stamp_BLD $(BLD)/runemacs.exe\r
 $(BLD)/runemacs.exe: $(BLD)/runemacs.$(O) $(TRES)\r
                  $(LINK) $(LINK_OUT)$@ $(SUBSYSTEM_WINDOWS) \\r
                  $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32)\r
@@ -66,12 +72,18 @@ $(BLD)/runemacs.exe: $(BLD)/runemacs.$(O) $(TRES)
 which-sh:\r
        @echo Using $(THE_SHELL) as shell.\r
 \r
+# These depend on stamp_BLD to make sure the $(BLD) directory is created\r
+# before the compilation begins, even if Make runs several commands\r
+# in parallel under "make -j".\r
+#\r
+$(BLD)/addpm.$(O) $(BLD)/ddeclient.$(O) $(BLD)/runemacs.$(O) $(BLD)/cmdproxy.$(O) $(BLD)/addsection.$(O) $(BLD)/preprep.$(O): stamp_BLD\r
+\r
 #\r
 # Build emacs\r
 #\r
-all:   which-sh $(BLD) $(ALL) all-other-dirs-$(MAKETYPE)\r
+all:   which-sh stamp_BLD $(ALL) maybe-bootstrap all-other-dirs-$(MAKETYPE)\r
 \r
-all-other-dirs-nmake:\r
+all-other-dirs-nmake: addsection\r
        cd ..\lib-src\r
        $(MAKE) $(MFLAGS) all\r
        cd ..\src\r
@@ -82,11 +94,11 @@ all-other-dirs-nmake:
        $(MAKE) $(MFLAGS) all\r
        cd ..\nt\r
 \r
-all-other-dirs-gmake:\r
-       $(MAKE) $(MFLAGS) -C ../lib-src all\r
-       $(MAKE) $(MFLAGS) -C ../src all\r
-       $(MAKE) $(MFLAGS) -C ../lisp all\r
-       $(MAKE) $(MFLAGS) -C ../leim all\r
+all-other-dirs-gmake: addsection\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src all\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src all\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp all\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim all\r
 \r
 recompile:     recompile-$(MAKETYPE)\r
 \r
@@ -96,7 +108,7 @@ recompile-nmake:
        cd ..\nt\r
 \r
 recompile-gmake:\r
-       $(MAKE) $(MFLAGS) -C ../lisp recompile\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp recompile\r
 \r
 #### Bootstrapping.\r
 \r
@@ -105,29 +117,54 @@ recompile-gmake:
 ### special emacs executable is built from Lisp sources, which is then\r
 ### used to compile Lisp files.  The last step is a "normal" make.\r
 \r
-bootstrap:     bootstrap-$(MAKETYPE) all\r
+maybe-bootstrap: maybe-bootstrap-$(SHELLTYPE)\r
+\r
+# dummy target to force other targets to be evaluated.\r
+doit:\r
+\r
+maybe-bootstrap-CMD:   doit\r
+       @echo .\r
+       @if not EXIST ..\lisp\abbrev.elc echo Essential Lisp files seem to be missing.  You should either\r
+       @if not EXIST ..\lisp\abbrev.elc echo do 'make bootstrap' or create 'lisp/abbrev.elc' somehow\r
+       @echo .\r
+       @if not EXIST ..\lisp\abbrev.elc exit -1\r
+\r
+maybe-bootstrap-SH: doit\r
+       @if [ ! -f ../lisp/abbrev.elc ] ; then \\r
+         echo; \\r
+         echo "Essential Lisp files seem to be missing.  You should either"; \\r
+         echo "do \`make bootstrap' or create \`lisp/abbrev.elc' somehow.";  \\r
+         echo; \\r
+         exit -1; \\r
+       fi\r
 \r
-bootstrap-nmake:\r
+bootstrap:     addsection bootstrap-$(MAKETYPE)\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) all\r
+\r
+bootstrap-nmake: addsection\r
        cd ..\lisp\r
        $(MAKE) $(MFLAGS) bootstrap-clean\r
        cd ..\src\r
        $(MAKE) $(MFLAGS) clean\r
        cd ..\lib-src\r
-       $(MAKE) $(MFLAGS) clean DOC\r
+       $(MAKE) $(MFLAGS) clean\r
        cd ..\src\r
        $(MAKE) $(MFLAGS) bootstrap\r
        $(MAKE) $(MFLAGS) bootstrap-clean\r
        cd ..\lisp\r
-       $(MAKE) $(MFLAGS) bootstrap\r
+       $(MAKE) $(MFLAGS) SHELL=$(SHELLTYPE) bootstrap\r
+       cd ..\lib-src\r
+       $(MAKE) $(MFLAGS) DOC\r
        cd ..\nt\r
 \r
-bootstrap-gmake:\r
-       $(MAKE) $(MFLAGS) -C ../lisp bootstrap-clean\r
-       $(MAKE) $(MFLAGS) -C ../src clean\r
-       $(MAKE) $(MFLAGS) -C ../lib-src clean DOC\r
-       $(MAKE) $(MFLAGS) -C ../src bootstrap\r
-       $(MAKE) $(MFLAGS) -C ../src bootstrap-clean\r
-       $(MAKE) $(MFLAGS) -C ../lisp bootstrap\r
+bootstrap-gmake: addsection\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap-clean\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src clean\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src clean\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src DOC\r
 \r
 bootstrap-clean: bootstrap-clean-$(MAKETYPE)\r
 \r
@@ -138,8 +175,8 @@ bootstrap-clean-nmake:
        $(MAKE) $(MFLAGS) bootstrap-clean\r
 \r
 bootstrap-clean-gmake:\r
-       $(MAKE) $(MFLAGS) -C ../src bootstrap-clean\r
-       $(MAKE) $(MFLAGS) -C ../lisp bootstrap-clean\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap-clean\r
 \r
 $(INSTALL_DIR):\r
        - mkdir "$(INSTALL_DIR)"\r
@@ -155,8 +192,7 @@ install: all $(INSTALL_DIR)/bin install-other-dirs-$(MAKETYPE)
        - $(CP) $(BLD)/ddeclient.exe $(INSTALL_DIR)/bin\r
        - $(CP) $(BLD)/cmdproxy.exe $(INSTALL_DIR)/bin\r
        - $(CP) $(BLD)/runemacs.exe $(INSTALL_DIR)/bin\r
-       - $(CP) ../lib-src/fns-*.el $(INSTALL_DIR)/bin\r
-       - "$(INSTALL_DIR)/bin/addpm" /q\r
+       - "$(INSTALL_DIR)/bin/addpm" -q\r
        - $(DEL) ../same-dir.tst\r
        - $(DEL) $(INSTALL_DIR)/same-dir.tst\r
        echo SameDirTest > "$(INSTALL_DIR)/same-dir.tst"\r
@@ -185,17 +221,36 @@ install-other-dirs-nmake:
        cd ..\nt\r
 \r
 install-other-dirs-gmake:\r
-       $(MAKE) $(MFLAGS) -C ../lib-src install\r
-       $(MAKE) $(MFLAGS) -C ../src install\r
-       $(MAKE) $(MFLAGS) -C ../lisp install\r
-       $(MAKE) $(MFLAGS) -C ../leim install\r
-\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src install\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src install\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp install\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim install\r
+\r
+force-info:\r
+# Note that man/makefile knows how to\r
+# put the info files in $(infodir),\r
+# so we can do ok running make in the build dir.\r
+info: force-info info-$(MAKETYPE)\r
+\r
+info-nmake:\r
+       cd ..\man\r
+       $(MAKE) $(MFLAGS) info\r
+       cd ..\lispref\r
+       $(MAKE) $(MFLAGS) info\r
+       cd ..\lispintro\r
+       $(MAKE) $(MFLAGS) info\r
+\r
+info-gmake:\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../man info\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lispref info\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lispintro info\r
 #\r
 # Maintenance\r
-# \r
+#\r
 clean: clean-other-dirs-$(MAKETYPE)\r
        - $(DEL) *~ $(COMPILER_TEMP_FILES)\r
        - $(DEL_TREE) $(OBJDIR)\r
+       - $(DEL) stamp_BLD\r
        - $(DEL) ../etc/DOC ../etc/DOC-X\r
 \r
 clean-other-dirs-nmake:\r
@@ -205,15 +260,21 @@ clean-other-dirs-nmake:
        $(MAKE) $(MFLAGS) clean\r
        cd ..\lisp\r
        $(MAKE) $(MFLAGS) clean\r
+       cd ..\lispintro\r
+       $(MAKE) $(MFLAGS) clean\r
+       cd ..\lispref\r
+       $(MAKE) $(MFLAGS) clean\r
        cd ..\leim\r
        $(MAKE) $(MFLAGS) clean\r
+       cd ..\man\r
+       $(MAKE) $(MFLAGS) clean\r
        cd ..\nt\r
 \r
 clean-other-dirs-gmake:\r
-       $(MAKE) $(MFLAGS) -C ../lib-src clean\r
-       $(MAKE) $(MFLAGS) -C ../src clean\r
-       $(MAKE) $(MFLAGS) -C ../lisp clean\r
-       $(MAKE) $(MFLAGS) -C ../leim clean\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src clean\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src clean\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp clean\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim clean\r
 \r
 cleanall-other-dirs-nmake:\r
        cd ..\lib-src\r
@@ -223,8 +284,8 @@ cleanall-other-dirs-nmake:
        cd ..\nt\r
 \r
 cleanall-other-dirs-gmake:\r
-       $(MAKE) $(MFLAGS) -C ../lib-src cleanall\r
-       $(MAKE) $(MFLAGS) -C ../src cleanall\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src cleanall\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src cleanall\r
 \r
 cleanall: clean cleanall-other-dirs-$(MAKETYPE)\r
         - $(DEL_TREE) obj\r