aboutsummaryrefslogtreecommitdiffstats
path: root/nt
diff options
context:
space:
mode:
authorEli Zaretskii <[email protected]>2011-11-05 13:34:56 +0200
committerEli Zaretskii <[email protected]>2011-11-05 13:34:56 +0200
commita6fc3b5c539c0a35e4447a12cc395294952d7561 (patch)
tree1e04d32fc9bdb6972987c95b0f8bb96e050846a8 /nt
parent27f5a13648b2f5b2873803c9338e77e61acfd1a5 (diff)
Support MSVC build with newer versions of Visual Studio.
Small portions of the changes by Fabrice Popineau <[email protected]>. src/makefile.w32-in (TAGS-gmake): Don't use $(patsubst ...), as Nmake barfs on that. Use $(OBJ*_c) variables instead, defined on nt/gmake.defs. src/lisp.h (ENUM_BF): New macro, for enumerated types in bitfields, which are not supported by MSVC. (Lisp_Symbol, Lisp_Misc_Any, Lisp_Marker, Lisp_Misc_Overlay) (Lisp_Save_Value, Lisp_Free): Use ENUM_BF for enumerated types in bitfields. (Lisp_Object) [USE_LISP_UNION_TYPE]: Use ENUM_BF for enumerated types in bitfields. (DEFUN) [_MSC_VER]: Define in a different way for MSVC. src/w32fns.c [_MSC_VER]: DECLARE_HANDLE for any MSVC version. src/w32.c: Don't include w32api.h for MSVC. (init_environment) [_MSC_VER]: Call sys_access, not _access. src/s/ms-w32.h <sigset_t, ssize_t> [_MSC_VER]: Typedefs for MSVC. [_MSC_VER]: Include sys/timeb.h, sys/stat.h, and signal.h. (fstat, stat, utime) [_MSC_VER]: Redirect to their sys_* cousins. (malloc, free, realloc, calloc) [_MSC_VER]: Always redirect to the e_* cousins. (alloca) [_MSC_VER]: Define to _alloca. src/lisp.h (DECL_ALIGN) [_MSC_VER]: Define for MSVC. src/regex.c <re_char> [_MSC_VER]: A separate definition for MSVC. nt/makefile.w32-in (clean-other-dirs-nmake) (distclean-other-dirs-nmake, maintainer-clean-other-dirs-nmake): Update for current structure of doc/ subdirectories. nt/gmake.defs (OBJ0_c, OBJ1_c, OBJ2_c): New variables. nt/INSTALL: Update for newer versions of MSVC. lib/makefile.w32-in (FRC): New dummy target. (TAGS): Depend on FRC. Fixes: debbugs:9960
Diffstat (limited to 'nt')
-rw-r--r--nt/ChangeLog18
-rw-r--r--nt/INSTALL42
-rw-r--r--nt/gmake.defs5
-rw-r--r--nt/makefile.w32-in24
-rw-r--r--nt/nmake.defs28
5 files changed, 83 insertions, 34 deletions
diff --git a/nt/ChangeLog b/nt/ChangeLog
index 55535c460f..21ab0c477b 100644
--- a/nt/ChangeLog
+++ b/nt/ChangeLog
@@ -1,3 +1,21 @@
+2011-11-05 Eli Zaretskii <[email protected]>
+
+ Support MSVC build with newer versions of Visual Studio.
+ * makefile.w32-in (clean-other-dirs-nmake)
+ (distclean-other-dirs-nmake, maintainer-clean-other-dirs-nmake):
+ Update for current structure of doc/ subdirectories.
+
+ * gmake.defs (OBJ0_c, OBJ1_c, OBJ2_c): New variables.
+
+ * INSTALL: Update for newer versions of MSVC.
+
+2011-11-05 Fabrice Popineau <[email protected]> (tiny change)
+
+ Support MSVC build with newer versions of Visual Studio.
+ * nmake.defs (USE_CRT_DLL): Define to 1.
+ (libc, EMACS_EXTRA_C_FLAGS, SYS_LDFLAGS, ARCH_CFLAGS): Update values.
+ (D): New variable.
+
2011-11-04 Eli Zaretskii <[email protected]>
* runemacs.c (ensure_unicows_dll): New function, tries to load
diff --git a/nt/INSTALL b/nt/INSTALL
index 613610890a..63285047a6 100644
--- a/nt/INSTALL
+++ b/nt/INSTALL
@@ -21,19 +21,32 @@
cd nt
- 2. Run configure.bat. From the COMMAND.COM/CMD.EXE command prompt:
+ 2. Run configure.bat.
+
+ 2a.If you use MSVC, set up the build environment by running the
+ SetEnv.cmd batch file from the appropriate SDK directory. (Skip
+ this step if you are using MinGW.) For example:
+
+ "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x86 /Debug
+
+ if you are goiung to compile a debug version, or
+
+ "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x86 /Release
+
+ if you are going to compile an optimized version.
+
+ 2b.From the COMMAND.COM/CMD.EXE command prompt type:
configure
- from a Unixy shell prompt:
+ From a Unixy shell prompt:
cmd /c configure.bat
or
command.com /c configure.bat
3. Run the Make utility suitable for your environment. If you build
- with the Microsoft's Visual C compiler (but see notes about using
- VC++ 8.0 and later below):
+ with the Microsoft's Visual C compiler:
nmake
@@ -101,24 +114,21 @@
* Supported development environments
To compile Emacs, you will need either Microsoft Visual C++ 2.0, or
- later up to 7.0, and nmake, or a Windows port of GCC 2.95 or later
- with MinGW and W32 API support and a port of GNU Make. You can use
- the Cygwin ports of GCC, but Emacs requires the MinGW headers and
- libraries to build (latest versions of the Cygwin toolkit, at least
- since v1.3.3, include the MinGW headers and libraries as an integral
- part).
-
- Note that building Emacs with Visual Studio 2005 (VC++ 8.0) and
- later is not supported at this time, due to changes introduced by
- Microsoft into the libraries shipped with the compiler.
+ later and nmake, or a Windows port of GCC 2.95 or later with MinGW
+ and W32 API support and a port of GNU Make. You can use the Cygwin
+ ports of GCC, but Emacs requires the MinGW headers and libraries to
+ build (latest versions of the Cygwin toolkit, at least since v1.3.3,
+ include the MinGW headers and libraries as an integral part).
The rest of this file assumes you have a working development
- environment. If you just installed such an environment, try
+ environment. If you just installed such an environment, try
building a trivial C "Hello world" program, and see if it works. If
it doesn't work, resolve that problem first! If you use Microsoft
Visual Studio .NET 2003, don't forget to run the VCVARS32.BAT batch
file from the `Bin' subdirectory of the directory where you have
- installed VS.NET.
+ installed VS.NET. With other versions of MSVC, run the SetEnv.cmd
+ batch file from the `Bin' subdirectory of the directory where you
+ have the SDK installed.
If you use the MinGW port of GCC and GNU Make to build Emacs, there
are some compatibility issues wrt Make and the shell that is run by
diff --git a/nt/gmake.defs b/nt/gmake.defs
index bbb560264c..46d4acf76d 100644
--- a/nt/gmake.defs
+++ b/nt/gmake.defs
@@ -193,6 +193,11 @@ OLE32 = -lole32
UNISCRIBE = -lusp10
UUID = -luuid
+# Used by src/makefile.w32-in, since Nmake barfs on $(func SOMETHING)
+OBJ0_c = $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ0))
+OBJ1_c = $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ1))
+OBJ2_c = $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ2))
+
ifdef NOOPT
DEBUG_CFLAGS = -DEMACSDEBUG
else
diff --git a/nt/makefile.w32-in b/nt/makefile.w32-in
index 05631855f6..194f0759bb 100644
--- a/nt/makefile.w32-in
+++ b/nt/makefile.w32-in
@@ -313,15 +313,15 @@ clean-other-dirs-nmake:
$(MAKE) $(MFLAGS) clean
cd ..\doc\lispintro
$(MAKE) $(MFLAGS) clean
- cd ..\doc\lispref
+ cd ..\lispref
$(MAKE) $(MFLAGS) clean
- cd ..\leim
+ cd ..\..\leim
$(MAKE) $(MFLAGS) clean
cd ..\doc\emacs
$(MAKE) $(MFLAGS) clean
- cd ..\doc\misc
+ cd ..\misc
$(MAKE) $(MFLAGS) clean
- cd ..\nt
+ cd ..\..\nt
clean-other-dirs-gmake:
$(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib clean
@@ -381,13 +381,13 @@ distclean-other-dirs-nmake:
$(MAKE) $(MFLAGS) distclean
cd ..\doc\emacs
$(MAKE) $(MFLAGS) distclean
- cd ..\doc\misc
+ cd ..\misc
$(MAKE) $(MFLAGS) distclean
- cd ..\doc\lispintro
+ cd ..\lispintro
$(MAKE) $(MFLAGS) distclean
- cd ..\doc\lispref
+ cd ..\lispref
$(MAKE) $(MFLAGS) distclean
- cd ..\nt
+ cd ..\..\nt
distclean-other-dirs-gmake:
$(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib distclean
@@ -415,13 +415,13 @@ maintainer-clean-other-dirs-nmake:
$(MAKE) $(MFLAGS) maintainer-clean
cd ..\doc\emacs
$(MAKE) $(MFLAGS) maintainer-clean
- cd ..\doc\misc
+ cd ..\misc
$(MAKE) $(MFLAGS) maintainer-clean
- cd ..\doc\lispintro
+ cd ..\lispintro
$(MAKE) $(MFLAGS) maintainer-clean
- cd ..\doc\lispref
+ cd ..\lispref
$(MAKE) $(MFLAGS) maintainer-clean
- cd ..\nt
+ cd ..\..\nt
maintainer-clean-other-dirs-gmake:
$(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib maintainer-clean
diff --git a/nt/nmake.defs b/nt/nmake.defs
index 6c0922d78b..4a7d93d40d 100644
--- a/nt/nmake.defs
+++ b/nt/nmake.defs
@@ -109,7 +109,15 @@ RC = rc
RC_OUT = -Fo
RC_INCLUDE = -i
-libc = libc.lib
+USE_CRT_DLL = 1
+
+!ifdef USE_CRT_DLL
+libc = msvcrt$(D).lib
+EMACS_EXTRA_C_FLAGS= -D_DLL -D_MT -DUSE_CRT_DLL=1
+!else
+libc = libcmt$(D).lib
+EMACS_EXTRA_C_FLAGS= -D_MT
+!endif
baselibs =
O = obj
A = lib
@@ -146,9 +154,13 @@ CFLAGS = -I. $(ARCH_CFLAGS) \
$(DEBUG_CFLAGS) $(CHECKING_CFLAGS) $(USER_CFLAGS) $(LOCAL_FLAGS)
ESC_CFLAGS = -I. $(ARCH_CFLAGS) \
$(DEBUG_CFLAGS) $(CHECKING_CFLAGS) $(ESC_USER_CFLAGS) $(LOCAL_FLAGS)
-EMACS_EXTRA_C_FLAGS =
-SYS_LDFLAGS = -nologo -release -incremental:no -version:3.10 -swaprun:cd -swaprun:net setargv.obj
+#SYS_LDFLAGS = -nologo -release -incremental:no -version:3.10 -swaprun:cd -swaprun:net setargv.obj
+!ifdef NOOPT
+SYS_LDFLAGS = -nologo -manifest -dynamicbase:no -debug -incremental:no -version:3.10 -swaprun:cd -swaprun:net setargv.obj
+!else
+SYS_LDFLAGS = -nologo -manifest -dynamicbase:no -release -incremental:no -version:3.10 -swaprun:cd -swaprun:net setargv.obj
+!endif
# see comments in allocate_heap in w32heap.c before changing any of the
# -stack, -heap, or -base settings.
@@ -184,16 +196,20 @@ DEL_TREE = rm -r
!ifdef NODEBUG
DEBUG_FLAG =
DEBUG_LINK =
+D =
!else
DEBUG_FLAG = -Zi
-DEBUG_LINK = -debug:full
+DEBUG_LINK = -debug
+D = d
!endif
!if "$(ARCH)" == "i386"
!ifdef NOOPT
-ARCH_CFLAGS = -nologo -c -Zel -W2 -H63 -Od -G3d -Zp8 $(DEBUG_FLAG)
+#ARCH_CFLAGS = -nologo -c -Zel -W2 -H63 -Od -G3d -Zp8 $(DEBUG_FLAG)
+ARCH_CFLAGS = -nologo -D_X86_=1 -c -Zl -Zp8 -W2 -Od -Gd $(DEBUG_FLAG)
!else
-ARCH_CFLAGS = -nologo -c -Zel -W2 -H63 -Oxsb2 -Oy- -G6dF -Zp8 $(DEBUG_FLAG)
+#ARCH_CFLAGS = -nologo -c -Zel -W2 -H63 -Oxsb2 -Oy- -G6dF -Zp8 $(DEBUG_FLAG)
+ARCH_CFLAGS = -nologo -D_X86_=1 -c -Zl -Zp8 -W2 -Oi -Ot -Oy- -Ob2 -GF -Gy -Gd $(DEBUG_FLAG)
!endif
ARCH_LDFLAGS = $(SYS_LDFLAGS)