Compiling Vim on Win32 HOWTO

Author: Dan Sharp

2004-03-02

Revision History
Revision 1.022004-03-02dws
Updated for changes through 6.2.311

Abstract

The goal of this HOWTO is to provide information on compiling Vim 6.2 on Win32 systems with one of the supported compilers: MSVC++, BCC, and GCC (MinGW and Cygwin). If you already have an executable version of Vim that contains the features you want, then you probably don't need this file.

This document is published under the Vim License. See http://vimdoc.sf.net/htmldoc/uganda.html#license for information.

This document is available in HTML, PDF, and plain text formats from http://vimdoc.sf.net/howto/win32-compile


In order to compile Vim, you need three things: a compiler, the Vim source code, and utilities to get and extract the source code. Optionally, you may need to install extra programs to enable certain interfaces in Vim (such as Vim's built-in Perl or Python support).

Vim's source code is available through three different methods: FTP, CVS, and A-A-P. The simplest method is probably CVS, which requires only a CVS client utility in addition to the compiler.

The prepatched source code is available via CVS at http://cvs.vim.org . The CVS archive is manually updated by a volunteer as new patches are released, so it may briefly lag behind the currently released patches, but usually no more than a day or two. Check out the code using your preferred CVS client, then simply update your local archive as new patches come out so that you can always have the latest version.

You will only need a CVS client to get your source this way. You can get a command line CVS client as part of the Cygwin tools or from the msys-DTK package with the MinGW tools. Alternatively, you can get WinCVS, a native Win32 GUI application, from www.wincvs.org.

The command to initially checkout the code is:

C:\TEMP>cvs -z3 -d :pserver:anonymous@cvs.vim.sourceforge.net:/cvsroot/vim co vim
No password is required, so if you are prompted for one, just hit enter. The code will be downloaded from the CVS server and placed in a vim/ subdirectory of your current directory. The -z3 option will compress the files during transit.

Note

If you are unable to access the above site due to firewall / proxy problems, you can try the command

C:\TEMP>cvs -z3 -d :pserver:anonymous@cvs-pserver.sf.net:80/cvsroot/vim co vim
which will attempt the download via port 80, which most firewalls will allow through, since it is the standard HTTP port.

After the initial checkout, you can keep your archive updated by changing to the vim subdirectory and issuing the command:

C:\TEMP\Vim>cvs -z3 update -Pd
The update command will pull down any files modified since your last checkout / update. The -d flag will cause any new directories created on the CVS server since the last checkout / update to be created locally as well. The -P flag will remove any directories that are made empty by the current update. Similar instructions can be found at http://www.vim.org/cvs.php , including links to other CVS guides and information.

This manual process requires that you download all the archives, extract them, patch them, and compile them yourself. You need various additional utilities and time. When using this method, it is a good idea to create some batch files to save a lot of retyping and to script tedious commands (like applying the individual patches. Vim 6.1 had 474 of them).

The most up-to-date code is available via ftp from ftp.vim.org and its mirrors ftp.xx.vim.org, where xx is replaced with a country code like us, ca, or uk. See http://www.vim.org/mirrors.php for a more complete list of mirror sites. The /pub/vim/pc directory has the DOS-formatted source code in zip archives. You will want the vim62src.zip, vim62lang.zip and either the vim62rt.zip or the vim62rt1.zip and vim62rt2.zip files. Alternatively, you can get the UNIX-formatted, gzipped or bzipped tarballs from /pub/vim/unix (either vim-6.2.tar.bz2 or all four of vim-6.2-rt1.tar.gz, vim-6.2-rt2.tar.gz, vim-6.2-src1.tar.gz, and vim-6.2-src2.tar.gz) and /pub/vim/extra (vim-6.2-lang.tar.gz and vim-6.2-extra.tar.gz).

To extract the source from these archives, you will need several utilities. For the zip archives, you will need an unzip program. For the tar archives, you will need a tar program, a gunzip program, and perhaps a bunzip2 program. These utilities are available with the Cygwin distribution or in the MSYS package of the MinGW distribution. Finally, you can get the individual executables from sites like http://unxutils.sf.net or http://gnuwin32.sf.net . If you prefer a GUI program, you can get WinZip (which handles zip, tar, and gzip) from http://www.winzip.com or 7-Zip (which handles zip, tar, gzip, and bzip2) from http://www.7-zip.org.

Whichever source archives you get, place them in the C:\TEMP directory together. These archives hold the base 6.2.0 code. Extract the files into the current directory. If you are using the zip archives, you will have a new vim subdirectory, and the source will be located in C:\TEMP\vim\vim62\src; otherwise, with the tar archives, you will have a vim62 subdirectory, and the source will be located in C:\TEMP\vim62\src.

To get the latest version of Vim, you must apply all the patches from the /pub/vim/patches directory for the version of Vim you are compiling. Download all the files starting with 6.2 and place them in the C:\TEMP directory with the source archive files. To save some downloading time, every one hundred patches are combined into a single patch file that you can get instead of the one hundred individual patches. If available, they will have filenames like 6.2.1-100 and 6.2.101-200. You will still have to get the remaining patches individually. For reference, the README file in the /pub/vim/patches directory gives a quick synopsis of the bug or feature addressed by each patch, and the header of each patch gives a more complete description of the bug, the way the bug was fixed, and a list of the files affected by the patch.

Some patches address other operating system ports and are not needed by the Win32 version. If you got your source from the tar archives, this is not a problem, because all the source files for all operating systems will be present and get patched, even if they aren't used in the compile. If you got your source from the zip archives, some extra preparation is required.

Files not needed in a Win32 compile are not included in the zip archives. If you try to apply a patch for one of these missing files, you will get a 'File not found' error which can be safely ignored. Some patches, though, patch files in the 'runtime' directory, which doesn't exist in the zip archives. You will get 'File not found' errors for these files as well, but instead of ignoring it, you will want to specify the path to the file. Fortunately, this is as easy as specifying the path it just tried, but leaving off the 'runtime/' part. If you want to avoid retyping a lot of things, you can edit the patch files manually and remove the 'runtime/' from the path. For example, if you have an older version of Vim already installed, you could do:

C:\TEMP>vim -c "set lz" -c "bufdo! %s#--- runtime/#--- # | w" -c q 6.2.*
to open all the patch files in Vim and loop through each one, removing the 'runtime/' path from the 'to be patched' file specification.

You will need the patch program to apply the patches. Then, simply change to the vim62 directory (of which src and runtime are subdirectories) and issue the command

C:\TEMP\vim62>patch -p0 < ../6.2.001
or, if you have a more recent version of GNU patch,
C:\TEMP\vim62>patch -p0 -i ../6.2.001

Note

Some patch programs (like those from UnxUtils and GnuWin32) appear to have problems with unix file formats, which is the format of the patches downloaded from the FTP site. If you get an error like:

C:\TEMP\vim62>patch -p0 -i ../6.2.001                            
patching file src/edit.c
Assertion failed: hunk, file patch.c, line 341

abnormal program termination

C:\TEMP\vim62>
trying to apply the patches, run the unix2dos utility against all the patch files to convert them to a DOS file format. The patches should apply cleanly after that. An alternate (and much simpler) approach is to use the --binary option, so that the command line becomes
C:\Temp\vim62>patch -p0 --binary -i ../6.2.001

This process is then repeated for each patch in order, since some later patches are dependent on earlier patches. To apply all the patches at once, it would be a good idea to combine all the individual patches into a single large patch and apply them all at once. For example:

C:\TEMP>copy 6.2.* 6.2-all.patch
C:\TEMP>cd vim62
C:\TEMP\vim62>patch -p0 < ../6.2-all.patch

The newest way to get the latest source is with the A-A-P project created by Vim's author, Bram Moolenaar. The project is currently in the alpha stage, so all usual warnings apply. Install the necessary files by follwing the instructions at http://www.a-a-p.org/download.html . We will assume that the program is installed into C:\Exec. Since it is a Python application, you will also need a working Python distribution (2.2.x recommended). The program currently runs well with Cygwin's Python, and will run well with ActiveState's Python if you use A-A-P version 0.138 or greater.

Once you have an operational A-A-P installation, download the Vim recipe from http://www.a-a-p.org/vim/main.aap and place it into the directory where you want to build Vim. From a command line in that directory run the aap program with the command

C:\TEMP>python C:\Exec\main.py fetch
By default, this will extract the source from CVS. Running the program with the command
C:\TEMP>python C:\Exec\main.py fetch CVS=no
will instead automatically download all the source archives and patches from the FTP site, expand the source, and apply the patches.

As new patches are released, you can run the command again to update your sources from the CVS archive or download and apply them from FTP. Only the new and modified files will be retrieved on the subsequent updates.

More instructions can be found at http://www.a-a-p.org/ports.html Note that running aap with no arguments will download and compile the sources, but it currently uses the Unix configure and Makefile, which won't work for building a Win32 application, so you will only want to use aap with the 'fetch' option for now.

Vim can interface with several external libraries to extend its editing functionality. For example, Perl and Python support can be used to enhance Vim's scripting capabilities. The Iconv and Gettext libraries can be used to improve multilingual support. In order to use these features, support for them must be enabled at compile time. Also, the appropriate headers and libraries must be available. Self-installing binary distributions are available for almost all the libraries Vim can use, and installing them will also install the necessary development files Vim requires.

Below is a list of the external libraries which Vim can use, where to get them, and what extra features they provide. Not addressed is how to use the extra features; help on that subject can be found in Vim's help files.

Vim can work with four external scripting engines to supplement its own built-in scripting language.

Vim can work with Perl versions 5.004 through 5.8. You can download a binary distribution of the latest Perl release from http://www.activestate.com/activeperl and install it on your system. With a Perl-enabled Vim, you can use the :perl and :perldo commands to execute Perl functions. Read :help perl and especially :help perl-using for a description of the Vim's interface with Perl.

Vim can work with Python 1.5 through 2.2.2. You can download a binary distribution of the latest Python release from http://www.activestate.com/activepython and install it on your system. With a Python-enabled Vim, you can use the :python and :pyfile commands to execute Python functions. Read :help python and especially :help python-vim for a description of Vim's interface with Python.

Vim can work with Ruby 1.6.x. You can download a binary distribution of the latest Ruby release from http://rubyinstaller.sourceforge.net and install it on your system. With a Ruby-enabled Vim, you can use the :ruby, :rubyfile, and :rubydo commands to execute Ruby functions. Read :help ruby and especially :help ruby-vim for a description of Vim's interface with Ruby.

Vim can work with Tcl 8.x. You can download a binary distribution of the latest Tcl release from http://www.activestate.com/activetcl and install it on your system. With a Tcl-enabled Vim, you can use the :tcl, :tclfile, and :tcldo commands to execute Tcl functions. Read :help tcl and especially :help tcl-commands for a description of Vim's interface with Tcl.

Vim can also utilize libraries to improve its support for character encodings and different languages. Technically, you do not need them preinstalled in order to compile Vim, but they must be present in your PATH or in your vim install directory to enable their features in Vim.

Locale and multi-language support can be enabled in Vim with the gettext library. With gettext, messages and menus will appear in the language specified by the user's locale. You can get a copy of the gettext library for Win32 from http://sourceforge.net/projects/gettext See :help multilang for more information.

Note

If you have already installed Vim with the self-extracting installer from ftp://ftp.vim.org/pub/vim/pc/gvim62.exe then you already have libintl.dll in your vim\vim62 install directory and do not need to download it again.

Once you have downloaded the source and installed the desired external interfaces, it is time to compile the program. We will assume for the following instructions that you acquired the source via CVS and so the files are found in C:\TEMP\Vim.

The file feature.h can be edited to match your preferences, though you can skip this to get the default behavior, which should be fine for most people. You can also enable various features by supplying arguments to the make command during the compilation.

All the supported compilers provide a command-line method for compiling Vim. The Vim source contains a makefile in C:\TEMP\Vim\src for each compiler. These makefiles provide options specific to each compiler, as well as a common set of options available to all the makefiles. The files are Make_mvc.mak and Make_ivc.mak (Microsoft Visual C++), Make_bc5.mak (Borland C++ 5.x), Make_ming.mak (MinGW GCC) and Make_cyg.mak (Cygwin GCC). These files have been supplied by George V. Reilly, Ben Singer, Ken Scott and Ron Aaron and have been well tested.

The options for the compiler can be set in three different ways.

1) The simplest is to edit the makefile directly and comment/uncomment the options to build exactly what you want. The problem with this method is that your changes may be lost by updating the files with newer patches.

2) The second method is to define environment variables for the options. For example, to build a GUI and OLE-enabled Vim with the MSVC++ compiler, you could issue the commands:

C:\TEMP\VIM\SRC>set GUI=yes
C:\TEMP\VIM\SRC>set OLE=yes
C:\TEMP\VIM\SRC>nmake -f Make_mvc.mak

The options would remain in effect for any subsequent builds from the same console window. To change a setting you would change the environment variable.

3) Finally, you can specify the options on the command line itself, like:

C:\TEMP\VIM\SRC>make -f Make_cyg.mak GUI=yes OLE=yes
This method has the disadvantage that the options must be specified each time, but the advantage that you can see at a glance what options were used for a specific compile. You can avoid retyping all the options for subsequent compiles by using the command history of the console window or putting the command into a script.

Note

If you compile with one set of options and decide to add or remove an option, you will want to do a 'clean' to delete the already-compiled object files. If not, you will probably get errors when compiling or linking the program. Just add 'clean' to the end of the command you used for the compile, and any files generated during the previous compile will be removed. Be sure to include all the same options for the 'clean' as you did for the compile, otherwise you may not get all the right files removed. To clean up after the compile from example three above, use the command:

C:\TEMP\VIM\SRC>make -f Make_cyg.mak GUI=yes OLE=yes clean

Attempts have been made to use the same option name for the same feature in each makefile. Enable or disable the feature with a yes or no option. Features common to all the makefiles are:

OptionDescriptionDefault
GUI'yes' builds a GUI Vim, 'no' builds a console Vim.yes
OLE'yes' builds an OLE-enabled Vim.no
ICONV'yes' dynamically loads libiconv.dll to do character encoding conversions.yes
GETTEXTDynamically load the gettext library libintl.dll for multilanguage support.yes
MBYTEEnables multibyte support (viewing, not input)no
IMEEnables IME supportyes
DYNAMIC_IMELoads the imm32.dll library dynamicallyyes
CSCOPEEnables support for the Cscope interface to Vim.yes
DEBUG'yes' builds an executable with debug supportno
CPUNR Specifies the target CPU for the executable. MSVC++, BCC 5.5, and GCC 2.95.x allow i386 through i686, while GCC 3.x.x adds options for pentium2, pentium3, pentium4, athlon, etc. (Check the gcc man page for all the supported targets) i386
OPTIMIZE Specifies the optimization level of the executable. Available settings are SPACE (for the smallest executable, SPEED (for a well-balanced executable), and MAXSPEED (for a large but fast executable). MAXSPEED
POSTSCRIPTEnables Postscript output for the :hardcopy commandno
FEATURES Specifies what optional features to use, as given in feature.h of the Vim source. Available options are TINY, SMALL, NORMAL, BIG, and HUGE BIG
WINVERSpecifies the minimum version of Windows supported by the binary. 0x400 means the binary will run on anything from Win95 on up. 0x500 requires Win2k or higher. 0x400
NETBEANS Enables the Netbeans integration interface to allow Gvim to be used as the editor for the Netbeans IDE. This option also allows integration with the Agide GUI of the A-A-P project. yes
XPM Specifies the location of the XPM headers and library. This option allows Gvim to display XPM graphics with the 'signs' feature.  
PERLSpecifies the directory where Perl is installed. 
PERL_VERSpecifies the version of Perl being used.56
DYNAMIC_PERL Indicates whether to statically link the Perl runtime to Vim or to dynamically load it only when needed. yes
PYTHONSpecifies the directory where Python is installed. 
PYTHON_VERSpecifies the version of Python being used.22
DYNAMIC_PYTHON Indicates whether to statically link the Python runtime to Vim or to dynamically load it only when needed. yes
RUBYSpecifies the directory where Ruby is installed. 
RUBY_VERSpecifies the version of Ruby being used.16
RUBY_VER_LONGSpecifies the "long" version of Ruby being used.1.6
DYNAMIC_RUBY Indicates whether to statically link the Ruby runtime to Vim or to dynamically load it only when needed. yes
RUBY_PLATFORM Platform for which this version of Ruby was compiled. The default is for Ruby 1.6. For Ruby 1.8 or higher, the default is i386-mswin32. i586-mswin32
RUBY_INSTALL_NAME The name of the main Ruby DLL. For Ruby 1.6, the default value is mswin32-ruby16 and for Ruby 1.8 or higher the default is msvcrt-ruby18. mswin32-ruby16
TCLSpecifies the directory where Tcl is installed. 
TCL_VERSpecifies the version of Tcl being used.83
TCL_LONG_VERSpecifies the "long" version of Tcl being used.8.3
DYNAMIC_TCL Indicates whether to statically link the Tcl runtime to Vim or to dynamically load it only when needed. yes

Vim can be compiled for Win32 systemss using various versions of the Microsoft Visual C++ (versions 4-7), Borland (version 5 and 5.5), or GCC (2.95.x and 3.x.x from Cygwin or MinGW32). Each compiler has its own makefile and its own set of options and features it provides in addition to the ones listed above.

Microsoft's Visual C++ program is a commercial product and is not available for download. You have two options when compiling Vim with MSVC++: command line and IDE.

The most flexible method for compiling Vim from the command line is to use the Make_mvc.mak file. The advantage of using this makefile instead of Make_ivc.mak is that you have much greater control over the options used to compile Vim. Extra options available are:

OptionDescriptionDefault
GIMEEnables global IME supportno
MAPCreate a mapfile during compilationyes
SNIFFEnable the SNiFF+ interfaceno
VC6Delays loading seldom-used DLLs to improve startup timeno

To debug an executable built with Make_mvc.mak in the MSDev IDE, you need to use Make_dvc.mak in the IDE. From Make_mvc.mak:

Note: Make_dvc.mak builds vimrun.exe, because it must build something to be a valid makefile.

Vim can be compiled in the MSDev IDE using the Make_ivc.mak makefile. From the IDE, go to File->Open Workspace and select Make_ivc.mak and click OK. You can then select targets such as Release and/or Debug version of Console Vim or GUI Vim.

You can also use Make_ivc.mak to compile from the command line, though you are very limited in the types of executables you can build. Issuing the command

C:\TEMP\Vim\src>nmake -f Make_ivc.mak CFG="Vim - Win32 Release gvim OLE"
will build a GUI and OLE-enabled Vim. The other available targets are

CFG="Vim - Win32 Debug gvim OLE"
CFG="Vim - Win32 Release gvim"
CFG="Vim - Win32 Debug gvim"
CFG="Vim - Win32 Release vim"
CFG="Vim - Win32 Debug vim"

Borland C++Builder 5.0 can be purchased at a local retailer, or the Borland C++ 5.5 command line tools and two service packs are available for download from http://www.borland.com/products/downloads/download_cbuilder.html (While there, you may want to pick up the Borland TurboDebugger). Use the Make_bc5.mak makefile to build Vim using either of these compilers. Extra options available are:

OptionDescriptionDefault
BORSpecifies the installation directory of the BCC Compiler.C:\BC5
LINKSpecifies the name of the linker$(BOR)\bin\ilink32
OSTYPEBuild a Win32 executableWIN32
CODEGUARDEnables CodeGuard support in the executableno
USEDLL Use the Borland runtime dll. Reduces size of the executable, but requires cc3250.dll to be in the PATH no
VIMDLL Creates a backend vim32.dll with a stub frontend executable. no
ALIGNSpecifies byte alignment4
FASTCALL Use register based parameter passing for function calls. Improves performance, but breaks interface to external DLLs, thus is disabled when also compiling with PERL, PYTHON, RUBY, or TCL support. yes

To build a TCL-enabled vim with DYNAMIC_TCL=yes, you need to download a stub library for version 8.3.x (http://mywebpage.netscape.com/sharppeople/vim/tclstub83-bor.lib) or 8.4.x (http://mywebpage.netscape.com/sharppeople/vim/tclstub84-bor.lib) due to the difference in binary formats between MSVC++ and BCC compiled programs.

Note

If you are using a 5.0x version compiler, you will need to convert the vim.rc file from Unix to DOS format if you did not get it from the zip archives. You can do this with a unix2dos utility as described above in the MSVC++ IDE section.

The MinGW collection can be downloaded from http://www.mingw.org . Use the Make_ming.mak makefile to build Vim with the MinGW GCC compiler. A special feature of this makefile is the ability to cross-compile a Win32 executable from Linux. Features include:

OptionDescriptionDefault
ARCH Specifies the target ARCH for the executable. GCC 2.95.x allows i386 through i686, while GCC 3.x.x adds options for pentium2, pentium3, pentium4, athlon, etc. Check the gcc man page for all the supported targets. i386
CROSSCross-compile from UNIX.no

Note

NLS support with Mingw (by Eduardo F. Amatria <eferna1 at platea.pntic.mec.es>):

If you want National Language Support, read the file src/po/README_mingw.txt. You need to uncomment lines in Make_ming.mak to have NLS defined.

(written by Ron Aaron: <ron at mossbayeng.com> with help from Martin Kahlert <martin.kahlert at infineon.com>)

If you like, you can compile the MinGW Win32 version from the comfort of your Linux (or other unix) box. To do this, you need to follow a few steps:

  1. Install the MinGW32 cross-compiler (if you have it, go to step 2)

    1. From ftp://ftp.nanotech.wisc.edu/pub/khan/gnu-win32/mingw32/snapshots/gcc-2.95.2-1, get:

      binutils-19990818-1-src.tar.gz
      mingw-msvcrt-20000203.zip
      gcc-2.95.2-1-x86-win32.diff.gz

    2. From http://gcc.gnu.org/ get:

      gcc-2.95.2.tar.gz

    3. Create a place to put the compiler source and binaries (assuming you are in the home directory):

      $ mkdir gcc-bin
      $ mkdir gcc-src
      

    4. Unpack the sources:

      $ cd gcc-src
      $ tar xzf ../binutils-19990818-1-src.tar.gz
      $ tar xzf ../gcc-2.95.2.tar.gz
      $ unzip ../mingw-msvcrt-20000203
      

    5. Build the different tools:

      $ export PREFIX=~/gcc-bin/
      $ cd gcc-2.95.2
      $ zcat ../gcc-2.95.2-1-x86-win32.diff.gz | patch -p1 -E
      $ cd ../binutils-19990818
      $ ./configure --target=i586-pc-mingw32msvc --prefix=$PREFIX
      $ make
      $ make install
      $ cd ../gcc-2.95.2
      $ ./configure --target=i586-pc-mingw32msvc \
      $ --with-libs=~/gcc-bin/i386-mingw32msvc/lib \
      $ --with-headers=~/gcc-bin/i386-mingw32msvc/include \
      $ --enable-languages=c++ \
      $ --prefix=$PREFIX
      $ make
      $ make install
      

    6. Add $PREFIX/bin to your $PATH.

  2. Get the unix version of the vim sources from the tar archives.

  3. In Make_ming.mak, set CROSS to 1 instead of 0.

  4. Start your compile:

    $ make -f Make_ming.mak gvim.exe

Now you have created the Windows binary from your Linux box! Have fun...

Note

If you are cross-compiling on Linux with the mingw32 setup and are including the Perl, Python, Ruby, or TCL interfaces, you need to also convert each interpreter's include files to unix line-endings. This bash command will do it easily:

$ for fil in *.h ; do vim -e -c 'set ff=unix|w|q' $fil

If for some reason you want to build an executable that does not dynamically load the interpreter DLLs, you need to do a little extra work. Libraries compiled by MSVC++ (like those in the ActiveState distributions) do not link well with GCC. You need to manually create a GCC-compatible library.

The following instruction were originally written by Ron Aaron <ron at mossbayeng.com> for the Python interpreter, but the same instructions apply to other interpreters as well.

This has been tested with the MinGW32 compiler, and the ActiveState ActivePython: http://www.ActiveState.com/Products/ActivePython/

After installing the ActivePython, you will have to create a 'MinGW32' libpython20.a to link with:

$ cd $PYTHON/libs
$ pexports python20.dll > python20.def
$ dlltool -d python20.def -l libpython20.a

Once that is done, edit the Make_ming.mak so the PYTHON variable points to the root of the Python installation (C:\Python20, for example). If you are cross-compiling on Linux with the MinGW32 setup, you need to also convert all the 'Include' files to *unix* line-endings. This bash command will do it easily:

$ for fil in *.h ; do vim -e -c 'set ff=unix|w|q' $fil

Now just do:

$ make -f Make_ming.mak gvim.exe
and you will end up with a Python-enabled, Win32 version. Enjoy!

The Cygwin collection is available from http://www.cygwin.com and provides a Unix-like operating environment under Win32.

Use the Make_cyg.mak makefile to build Vim with the Cygwin GCC compiler. The initial version of this makefile only supports building a vanilla console Vim (or a vanilla GUI Vim after editing the makefile). Patch 6.1.253 adds many more features to this makefile. In addition to the common ones listed above, it also provides:

OptionDescriptionDefault
ARCH Specifies the target ARCH for the executable. GCC 2.95.x allows i386 through i686, while GCC 3.x.x adds options for pentium2, pentium3, pentium4, athlon, etc. Check the gcc man page for all the supported targets. i386
USEDLL Use the Cygwin runtime DLL. Reduces the size of the executable, but requires that cygwin1.dll be in the PATH. no

Once you compile your binaries, you are ready to go. In the C:\TEMP\vim\src directory you should have either a vim.exe and / or a gvim.exe, as well as install.exe, uninstal.exe, and vimrun.exe. There is also xxd.exe in C:\TEMP\vim\src\xxd and gvimext.dll in C:\TEMP\vim\src\GvimExt. If you want, you can do a couple more steps to round out your installation.

Vim can be compiled on DOS-based systems as well as Win32 systems. These (usually 16-bit) executables do not support all the options found in the Win32 versions, but they support the basics.

Summary:

16 bit, Borland C++ and Turbo C++

C:\TEMP\Vim\src>ren Make_bc3.mak Makefile
C:\TEMP\Vim\src>make

16 bit, Turbo C

C:\TEMP\Vim\src>ren Make_tcc.mak Makefile
C:\TEMP\Vim\src>make

32 bit, DJGPP 2.0

C:\TEMP\Vim\src>make -f Make_djg.mak

32 bit, Borland C++ 5.0 (make sure OSTYPE=DOS16)

C:\TEMP\Vim\src>make -f Make_bc5.mak

Warning: Be sure to use the right make.exe. Microsoft C make doesn't work; Borland make only works with Make_bc3.mak, Make_bc5.mak and Make_tcc.mak; DJGPP/GNU make must be used for Make_djg.mak.

The Borland C++ compiler has been used to generate the MS-DOS executable; it should work without problems. You will probably have to change the paths for LIBPATH and INCLUDEPATH in the start of the makefile. You will get two warnings which can be ignored (one about _chmod and one about precompiled header files).

The "spawno" library by Ralf Brown was used in order to free memory when Vim starts a shell or other external command. Only about 200 bytes are taken from conventional memory. When recompiling get the spawno library from Simtel, directory msdos/c. It is called something like spwno413.zip. Or follow the instructions in the Makefile to remove the library.

The Turbo C makefile has not been tested much lately. It is included for those that don't have C++. You may need to make a few changes to get it to work.

DJGPP needs to be installed properly to compile Vim; you need a lot of things before it works. When your setup is OK, Vim should compile with just one warning (about an argument to signal()).

Make_bc5.mak is for those that have Borland C++ 5.0 or later. At the top of the file, there are some variables you can change to make either a 32-bit Windows exe (GUI or console mode), or a 16-bit MS-DOS version.

If you get all kinds of strange error messages when compiling, try adding <CR> characters at the end of each line.