Merge from emacs--rel--22
[bpt/emacs.git] / nt / makefile.w32-in
index ca1e22b..5cb13a7 100644 (file)
@@ -1,6 +1,6 @@
 #  -*- Makefile -*- for GNU Emacs on the Microsoft W32 API.\r
 #  Copyright (C) 2000, 2001, 2002, 2003, 2004,\r
-#    2005, 2006 Free Software Foundation, Inc.\r
+#    2005, 2006, 2007 Free Software Foundation, Inc.\r
 #\r
 #  Top level makefile for building GNU Emacs on Windows NT\r
 #\r
@@ -8,7 +8,7 @@
 #\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
+#  the Free Software Foundation; either version 3, or (at your option)\r
 #  any later version.\r
 #\r
 #  GNU Emacs is distributed in the hope that it will be useful,\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
 .PHONY: $(ALL)\r
 \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
@@ -56,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
@@ -67,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) maybe-bootstrap 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
@@ -83,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
@@ -97,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
@@ -127,9 +138,12 @@ maybe-bootstrap-SH: doit
          exit -1; \\r
        fi\r
 \r
-bootstrap:     addsection bootstrap-$(MAKETYPE) all\r
+# Bootstrap depends on cmdproxy because some Lisp functions\r
+# loaded during bootstrap may need to run shell commands.\r
+bootstrap:     addsection cmdproxy bootstrap-$(MAKETYPE)\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) all\r
 \r
-bootstrap-nmake:\r
+bootstrap-nmake: addsection cmdproxy\r
        cd ..\lisp\r
        $(MAKE) $(MFLAGS) bootstrap-clean\r
        cd ..\src\r
@@ -139,20 +153,23 @@ bootstrap-nmake:
        cd ..\src\r
        $(MAKE) $(MFLAGS) bootstrap\r
        $(MAKE) $(MFLAGS) bootstrap-clean\r
+       cd ..\nt\r
+       $(CP) $(BLD)/cmdproxy.exe ../bin\r
        cd ..\lisp\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\r
-       $(MAKE) $(MFLAGS) -C ../src bootstrap\r
-       $(MAKE) $(MFLAGS) -C ../src bootstrap-clean\r
-       $(MAKE) $(MFLAGS) -C ../lisp bootstrap\r
-       $(MAKE) $(MFLAGS) -C ../lib-src DOC\r
+bootstrap-gmake: addsection cmdproxy\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
+       $(CP) $(BLD)/cmdproxy.exe ../bin\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src DOC\r
 \r
 bootstrap-clean: bootstrap-clean-$(MAKETYPE)\r
 \r
@@ -163,8 +180,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
@@ -180,7 +197,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
-       - "$(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
@@ -194,6 +211,8 @@ install: all $(INSTALL_DIR)/bin install-other-dirs-$(MAKETYPE)
        $(IFNOTSAMEDIR) $(CP_DIR) ../etc $(INSTALL_DIR) $(ENDIF)\r
        - $(CP_DIR) icons $(INSTALL_DIR)/etc\r
        $(IFNOTSAMEDIR) $(CP_DIR) ../info $(INSTALL_DIR) $(ENDIF)\r
+       $(IFNOTSAMEDIR) $(CP) ../COPYING $(INSTALL_DIR) $(ENDIF)\r
+       - $(CP) ../COPYING $(INSTALL_DIR)/bin\r
        - $(DEL) ../same-dir.tst\r
        - $(DEL) $(INSTALL_DIR)/same-dir.tst\r
 \r
@@ -209,35 +228,39 @@ 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
+       $(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
+# Note that doc/emacs/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
+       cd ..\doc\emacs\r
+       $(MAKE) $(MFLAGS) info\r
+       cd ..\doc\misc\r
        $(MAKE) $(MFLAGS) info\r
-       cd ..\lispref\r
+       cd ..\doc\lispref\r
        $(MAKE) $(MFLAGS) info\r
-       cd ..\lispintro\r
+       cd ..\doc\lispintro\r
        $(MAKE) $(MFLAGS) info\r
 \r
 info-gmake:\r
-       $(MAKE) $(MFLAGS) -C ../man info\r
-       $(MAKE) $(MFLAGS) -C ../lispref info\r
-       $(MAKE) $(MFLAGS) -C ../lispintro info\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs info\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc info\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref info\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro info\r
 #\r
 # Maintenance\r
 #\r
 clean: clean-other-dirs-$(MAKETYPE)\r
-       - $(DEL) *~ $(COMPILER_TEMP_FILES)\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
@@ -247,21 +270,23 @@ clean-other-dirs-nmake:
        $(MAKE) $(MFLAGS) clean\r
        cd ..\lisp\r
        $(MAKE) $(MFLAGS) clean\r
-       cd ..\lispintro\r
+       cd ..\doc\lispintro\r
        $(MAKE) $(MFLAGS) clean\r
-       cd ..\lispref\r
+       cd ..\doc\lispref\r
        $(MAKE) $(MFLAGS) clean\r
        cd ..\leim\r
        $(MAKE) $(MFLAGS) clean\r
-       cd ..\man\r
+       cd ..\doc\emacs\r
+       $(MAKE) $(MFLAGS) clean\r
+       cd ..\doc\misc\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
@@ -271,9 +296,11 @@ 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
+# We used to delete *~ here, but that might inadvertently remove\r
+# precious files if it happens to match their short 8+3 aliases.\r
 cleanall: clean cleanall-other-dirs-$(MAKETYPE)\r
         - $(DEL_TREE) obj\r
         - $(DEL_TREE) obj-spd\r