xref: /vim-8.2.3635/src/Make_mvc.mak (revision 94688b8a)
1# Makefile for Vim on Win32 (Windows XP/2003/Vista/7/8/10) and Win64,
2# using the Microsoft Visual C++ compilers. Known to work with VC5, VC6 (VS98),
3# VC7.0 (VS2002), VC7.1 (VS2003), VC8 (VS2005), VC9 (VS2008), VC10 (VS2010),
4# VC11 (VS2012), VC12 (VS2013), VC14 (VS2015) and VC15 (VS2017)
5#
6# To build using other Windows compilers, see INSTALLpc.txt
7#
8# This makefile can build the console, GUI, OLE-enable, Perl-enabled and
9# Python-enabled versions of Vim for Win32 platforms.
10#
11# The basic command line to build Vim is:
12#
13#	nmake -f Make_mvc.mak
14#
15# This will build the console version of Vim with no additional interfaces.
16# To add features, define any of the following:
17#
18# 	For MSVC 11, if you want to include Win32.mak, you need to specify
19# 	where the file is, e.g.:
20# 	   SDK_INCLUDE_DIR="C:\Program Files\Microsoft SDKs\Windows\v7.1\Include"
21#
22#	!!!!  After changing features do "nmake clean" first  !!!!
23#
24#	Feature Set: FEATURES=[TINY, SMALL, NORMAL, BIG, HUGE] (default is HUGE)
25#
26#	GUI interface: GUI=yes (default is no)
27#
28#	GUI with DirectWrite (DirectX): DIRECTX=yes
29#	  (default is yes if GUI=yes, requires GUI=yes)
30#
31#	Color emoji support: COLOR_EMOJI=yes
32#	  (default is yes if DIRECTX=yes, requires WinSDK 8.1 or later.)
33#
34#	OLE interface: OLE=yes (usually with GUI=yes)
35#
36#	IME support: IME=yes	(requires GUI=yes)
37#	  DYNAMIC_IME=[yes or no]  (to load the imm32.dll dynamically, default
38#	  is yes)
39#	Global IME support: GIME=yes (requires GUI=yes)
40#
41#       Terminal support: TERMINAL=yes (default is yes)
42#
43#	Lua interface:
44#	  LUA=[Path to Lua directory]
45#	  DYNAMIC_LUA=yes (to load the Lua DLL dynamically)
46#	  LUA_VER=[Lua version]  (default is 53)
47#
48#	MzScheme interface:
49#	  MZSCHEME=[Path to MzScheme directory]
50#	  DYNAMIC_MZSCHEME=yes (to load the MzScheme DLLs dynamically)
51#	  MZSCHEME_VER=[MzScheme version] (default is 3m_a0solc (6.6))
52#	  	Used for the DLL file name. E.g.:
53#	  	C:\Program Files (x86)\Racket\lib\libracket3m_XXXXXX.dll
54#	  MZSCHEME_DEBUG=no
55#
56#	Perl interface:
57#	  PERL=[Path to Perl directory]
58#	  DYNAMIC_PERL=yes (to load the Perl DLL dynamically)
59#	  PERL_VER=[Perl version, in the form 55 (5.005), 56 (5.6.x),
60#		    510 (5.10.x), etc]
61#	  (default is 524)
62#
63#	Python interface:
64#	  PYTHON=[Path to Python directory]
65#	  DYNAMIC_PYTHON=yes (to load the Python DLL dynamically)
66#	  PYTHON_VER=[Python version, eg 22, 23, ..., 27]  (default is 27)
67#
68#	Python3 interface:
69#	  PYTHON3=[Path to Python3 directory]
70#	  DYNAMIC_PYTHON3=yes (to load the Python3 DLL dynamically)
71#	  PYTHON3_VER=[Python3 version, eg 30, 31]  (default is 36)
72#
73#	Ruby interface:
74#	  RUBY=[Path to Ruby directory]
75#	  DYNAMIC_RUBY=yes (to load the Ruby DLL dynamically)
76#	  RUBY_VER=[Ruby version, eg 19, 22] (default is 22)
77#	  RUBY_API_VER_LONG=[Ruby API version, eg 1.8, 1.9.1, 2.2.0]
78#	  		    (default is 2.2.0)
79#	    You must set RUBY_API_VER_LONG when change RUBY_VER.
80#	    Note: If you use Ruby 1.9.3, set as follows:
81#	      RUBY_VER=19
82#	      RUBY_API_VER_LONG=1.9.1 (not 1.9.3, because the API version is 1.9.1.)
83#
84#	Tcl interface:
85#	  TCL=[Path to Tcl directory]
86#	  DYNAMIC_TCL=yes (to load the Tcl DLL dynamically)
87#	  TCL_VER=[Tcl version, e.g. 80, 83]  (default is 86)
88#	  TCL_VER_LONG=[Tcl version, eg 8.3] (default is 8.6)
89#	    You must set TCL_VER_LONG when you set TCL_VER.
90#	  TCL_DLL=[Tcl dll name, e.g. tcl86.dll]  (default is tcl86.dll)
91#
92#	Cscope support: CSCOPE=yes
93#
94#	Iconv library support (always dynamically loaded):
95#	  ICONV=[yes or no]  (default is yes)
96#
97#	Intl library support (always dynamically loaded):
98#	  GETTEXT=[yes or no]  (default is yes)
99#	See http://sourceforge.net/projects/gettext/
100#
101#	PostScript printing: POSTSCRIPT=yes (default is no)
102#
103#	Netbeans Support: NETBEANS=[yes or no] (default is yes if GUI is yes)
104#	Requires CHANNEL.
105#
106#	Netbeans Debugging Support: NBDEBUG=[yes or no] (should be no, yes
107#	doesn't work)
108#
109#	Inter process communication: CHANNEL=[yes or no] (default is yes if GUI
110#	is yes)
111#
112#	XPM Image Support: XPM=[path to XPM directory]
113#	Default is "xpm", using the files included in the distribution.
114#	Use "no" to disable this feature.
115#
116#	Optimization: OPTIMIZE=[SPACE, SPEED, MAXSPEED] (default is MAXSPEED)
117#
118#	Processor Version: CPUNR=[any, i586, i686, sse, sse2, avx, avx2] (default is
119#	any)
120#	  avx is available on Visual C++ 2010 and after.
121#	  avx2 is available on Visual C++ 2013 Update 2 and after.
122#
123#	Version Support: WINVER=[0x0501, 0x0502, 0x0600, 0x0601, 0x0602,
124#	0x0603, 0x0A00] (default is 0x0501)
125#	Supported versions depends on your target SDK, check SDKDDKVer.h
126#	See https://docs.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt
127#
128#	Debug version: DEBUG=yes
129#	Mapfile: MAP=[no, yes or lines] (default is yes)
130#	  no:    Don't write a mapfile.
131#	  yes:   Write a normal mapfile.
132#	  lines: Write a mapfile with line numbers (only for VC6 and later)
133#
134#	Static Code Analysis: ANALYZE=yes (works with VS2012 or later)
135#
136# You can combine any of these interfaces
137#
138# Example: To build the non-debug, GUI version with Perl interface:
139#	nmake -f Make_mvc.mak GUI=yes PERL=C:\Perl
140#
141# DEBUG with Make_mvc.mak and Make_dvc.mak:
142#	This makefile gives a fineness of control which is not supported in
143#	Visual C++ configuration files.  Therefore, debugging requires a bit of
144#	extra work.
145#	Make_dvc.mak is a Visual C++ project to access that support.  It may be
146#	badly out of date for the Visual C++ you are using...
147#	To use Make_dvc.mak:
148#	1) Build Vim with Make_mvc.mak.
149#	     Use a "DEBUG=yes" argument to build Vim with debug support.
150#	     E.g. the following builds gvimd.exe:
151#		nmake -f Make_mvc.mak debug=yes gui=yes
152#	2) Use MS Devstudio and set it up to allow that file to be debugged:
153#	    i) Pass Make_dvc.mak to the IDE.
154#		 Use the "open workspace" menu entry to load Make_dvc.mak.
155#		 Alternatively, from the command line:
156#			msdev /nologo Make_dvc.mak
157#		Note: Make_dvc.mak is in VC4.0 format. Later VC versions see
158#		this and offer to convert it to their own format. Accept that.
159#		It creates a file called Make_dvc.dsw which can then be used
160#		for further operations.  E.g.
161#		    msdev /nologo Make_dvc.dsw
162#	    ii) Set the built executable for debugging:
163#		a) Alt+F7/Debug takes you to the Debug dialog.
164#		b) Fill "Executable for debug session". e.g. gvimd.exe
165#		c) Fill "Program arguments". e.g. -R dosinst.c
166#		d) Complete the dialog
167#	3) You can now debug the executable you built with Make_mvc.mak
168#
169#	Note: Make_dvc.mak builds vimrun.exe, because it must build something
170#	to be a valid makefile..
171
172### See feature.h for a list of optionals.
173# If you want to build some optional features without modifying the source,
174# you can set DEFINES on the command line, e.g.,
175#	nmake -f Make_mvc.mvc "DEFINES=-DEMACS_TAGS"
176
177# Build on Windows NT/XP
178
179TARGETOS = WINNT
180
181!ifndef DIRECTX
182DIRECTX = $(GUI)
183!endif
184
185# Select one of eight object code directories, depends on GUI, OLE, DEBUG and
186# interfaces.
187# If you change something else, do "make clean" first!
188!if "$(GUI)" == "yes"
189OBJDIR = .\ObjG
190!else
191OBJDIR = .\ObjC
192!endif
193!if "$(DIRECTX)" == "yes"
194OBJDIR = $(OBJDIR)X
195!endif
196!if "$(OLE)" == "yes"
197OBJDIR = $(OBJDIR)O
198!endif
199!ifdef LUA
200OBJDIR = $(OBJDIR)U
201!endif
202!ifdef PERL
203OBJDIR = $(OBJDIR)L
204!endif
205!ifdef PYTHON
206OBJDIR = $(OBJDIR)Y
207!endif
208!ifdef PYTHON3
209OBJDIR = $(OBJDIR)H
210!endif
211!ifdef TCL
212OBJDIR = $(OBJDIR)T
213!endif
214!ifdef RUBY
215OBJDIR = $(OBJDIR)R
216!endif
217!ifdef MZSCHEME
218OBJDIR = $(OBJDIR)Z
219!endif
220!if "$(DEBUG)" == "yes"
221OBJDIR = $(OBJDIR)d
222!endif
223
224# If you include Win32.mak, it requires that CPU be set appropriately.
225# To cross-compile for Win64, set CPU=AMD64 or CPU=IA64.
226
227!ifdef PROCESSOR_ARCHITECTURE
228# We're on Windows NT or using VC 6+
229! ifdef CPU
230ASSEMBLY_ARCHITECTURE=$(CPU)
231# Using I386 for $ASSEMBLY_ARCHITECTURE doesn't work for VC7.
232!  if "$(CPU)" == "I386"
233CPU = i386
234!  endif
235! else  # !CPU
236CPU = i386
237!  if !defined(PLATFORM) && defined(TARGET_CPU)
238PLATFORM = $(TARGET_CPU)
239!  endif
240!  ifdef PLATFORM
241!   if ("$(PLATFORM)" == "x64") || ("$(PLATFORM)" == "X64")
242CPU = AMD64
243!   elseif ("$(PLATFORM)" != "x86") && ("$(PLATFORM)" != "X86")
244!    error *** ERROR Unknown target platform "$(PLATFORM)". Make aborted.
245!   endif
246!  endif  # !PLATFORM
247! endif
248!else  # !PROCESSOR_ARCHITECTURE
249# We're on Windows 95
250CPU = i386
251!endif # !PROCESSOR_ARCHITECTURE
252ASSEMBLY_ARCHITECTURE=$(CPU)
253OBJDIR = $(OBJDIR)$(CPU)
254
255# Build a retail version by default
256
257!if "$(DEBUG)" != "yes"
258NODEBUG = 1
259!else
260!undef NODEBUG
261MAKEFLAGS_GVIMEXT = DEBUG=yes
262!endif
263
264
265# Get all sorts of useful, standard macros from the Platform SDK,
266# if SDK_INCLUDE_DIR is set or USE_WIN32MAK is set to "yes".
267
268!ifdef SDK_INCLUDE_DIR
269!include $(SDK_INCLUDE_DIR)\Win32.mak
270!elseif "$(USE_WIN32MAK)"=="yes"
271!include <Win32.mak>
272!else
273link = link
274!endif
275
276
277# Check VC version.
278!if [echo MSVCVER=_MSC_VER> msvcver.c && $(CC) /EP msvcver.c > msvcver.~ 2> nul]
279!message *** ERROR
280!message Cannot run Visual C to determine its version. Make sure cl.exe is in your PATH.
281!message This can usually be done by running "vcvarsall.bat", located in the bin directory where Visual Studio was installed.
282!error Make aborted.
283!else
284!include msvcver.~
285!if [del msvcver.c msvcver.~]
286!endif
287!endif
288
289!if $(MSVCVER) < 1900
290MSVC_MAJOR = ($(MSVCVER) / 100 - 6)
291MSVCRT_VER = ($(MSVCVER) / 10 - 60)
292# Visual C++ 2017 needs special handling
293# it has an _MSC_VER of 1910->14.1, but is actually v15 with runtime v140
294# TODO: what's the maximum value?
295!elseif $(MSVCVER) >= 1910
296MSVC_MAJOR = 15
297MSVCRT_VER = 140
298!else
299MSVC_MAJOR = ($(MSVCVER) / 100 - 5)
300MSVCRT_VER = ($(MSVCVER) / 10 - 50)
301!endif
302
303# Calculate MSVC_FULL for Visual C++ 8 and up.
304!if $(MSVC_MAJOR) >= 8
305! if [echo MSVC_FULL=_MSC_FULL_VER> msvcfullver.c && $(CC) /EP msvcfullver.c > msvcfullver.~ 2> nul]
306!  message *** ERROR
307!  message Cannot run Visual C to determine its version. Make sure cl.exe is in your PATH.
308!  message This can usually be done by running "vcvarsall.bat", located in the bin directory where Visual Studio was installed.
309!  error Make aborted.
310! else
311!  include msvcfullver.~
312!  if [del msvcfullver.c msvcfullver.~]
313!  endif
314! endif
315!endif
316
317
318# Calculate MSVCRT_VER
319!if [(set /a MSVCRT_VER="$(MSVCRT_VER)" > nul) && set MSVCRT_VER > msvcrtver.~] == 0
320!include msvcrtver.~
321!if [del msvcrtver.~]
322!endif
323!endif
324
325# Base name of the msvcrXX.dll
326!if $(MSVCRT_VER) <= 60
327MSVCRT_NAME = msvcrt
328!elseif $(MSVCRT_VER) <= 130
329MSVCRT_NAME = msvcr$(MSVCRT_VER)
330!else
331MSVCRT_NAME = vcruntime$(MSVCRT_VER)
332!endif
333
334!if $(MSVC_MAJOR) == 6
335CPU = ix86
336!endif
337
338
339# Flag to turn on Win64 compatibility warnings for VC7.x and VC8.
340WP64CHECK = /Wp64
341
342# Use multiprocess build
343USE_MP = yes
344
345#>>>>> path of the compiler and linker; name of include and lib directories
346# PATH = c:\msvc20\bin;$(PATH)
347# INCLUDE = c:\msvc20\include
348# LIB = c:\msvc20\lib
349
350!if "$(FEATURES)"==""
351FEATURES = HUGE
352!endif
353
354!ifndef CTAGS
355# this assumes ctags is Exuberant ctags
356CTAGS = ctags -I INIT+ --fields=+S
357!endif
358
359!ifndef CSCOPE
360CSCOPE = yes
361!endif
362
363!if "$(CSCOPE)" == "yes"
364# CSCOPE - Include support for Cscope
365CSCOPE_INCL  = if_cscope.h
366CSCOPE_OBJ   = $(OBJDIR)/if_cscope.obj
367CSCOPE_DEFS  = -DFEAT_CSCOPE
368!endif
369
370!ifndef TERMINAL
371!if "$(FEATURES)"=="HUGE"
372TERMINAL = yes
373!else
374TERMINAL = no
375!endif
376!endif
377
378!if "$(TERMINAL)" == "yes"
379TERM_OBJ = \
380	$(OBJDIR)/terminal.obj \
381	$(OBJDIR)/encoding.obj \
382	$(OBJDIR)/keyboard.obj \
383	$(OBJDIR)/mouse.obj \
384	$(OBJDIR)/parser.obj \
385	$(OBJDIR)/pen.obj \
386	$(OBJDIR)/termscreen.obj \
387	$(OBJDIR)/state.obj \
388	$(OBJDIR)/unicode.obj \
389	$(OBJDIR)/vterm.obj
390TERM_DEFS = -DFEAT_TERMINAL
391TERM_DEPS = \
392	libvterm/include/vterm.h \
393	libvterm/include/vterm_keycodes.h \
394	libvterm/src/rect.h \
395	libvterm/src/utf8.h \
396	libvterm/src/vterm_internal.h
397!endif
398
399!ifndef NETBEANS
400NETBEANS = $(GUI)
401!endif
402
403!ifndef CHANNEL
404!if "$(FEATURES)"=="HUGE"
405CHANNEL = yes
406!else
407CHANNEL = $(GUI)
408!endif
409!endif
410
411# GUI sepcific features.
412!if "$(GUI)" == "yes"
413# Only allow NETBEANS for a GUI build and CHANNEL.
414!if "$(NETBEANS)" == "yes" && "$(CHANNEL)" == "yes"
415# NETBEANS - Include support for Netbeans integration
416NETBEANS_PRO	= proto/netbeans.pro
417NETBEANS_OBJ	= $(OBJDIR)/netbeans.obj
418NETBEANS_DEFS	= -DFEAT_NETBEANS_INTG
419
420!if "$(NBDEBUG)" == "yes"
421NBDEBUG_DEFS	= -DNBDEBUG
422NBDEBUG_INCL	= nbdebug.h
423NBDEBUG_SRC	= nbdebug.c
424!endif
425NETBEANS_LIB	= WSock32.lib
426!endif
427
428# DirectWrite (DirectX)
429!if "$(DIRECTX)" == "yes"
430DIRECTX_DEFS	= -DFEAT_DIRECTX -DDYNAMIC_DIRECTX
431!if "$(COLOR_EMOJI)" != "no"
432DIRECTX_DEFS	= $(DIRECTX_DEFS) -DFEAT_DIRECTX_COLOR_EMOJI
433!endif
434DIRECTX_INCL	= gui_dwrite.h
435DIRECTX_OBJ	= $(OUTDIR)\gui_dwrite.obj
436!endif
437
438# Only allow XPM for a GUI build.
439!ifndef XPM
440!ifndef USE_MSVCRT
441# Both XPM and USE_MSVCRT are not set, use the included xpm files, depending
442# on the architecture.
443!if "$(CPU)" == "AMD64"
444XPM = xpm\x64
445!elseif "$(CPU)" == "i386"
446XPM = xpm\x86
447!else
448XPM = no
449!endif
450!else # USE_MSVCRT
451XPM = no
452!endif # USE_MSVCRT
453!endif # XPM
454!if "$(XPM)" != "no"
455# XPM - Include support for XPM signs
456# See the xpm directory for more information.
457XPM_OBJ   = $(OBJDIR)/xpm_w32.obj
458XPM_DEFS  = -DFEAT_XPM_W32
459!if $(MSVC_MAJOR) >= 14
460# VC14 cannot use a library built by VC12 or eariler, because VC14 uses
461# Universal CRT.
462XPM_LIB   = $(XPM)\lib-vc14\libXpm.lib
463!else
464XPM_LIB   = $(XPM)\lib\libXpm.lib
465!endif
466XPM_INC	  = -I $(XPM)\include -I $(XPM)\..\include
467!endif
468!endif
469
470!if "$(CHANNEL)" == "yes"
471CHANNEL_PRO	= proto/channel.pro
472CHANNEL_OBJ	= $(OBJDIR)/channel.obj
473CHANNEL_DEFS	= -DFEAT_JOB_CHANNEL
474
475NETBEANS_LIB	= WSock32.lib
476!endif
477
478# Set which version of the CRT to use
479!if defined(USE_MSVCRT)
480# CVARS = $(cvarsdll)
481# !elseif defined(MULTITHREADED)
482# CVARS = $(cvarsmt)
483!else
484# CVARS = $(cvars)
485# CVARS = $(cvarsmt)
486!endif
487
488# need advapi32.lib for GetUserName()
489# need shell32.lib for ExtractIcon()
490# need netapi32.lib for NetUserEnum()
491# gdi32.lib and comdlg32.lib for printing support
492# ole32.lib and uuid.lib are needed for FEAT_SHORTCUT
493CON_LIB = oldnames.lib kernel32.lib advapi32.lib shell32.lib gdi32.lib \
494          comdlg32.lib ole32.lib netapi32.lib uuid.lib /machine:$(CPU)
495!if "$(DELAYLOAD)" == "yes"
496CON_LIB = $(CON_LIB) /DELAYLOAD:comdlg32.dll /DELAYLOAD:ole32.dll DelayImp.lib
497!endif
498
499### Set the default $(WINVER) to make it work with VC++7.0 (VS.NET)
500!ifndef WINVER
501WINVER = 0x0501
502!endif
503
504# If you have a fixed directory for $VIM or $VIMRUNTIME, other than the normal
505# default, use these lines.
506#VIMRCLOC = somewhere
507#VIMRUNTIMEDIR = somewhere
508
509CFLAGS = -c /W3 /nologo $(CVARS) -I. -Iproto -DHAVE_PATHDEF -DWIN32 \
510		$(CSCOPE_DEFS) $(TERM_DEFS) $(NETBEANS_DEFS) $(CHANNEL_DEFS) \
511		$(NBDEBUG_DEFS) $(XPM_DEFS) \
512		$(DEFINES) -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER)
513
514#>>>>> end of choices
515###########################################################################
516
517DEL_TREE = rmdir /s /q
518
519INTDIR=$(OBJDIR)
520OUTDIR=$(OBJDIR)
521
522### Validate CPUNR
523!ifndef CPUNR
524# default to untargeted code
525CPUNR = any
526!elseif "$(CPUNR)" == "i386" || "$(CPUNR)" == "i486"
527# alias i386 and i486 to i586
528! message *** WARNING CPUNR=$(CPUNR) is not a valid target architecture.
529! message Windows XP is the minimum target OS, with a minimum target
530! message architecture of i586.
531! message Retargeting to i586
532CPUNR = i586
533!elseif "$(CPUNR)" == "pentium4"
534# alias pentium4 to sse2
535! message *** WARNING CPUNR=pentium4 is deprecated in favour of sse2.
536! message Retargeting to sse2.
537CPUNR = sse2
538!elseif "$(CPUNR)" != "any" && "$(CPUNR)" != "i586" && "$(CPUNR)" != "i686" && "$(CPUNR)" != "sse" && "$(CPUNR)" != "sse2" && "$(CPUNR)" != "avx" && "$(CPUNR)" != "avx2"
539! error *** ERROR Unknown target architecture "$(CPUNR)". Make aborted.
540!endif
541
542# Convert processor ID to MVC-compatible number
543!if $(MSVC_MAJOR) < 8
544! if "$(CPUNR)" == "i586"
545CPUARG = /G5
546! elseif "$(CPUNR)" == "i686"
547CPUARG = /G6
548! elseif "$(CPUNR)" == "sse"
549CPUARG = /G6 /arch:SSE
550! elseif "$(CPUNR)" == "sse2"
551CPUARG = /G7 /arch:SSE2
552! elseif "$(CPUNR)" == "avx" || "$(CPUNR)" == "avx2"
553!  message AVX/AVX2 Instruction Sets are not supported by Visual C++ v$(MSVC_MAJOR)
554!  message Falling back to SSE2
555CPUARG = /G7 /arch:SSE2
556! elseif "$(CPUNR)" == "any"
557CPUARG =
558! endif
559!else
560# IA32/SSE/SSE2 are only supported on x86
561! if "$(ASSEMBLY_ARCHITECTURE)" == "i386" && ("$(CPUNR)" == "i586" || "$(CPUNR)" == "i686" || "$(CPUNR)" == "any")
562# VC<11 generates fp87 code by default
563!  if $(MSVC_MAJOR) < 11
564CPUARG =
565# VC>=11 needs explicit insturctions to generate fp87 code
566!  else
567CPUARG = /arch:IA32
568!  endif
569! elseif "$(ASSEMBLY_ARCHITECTURE)" == "i386" && "$(CPUNR)" == "sse"
570CPUARG = /arch:SSE
571! elseif "$(ASSEMBLY_ARCHITECTURE)" == "i386" && "$(CPUNR)" == "sse2"
572CPUARG = /arch:SSE2
573! elseif "$(CPUNR)" == "avx"
574# AVX is only supported by VC 10 and up
575!  if $(MSVC_MAJOR) < 10
576!   message AVX Instruction Set is not supported by Visual C++ v$(MSVC_MAJOR)
577!   if "$(ASSEMBLY_ARCHITECTURE)" == "i386"
578!    message Falling back to SSE2
579CPUARG = /arch:SSE2
580!   else
581CPUARG =
582!   endif
583!  else
584CPUARG = /arch:AVX
585!  endif
586! elseif "$(CPUNR)" == "avx2"
587# AVX is only supported by VC 10 and up
588!  if $(MSVC_MAJOR) < 10
589!   message AVX2 Instruction Set is not supported by Visual C++ v$(MSVC_MAJOR)
590!   if "$(ASSEMBLY_ARCHITECTURE)" == "i386"
591!    message Falling back to SSE2
592CPUARG = /arch:SSE2
593!   else
594CPUARG =
595!   endif
596# AVX2 is only supported by VC 12U2 and up
597# 180030501 is the full version number for Visual Studio 2013/VC 12 Update 2
598!  elseif $(MSVC_FULL) < 180030501
599!   message AVX2 Instruction Set is not supported by Visual C++ v$(MSVC_MAJOR)-$(MSVC_FULL)
600!   message Falling back to AVX
601CPUARG = /arch:AVX
602!  else
603CPUARG = /arch:AVX2
604!  endif
605! endif
606!endif
607
608# Pass CPUARG to GvimExt, to avoid using version-dependent defaults
609MAKEFLAGS_GVIMEXT = $(MAKEFLAGS_GVIMEXT) CPUARG="$(CPUARG)"
610
611
612LIBC =
613DEBUGINFO = /Zi
614
615# Don't use /nodefaultlib on MSVC 14
616!if $(MSVC_MAJOR) >= 14
617NODEFAULTLIB =
618!else
619NODEFAULTLIB = /nodefaultlib
620!endif
621
622# Use multiprocess build on MSVC 10
623!if "$(USE_MP)"=="yes"
624!if $(MSVC_MAJOR) >= 10
625CFLAGS = $(CFLAGS) /MP
626!endif
627!endif
628
629
630!ifdef NODEBUG
631VIM = vim
632!if "$(OPTIMIZE)" == "SPACE"
633OPTFLAG = /O1
634!elseif "$(OPTIMIZE)" == "SPEED"
635OPTFLAG = /O2
636!else # MAXSPEED
637OPTFLAG = /Ox
638!endif
639
640!if $(MSVC_MAJOR) >= 8
641# Use link time code generation if not worried about size
642!if "$(OPTIMIZE)" != "SPACE"
643OPTFLAG = $(OPTFLAG) /GL
644!endif
645!endif
646
647# (/Wp64 is deprecated in VC9 and generates an obnoxious warning.)
648!if ($(MSVC_MAJOR) == 7) || ($(MSVC_MAJOR) == 8)
649CFLAGS=$(CFLAGS) $(WP64CHECK)
650!endif
651
652# VC10 or later has stdint.h.
653!if $(MSVC_MAJOR) >= 10
654CFLAGS = $(CFLAGS) -DHAVE_STDINT_H
655!endif
656
657# Static code analysis generally available starting with VS2012 (VC11) or
658# Windows SDK 7.1 (VC10)
659!if ("$(ANALYZE)" == "yes") && ($(MSVC_MAJOR) >= 10)
660CFLAGS=$(CFLAGS) /analyze
661!endif
662
663CFLAGS = $(CFLAGS) $(OPTFLAG) -DNDEBUG $(CPUARG)
664RCFLAGS = $(rcflags) $(rcvars) -DNDEBUG
665! ifdef USE_MSVCRT
666CFLAGS = $(CFLAGS) /MD
667LIBC = msvcrt.lib
668! else
669LIBC = libcmt.lib
670CFLAGS = $(CFLAGS) /Zl /MT
671! endif
672!else  # DEBUG
673VIM = vimd
674! if ("$(CPU)" == "i386") || ("$(CPU)" == "ix86")
675DEBUGINFO = /ZI
676! endif
677CFLAGS = $(CFLAGS) -D_DEBUG -DDEBUG /Od
678RCFLAGS = $(rcflags) $(rcvars) -D_DEBUG -DDEBUG
679# The /fixed:no is needed for Quantify. Assume not 4.? as unsupported in VC4.0.
680! if $(MSVC_MAJOR) == 4
681LIBC =
682! else
683LIBC = /fixed:no
684! endif
685! ifdef USE_MSVCRT
686CFLAGS = $(CFLAGS) /MDd
687LIBC = $(LIBC) msvcrtd.lib
688! else
689LIBC = $(LIBC) libcmtd.lib
690CFLAGS = $(CFLAGS) /Zl /MTd
691! endif
692!endif # DEBUG
693
694!include Make_all.mak
695!include testdir\Make_all.mak
696
697INCL =	vim.h alloc.h arabic.h ascii.h ex_cmds.h farsi.h feature.h globals.h \
698	keymap.h macros.h option.h os_dos.h os_win32.h proto.h regexp.h \
699	spell.h structs.h term.h beval.h $(NBDEBUG_INCL)
700
701OBJ = \
702	$(OUTDIR)\arabic.obj \
703	$(OUTDIR)\autocmd.obj \
704	$(OUTDIR)\beval.obj \
705	$(OUTDIR)\blob.obj \
706	$(OUTDIR)\blowfish.obj \
707	$(OUTDIR)\buffer.obj \
708	$(OUTDIR)\charset.obj \
709	$(OUTDIR)\crypt.obj \
710	$(OUTDIR)\crypt_zip.obj \
711	$(OUTDIR)\dict.obj \
712	$(OUTDIR)\diff.obj \
713	$(OUTDIR)\digraph.obj \
714	$(OUTDIR)\edit.obj \
715	$(OUTDIR)\eval.obj \
716	$(OUTDIR)\evalfunc.obj \
717	$(OUTDIR)\ex_cmds.obj \
718	$(OUTDIR)\ex_cmds2.obj \
719	$(OUTDIR)\ex_docmd.obj \
720	$(OUTDIR)\ex_eval.obj \
721	$(OUTDIR)\ex_getln.obj \
722	$(OUTDIR)\farsi.obj \
723	$(OUTDIR)\fileio.obj \
724	$(OUTDIR)\fold.obj \
725	$(OUTDIR)\getchar.obj \
726	$(OUTDIR)\hardcopy.obj \
727	$(OUTDIR)\hashtab.obj \
728	$(OUTDIR)\indent.obj \
729	$(OUTDIR)\json.obj \
730	$(OUTDIR)\list.obj \
731	$(OUTDIR)\main.obj \
732	$(OUTDIR)\mark.obj \
733	$(OUTDIR)\mbyte.obj \
734	$(OUTDIR)\memfile.obj \
735	$(OUTDIR)\memline.obj \
736	$(OUTDIR)\menu.obj \
737	$(OUTDIR)\message.obj \
738	$(OUTDIR)\misc1.obj \
739	$(OUTDIR)\misc2.obj \
740	$(OUTDIR)\move.obj \
741	$(OUTDIR)\normal.obj \
742	$(OUTDIR)\ops.obj \
743	$(OUTDIR)\option.obj \
744	$(OUTDIR)\os_mswin.obj \
745	$(OUTDIR)\winclip.obj \
746	$(OUTDIR)\os_win32.obj \
747	$(OUTDIR)\pathdef.obj \
748	$(OUTDIR)\popupmnu.obj \
749	$(OUTDIR)\quickfix.obj \
750	$(OUTDIR)\regexp.obj \
751	$(OUTDIR)\screen.obj \
752	$(OUTDIR)\search.obj \
753	$(OUTDIR)\sha256.obj \
754	$(OUTDIR)\sign.obj \
755	$(OUTDIR)\spell.obj \
756	$(OUTDIR)\spellfile.obj \
757	$(OUTDIR)\syntax.obj \
758	$(OUTDIR)\tag.obj \
759	$(OUTDIR)\term.obj \
760	$(OUTDIR)\textprop.obj \
761	$(OUTDIR)\ui.obj \
762	$(OUTDIR)\undo.obj \
763	$(OUTDIR)\userfunc.obj \
764	$(OUTDIR)\window.obj \
765	$(OUTDIR)\vim.res
766
767!if "$(OLE)" == "yes"
768CFLAGS = $(CFLAGS) -DFEAT_OLE
769RCFLAGS = $(RCFLAGS) -DFEAT_OLE
770OLE_OBJ = $(OUTDIR)\if_ole.obj
771OLE_IDL = if_ole.idl
772OLE_LIB = oleaut32.lib
773!endif
774
775!if "$(IME)" == "yes"
776CFLAGS = $(CFLAGS) -DFEAT_MBYTE_IME
777!ifndef DYNAMIC_IME
778DYNAMIC_IME = yes
779!endif
780!if "$(DYNAMIC_IME)" == "yes"
781CFLAGS = $(CFLAGS) -DDYNAMIC_IME
782!else
783IME_LIB = imm32.lib
784!endif
785!endif
786
787!if "$(GIME)" == "yes"
788CFLAGS = $(CFLAGS) -DGLOBAL_IME
789OBJ = $(OBJ) $(OUTDIR)\dimm_i.obj $(OUTDIR)\glbl_ime.obj
790!endif
791
792!if "$(GUI)" == "yes"
793SUBSYSTEM = windows
794CFLAGS = $(CFLAGS) -DFEAT_GUI_W32
795RCFLAGS = $(RCFLAGS) -DFEAT_GUI_W32
796VIM = g$(VIM)
797GUI_INCL = \
798	gui.h
799GUI_OBJ = \
800	$(OUTDIR)\gui.obj \
801	$(OUTDIR)\gui_beval.obj \
802	$(OUTDIR)\gui_w32.obj \
803	$(OUTDIR)\os_w32exe.obj
804GUI_LIB = \
805	gdi32.lib version.lib $(IME_LIB) \
806	winspool.lib comctl32.lib advapi32.lib shell32.lib netapi32.lib \
807	/machine:$(CPU)
808!else
809SUBSYSTEM = console
810CUI_INCL = iscygpty.h
811CUI_OBJ = $(OUTDIR)\iscygpty.obj
812!endif
813SUBSYSTEM_TOOLS = console
814
815XDIFF_OBJ = $(OBJDIR)/xdiffi.obj \
816	$(OBJDIR)/xemit.obj \
817	$(OBJDIR)/xprepare.obj \
818	$(OBJDIR)/xutils.obj \
819	$(OBJDIR)/xhistogram.obj \
820	$(OBJDIR)/xpatience.obj
821
822XDIFF_DEPS = \
823	xdiff/xdiff.h \
824	xdiff/xdiffi.h \
825	xdiff/xemit.h \
826	xdiff/xinclude.h \
827	xdiff/xmacros.h \
828	xdiff/xprepare.h \
829	xdiff/xtypes.h \
830	xdiff/xutils.h
831
832
833!if "$(SUBSYSTEM_VER)" != ""
834SUBSYSTEM = $(SUBSYSTEM),$(SUBSYSTEM_VER)
835SUBSYSTEM_TOOLS = $(SUBSYSTEM_TOOLS),$(SUBSYSTEM_VER)
836# Pass SUBSYSTEM_VER to GvimExt and other tools
837MAKEFLAGS_GVIMEXT = $(MAKEFLAGS_GVIMEXT) SUBSYSTEM_VER=$(SUBSYSTEM_VER)
838MAKEFLAGS_TOOLS = $(MAKEFLAGS_TOOLS) SUBSYSTEM_VER=$(SUBSYSTEM_VER)
839!endif
840
841!if "$(GUI)" == "yes" && "$(DIRECTX)" == "yes"
842CFLAGS = $(CFLAGS) $(DIRECTX_DEFS)
843GUI_INCL = $(GUI_INCL) $(DIRECTX_INCL)
844GUI_OBJ = $(GUI_OBJ) $(DIRECTX_OBJ)
845!endif
846
847# iconv.dll library (dynamically loaded)
848!ifndef ICONV
849ICONV = yes
850!endif
851!if "$(ICONV)" == "yes"
852CFLAGS = $(CFLAGS) -DDYNAMIC_ICONV
853!endif
854
855# libintl.dll library
856!ifndef GETTEXT
857GETTEXT = yes
858!endif
859!if "$(GETTEXT)" == "yes"
860CFLAGS = $(CFLAGS) -DDYNAMIC_GETTEXT
861!endif
862
863# TCL interface
864!ifdef TCL
865!ifndef TCL_VER
866TCL_VER = 86
867TCL_VER_LONG = 8.6
868!endif
869!message Tcl requested (version $(TCL_VER)) - root dir is "$(TCL)"
870!if "$(DYNAMIC_TCL)" == "yes"
871!message Tcl DLL will be loaded dynamically
872!ifndef TCL_DLL
873TCL_DLL = tcl$(TCL_VER).dll
874!endif
875CFLAGS  = $(CFLAGS) -DFEAT_TCL -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"$(TCL_DLL)\" \
876		-DDYNAMIC_TCL_VER=\"$(TCL_VER_LONG)\"
877TCL_OBJ	= $(OUTDIR)\if_tcl.obj
878TCL_INC	= /I "$(TCL)\Include" /I "$(TCL)"
879TCL_LIB = "$(TCL)\lib\tclstub$(TCL_VER).lib"
880!else
881CFLAGS  = $(CFLAGS) -DFEAT_TCL
882TCL_OBJ	= $(OUTDIR)\if_tcl.obj
883TCL_INC	= /I "$(TCL)\Include" /I "$(TCL)"
884TCL_LIB = $(TCL)\lib\tcl$(TCL_VER)vc.lib
885!endif
886!endif
887
888# Lua interface
889!ifdef LUA
890!ifndef LUA_VER
891LUA_VER = 53
892!endif
893!message Lua requested (version $(LUA_VER)) - root dir is "$(LUA)"
894!if "$(DYNAMIC_LUA)" == "yes"
895!message Lua DLL will be loaded dynamically
896!endif
897CFLAGS = $(CFLAGS) -DFEAT_LUA
898LUA_OBJ = $(OUTDIR)\if_lua.obj
899LUA_INC = /I "$(LUA)\include" /I "$(LUA)"
900!if "$(DYNAMIC_LUA)" == "yes"
901CFLAGS = $(CFLAGS) -DDYNAMIC_LUA \
902		-DDYNAMIC_LUA_DLL=\"lua$(LUA_VER).dll\"
903LUA_LIB = /nodefaultlib:lua$(LUA_VER).lib
904!else
905LUA_LIB = "$(LUA)\lib\lua$(LUA_VER).lib"
906!endif
907!endif
908
909!ifdef PYTHON
910!ifdef PYTHON3
911DYNAMIC_PYTHON=yes
912DYNAMIC_PYTHON3=yes
913!endif
914!endif
915
916# PYTHON interface
917!ifdef PYTHON
918!ifndef PYTHON_VER
919PYTHON_VER = 27
920!endif
921!message Python requested (version $(PYTHON_VER)) - root dir is "$(PYTHON)"
922!if "$(DYNAMIC_PYTHON)" == "yes"
923!message Python DLL will be loaded dynamically
924!endif
925CFLAGS = $(CFLAGS) -DFEAT_PYTHON
926PYTHON_OBJ = $(OUTDIR)\if_python.obj
927PYTHON_INC = /I "$(PYTHON)\Include" /I "$(PYTHON)\PC"
928!if "$(DYNAMIC_PYTHON)" == "yes"
929CFLAGS = $(CFLAGS) -DDYNAMIC_PYTHON \
930		-DDYNAMIC_PYTHON_DLL=\"python$(PYTHON_VER).dll\"
931PYTHON_LIB = /nodefaultlib:python$(PYTHON_VER).lib
932!else
933PYTHON_LIB = $(PYTHON)\libs\python$(PYTHON_VER).lib
934!endif
935!endif
936
937# PYTHON3 interface
938!ifdef PYTHON3
939!ifndef PYTHON3_VER
940PYTHON3_VER = 36
941!endif
942!message Python3 requested (version $(PYTHON3_VER)) - root dir is "$(PYTHON3)"
943!if "$(DYNAMIC_PYTHON3)" == "yes"
944!message Python3 DLL will be loaded dynamically
945!endif
946CFLAGS = $(CFLAGS) -DFEAT_PYTHON3
947PYTHON3_OBJ = $(OUTDIR)\if_python3.obj
948PYTHON3_INC = /I "$(PYTHON3)\Include" /I "$(PYTHON3)\PC"
949!if "$(DYNAMIC_PYTHON3)" == "yes"
950CFLAGS = $(CFLAGS) -DDYNAMIC_PYTHON3 \
951		-DDYNAMIC_PYTHON3_DLL=\"python$(PYTHON3_VER).dll\"
952PYTHON3_LIB = /nodefaultlib:python$(PYTHON3_VER).lib
953!else
954PYTHON3_LIB = $(PYTHON3)\libs\python$(PYTHON3_VER).lib
955!endif
956!endif
957
958# MzScheme interface
959!ifdef MZSCHEME
960!message MzScheme requested - root dir is "$(MZSCHEME)"
961!ifndef MZSCHEME_VER
962MZSCHEME_VER = 3m_a0solc
963!endif
964!ifndef MZSCHEME_COLLECTS
965MZSCHEME_COLLECTS=$(MZSCHEME)\collects
966!endif
967CFLAGS = $(CFLAGS) -DFEAT_MZSCHEME -I "$(MZSCHEME)\include"
968!if EXIST("$(MZSCHEME)\lib\msvc\libmzsch$(MZSCHEME_VER).lib")
969MZSCHEME_MAIN_LIB=mzsch
970!else
971MZSCHEME_MAIN_LIB=racket
972!endif
973!if (EXIST("$(MZSCHEME)\lib\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll") \
974     && !EXIST("$(MZSCHEME)\lib\libmzgc$(MZSCHEME_VER).dll")) \
975    || (EXIST("$(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib") \
976        && !EXIST("$(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib"))
977!message Building with Precise GC
978MZSCHEME_PRECISE_GC = yes
979CFLAGS = $(CFLAGS) -DMZ_PRECISE_GC
980!endif
981!if "$(DYNAMIC_MZSCHEME)" == "yes"
982!message MzScheme DLLs will be loaded dynamically
983CFLAGS = $(CFLAGS) -DDYNAMIC_MZSCHEME
984!if "$(MZSCHEME_PRECISE_GC)" == "yes"
985# Precise GC does not use separate dll
986CFLAGS = $(CFLAGS) \
987	 -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" \
988	 -DDYNAMIC_MZGC_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\"
989!else
990CFLAGS = $(CFLAGS) \
991	 -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" \
992	 -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
993!endif
994!else
995!if "$(MZSCHEME_DEBUG)" == "yes"
996CFLAGS = $(CFLAGS) -DMZSCHEME_FORCE_GC
997!endif
998!if "$(MZSCHEME_PRECISE_GC)" == "yes"
999# Precise GC does not use separate dll
1000!if EXIST("$(MZSCHEME)\lib\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).def")
1001# create .lib from .def
1002MZSCHEME_LIB = lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib
1003MZSCHEME_EXTRA_DEP = lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib
1004!else
1005MZSCHEME_LIB = "$(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib"
1006!endif
1007!else
1008MZSCHEME_LIB = "$(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib" \
1009		"$(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib"
1010!endif
1011!endif
1012MZSCHEME_OBJ = $(OUTDIR)\if_mzsch.obj
1013# increase stack size
1014MZSCHEME_LIB = $(MZSCHEME_LIB) /STACK:8388608
1015MZSCHEME_INCL = if_mzsch.h
1016!endif
1017
1018# Perl interface
1019!ifdef PERL
1020!ifndef PERL_VER
1021PERL_VER = 524
1022!endif
1023!message Perl requested (version $(PERL_VER)) - root dir is "$(PERL)"
1024!if "$(DYNAMIC_PERL)" == "yes"
1025!if $(PERL_VER) >= 56
1026!message Perl DLL will be loaded dynamically
1027!else
1028!message Dynamic loading is not supported for Perl versions earlier than 5.6.0
1029!message Reverting to static loading...
1030!undef DYNAMIC_PERL
1031!endif
1032!endif
1033
1034# Is Perl installed in architecture-specific directories?
1035!if exist($(PERL)\Bin\MSWin32-x86)
1036PERL_ARCH = \MSWin32-x86
1037!endif
1038
1039PERL_INCDIR = $(PERL)\Lib$(PERL_ARCH)\Core
1040
1041# Version-dependent stuff
1042!if $(PERL_VER) == 55
1043PERL_LIB = $(PERL_INCDIR)\perl.lib
1044!else
1045PERL_DLL = perl$(PERL_VER).dll
1046!if exist($(PERL_INCDIR)\perl$(PERL_VER).lib)
1047PERL_LIB = $(PERL_INCDIR)\perl$(PERL_VER).lib
1048!else
1049# For ActivePerl 5.18 and later
1050PERL_LIB = $(PERL_INCDIR)\libperl$(PERL_VER).a
1051!endif
1052!endif
1053
1054CFLAGS = $(CFLAGS) -DFEAT_PERL -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS
1055
1056# Do we want to load Perl dynamically?
1057!if "$(DYNAMIC_PERL)" == "yes"
1058CFLAGS = $(CFLAGS) -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"$(PERL_DLL)\"
1059!undef PERL_LIB
1060!endif
1061
1062PERL_EXE = $(PERL)\Bin$(PERL_ARCH)\perl
1063PERL_INC = /I $(PERL_INCDIR)
1064!if $(MSVC_MAJOR) <= 11
1065# ActivePerl 5.20+ requires stdbool.h but VC2012 or earlier doesn't have it.
1066# Use a stub stdbool.h.
1067PERL_INC = $(PERL_INC) /I if_perl_msvc
1068!endif
1069PERL_OBJ = $(OUTDIR)\if_perl.obj $(OUTDIR)\if_perlsfio.obj
1070XSUBPP = $(PERL)\lib\ExtUtils\xsubpp
1071!if exist($(XSUBPP))
1072XSUBPP = $(PERL_EXE) $(XSUBPP)
1073!else
1074XSUBPP = xsubpp
1075!endif
1076XSUBPP_TYPEMAP = $(PERL)\lib\ExtUtils\typemap
1077
1078!endif
1079
1080#
1081# Support Ruby interface
1082#
1083!ifdef RUBY
1084#  Set default value
1085!ifndef RUBY_VER
1086RUBY_VER = 22
1087!endif
1088!ifndef RUBY_VER_LONG
1089RUBY_VER_LONG = 2.2.0
1090!endif
1091!ifndef RUBY_API_VER_LONG
1092RUBY_API_VER_LONG = $(RUBY_VER_LONG)
1093!endif
1094!ifndef RUBY_API_VER
1095RUBY_API_VER = $(RUBY_API_VER_LONG:.=)
1096!endif
1097
1098!if $(RUBY_VER) >= 18
1099
1100!ifndef RUBY_PLATFORM
1101!if "$(CPU)" == "i386"
1102RUBY_PLATFORM = i386-mswin32
1103!else # CPU
1104RUBY_PLATFORM = x64-mswin64
1105!endif # CPU
1106!if $(MSVCRT_VER) >= 70 && $(RUBY_VER) > 19
1107RUBY_PLATFORM = $(RUBY_PLATFORM)_$(MSVCRT_VER)
1108!endif # MSVCRT_VER
1109!endif # RUBY_PLATFORM
1110
1111!ifndef RUBY_INSTALL_NAME
1112!ifndef RUBY_MSVCRT_NAME
1113# Base name of msvcrXX.dll which is used by ruby's dll.
1114RUBY_MSVCRT_NAME = $(MSVCRT_NAME)
1115!endif # RUBY_MSVCRT_NAME
1116!if "$(CPU)" == "i386"
1117RUBY_INSTALL_NAME = $(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
1118!else # CPU
1119RUBY_INSTALL_NAME = x64-$(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
1120!endif # CPU
1121!endif # RUBY_INSTALL_NAME
1122
1123!else # $(RUBY_VER) >= 18
1124
1125!ifndef RUBY_PLATFORM
1126RUBY_PLATFORM = i586-mswin32
1127!endif
1128!ifndef RUBY_INSTALL_NAME
1129RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_API_VER)
1130!endif
1131
1132!endif # $(RUBY_VER) >= 18
1133
1134!message Ruby requested (version $(RUBY_VER)) - root dir is "$(RUBY)"
1135CFLAGS = $(CFLAGS) -DFEAT_RUBY
1136RUBY_OBJ = $(OUTDIR)\if_ruby.obj
1137!if $(RUBY_VER) >= 19
1138RUBY_INC = /I "$(RUBY)\include\ruby-$(RUBY_API_VER_LONG)" /I "$(RUBY)\include\ruby-$(RUBY_API_VER_LONG)\$(RUBY_PLATFORM)"
1139!else
1140RUBY_INC = /I "$(RUBY)\lib\ruby\$(RUBY_API_VER_LONG)\$(RUBY_PLATFORM)"
1141!endif
1142RUBY_LIB = $(RUBY)\lib\$(RUBY_INSTALL_NAME).lib
1143# Do we want to load Ruby dynamically?
1144!if "$(DYNAMIC_RUBY)" == "yes"
1145!message Ruby DLL will be loaded dynamically
1146CFLAGS = $(CFLAGS) -DDYNAMIC_RUBY -DDYNAMIC_RUBY_VER=$(RUBY_VER) \
1147		-DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\"
1148!undef RUBY_LIB
1149!endif
1150!endif # RUBY
1151
1152#
1153# Support PostScript printing
1154#
1155!if "$(POSTSCRIPT)" == "yes"
1156CFLAGS = $(CFLAGS) -DMSWINPS
1157!endif # POSTSCRIPT
1158
1159#
1160# FEATURES: TINY, SMALL, NORMAL, BIG or HUGE
1161#
1162CFLAGS = $(CFLAGS) -DFEAT_$(FEATURES)
1163
1164#
1165# Always generate the .pdb file, so that we get debug symbols that can be used
1166# on a crash (doesn't add overhead to the executable).
1167# Generate edit-and-continue debug info when no optimization - allows to
1168# debug more conveniently (able to look at variables which are in registers)
1169#
1170CFLAGS = $(CFLAGS) /Fd$(OUTDIR)/ $(DEBUGINFO)
1171LINK_PDB = /PDB:$(VIM).pdb -debug
1172
1173#
1174# End extra feature include
1175#
1176!message
1177
1178# CFLAGS with /Fo$(OUTDIR)/
1179CFLAGS_OUTDIR=$(CFLAGS) /Fo$(OUTDIR)/
1180
1181# Add /opt:ref to remove unreferenced functions and data even when /DEBUG is
1182# added.
1183conflags = /nologo /subsystem:$(SUBSYSTEM) /opt:ref
1184
1185PATHDEF_SRC = $(OUTDIR)\pathdef.c
1186
1187!IF "$(MAP)" == "yes"
1188# "/map" is for debugging
1189conflags = $(conflags) /map
1190!ELSEIF "$(MAP)" == "lines"
1191# "/mapinfo:lines" is for debugging, only works for VC6 and later
1192conflags = $(conflags) /map /mapinfo:lines
1193!ENDIF
1194
1195LINKARGS1 = $(linkdebug) $(conflags)
1196LINKARGS2 = $(CON_LIB) $(GUI_LIB) $(NODEFAULTLIB) $(LIBC) $(OLE_LIB) user32.lib \
1197		$(LUA_LIB) $(MZSCHEME_LIB) $(PERL_LIB) $(PYTHON_LIB) $(PYTHON3_LIB) $(RUBY_LIB) \
1198		$(TCL_LIB) $(NETBEANS_LIB) $(XPM_LIB) $(LINK_PDB)
1199
1200# Report link time code generation progress if used.
1201!ifdef NODEBUG
1202!if $(MSVC_MAJOR) >= 8
1203!if "$(OPTIMIZE)" != "SPACE"
1204LINKARGS1 = $(LINKARGS1) /LTCG:STATUS
1205!endif
1206!endif
1207!endif
1208
1209!if $(MSVC_MAJOR) >= 11 && "$(CPU)" == "AMD64" && "$(GUI)" == "yes"
1210# This option is required for VC2012 or later so that 64-bit gvim can
1211# accept D&D from 32-bit applications.  NOTE: This disables 64-bit ASLR,
1212# therefore the security level becomes as same as VC2010.
1213LINKARGS1 = $(LINKARGS1) /HIGHENTROPYVA:NO
1214!endif
1215
1216all:	$(VIM).exe \
1217	vimrun.exe \
1218	install.exe \
1219	uninstal.exe \
1220	xxd/xxd.exe \
1221	tee/tee.exe \
1222	GvimExt/gvimext.dll
1223
1224$(VIM).exe: $(OUTDIR) $(OBJ) $(XDIFF_OBJ) $(GUI_OBJ) $(CUI_OBJ) $(OLE_OBJ) $(OLE_IDL) $(MZSCHEME_OBJ) \
1225		$(LUA_OBJ) $(PERL_OBJ) $(PYTHON_OBJ) $(PYTHON3_OBJ) $(RUBY_OBJ) $(TCL_OBJ) \
1226		$(CSCOPE_OBJ) $(TERM_OBJ) $(NETBEANS_OBJ) $(CHANNEL_OBJ) $(XPM_OBJ) \
1227		version.c version.h
1228	$(CC) $(CFLAGS_OUTDIR) version.c
1229	$(link) $(LINKARGS1) -out:$(VIM).exe $(OBJ) $(XDIFF_OBJ) $(GUI_OBJ) $(CUI_OBJ) $(OLE_OBJ) \
1230		$(LUA_OBJ) $(MZSCHEME_OBJ) $(PERL_OBJ) $(PYTHON_OBJ) $(PYTHON3_OBJ) $(RUBY_OBJ) \
1231		$(TCL_OBJ) $(CSCOPE_OBJ) $(TERM_OBJ) $(NETBEANS_OBJ) $(CHANNEL_OBJ) \
1232		$(XPM_OBJ) $(OUTDIR)\version.obj $(LINKARGS2)
1233	if exist $(VIM).exe.manifest mt.exe -nologo -manifest $(VIM).exe.manifest -updateresource:$(VIM).exe;1
1234
1235$(VIM): $(VIM).exe
1236
1237$(OUTDIR):
1238	if not exist $(OUTDIR)/nul  mkdir $(OUTDIR)
1239
1240install.exe: dosinst.c
1241	$(CC) /nologo -DNDEBUG -DWIN32 dosinst.c kernel32.lib shell32.lib \
1242		user32.lib ole32.lib advapi32.lib uuid.lib \
1243		-link -subsystem:$(SUBSYSTEM_TOOLS)
1244	- if exist install.exe del install.exe
1245	ren dosinst.exe install.exe
1246
1247uninstal.exe: uninstal.c
1248	$(CC) /nologo -DNDEBUG -DWIN32 uninstal.c shell32.lib advapi32.lib \
1249		-link -subsystem:$(SUBSYSTEM_TOOLS)
1250
1251vimrun.exe: vimrun.c
1252	$(CC) /nologo -DNDEBUG vimrun.c -link -subsystem:$(SUBSYSTEM_TOOLS)
1253
1254xxd/xxd.exe: xxd/xxd.c
1255	cd xxd
1256	$(MAKE) /NOLOGO -f Make_mvc.mak $(MAKEFLAGS_TOOLS)
1257	cd ..
1258
1259tee/tee.exe: tee/tee.c
1260	cd tee
1261	$(MAKE) /NOLOGO -f Make_mvc.mak $(MAKEFLAGS_TOOLS)
1262	cd ..
1263
1264GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h
1265	cd GvimExt
1266	$(MAKE) /NOLOGO -f Makefile $(MAKEFLAGS_GVIMEXT)
1267	cd ..
1268
1269
1270tags: notags
1271	$(CTAGS) $(TAGS_FILES)
1272
1273notags:
1274	- if exist tags del tags
1275
1276clean:
1277	- if exist $(OUTDIR)/nul $(DEL_TREE) $(OUTDIR)
1278	- if exist *.obj del *.obj
1279	- if exist $(VIM).exe del $(VIM).exe
1280	- if exist $(VIM).ilk del $(VIM).ilk
1281	- if exist $(VIM).pdb del $(VIM).pdb
1282	- if exist $(VIM).map del $(VIM).map
1283	- if exist $(VIM).ncb del $(VIM).ncb
1284	- if exist vimrun.exe del vimrun.exe
1285	- if exist install.exe del install.exe
1286	- if exist uninstal.exe del uninstal.exe
1287	- if exist if_perl.c del if_perl.c
1288	- if exist auto\if_perl.c del auto\if_perl.c
1289	- if exist dimm.h del dimm.h
1290	- if exist dimm_i.c del dimm_i.c
1291	- if exist dimm.tlb del dimm.tlb
1292	- if exist dosinst.exe del dosinst.exe
1293	cd xxd
1294	$(MAKE) /NOLOGO -f Make_mvc.mak clean
1295	cd ..
1296	cd tee
1297	$(MAKE) /NOLOGO -f Make_mvc.mak clean
1298	cd ..
1299	cd GvimExt
1300	$(MAKE) /NOLOGO -f Makefile clean
1301	cd ..
1302	- if exist testdir\*.out del testdir\*.out
1303
1304test:
1305	cd testdir
1306	$(MAKE) /NOLOGO -f Make_dos.mak win32
1307	cd ..
1308
1309testgvim:
1310	cd testdir
1311	$(MAKE) /NOLOGO -f Make_dos.mak VIMPROG=..\gvim win32
1312	cd ..
1313
1314testclean:
1315	cd testdir
1316	$(MAKE) /NOLOGO -f Make_dos.mak clean
1317	cd ..
1318
1319$(NEW_TESTS):
1320	cd testdir
1321	- if exist [email protected] del [email protected]
1322	$(MAKE) /NOLOGO -f Make_dos.mak nolog
1323	$(MAKE) /NOLOGO -f Make_dos.mak [email protected]
1324	$(MAKE) /NOLOGO -f Make_dos.mak report
1325	type messages
1326	cd ..
1327
1328###########################################################################
1329
1330# Create a default rule for transforming .c files to .obj files in $(OUTDIR)
1331# Batch compilation is supported by nmake 1.62 (part of VS 5.0) and later)
1332!IF "$(_NMAKE_VER)" == ""
1333.c{$(OUTDIR)/}.obj:
1334!ELSE
1335.c{$(OUTDIR)/}.obj::
1336!ENDIF
1337	$(CC) $(CFLAGS_OUTDIR) $<
1338
1339# Create a default rule for transforming .cpp files to .obj files in $(OUTDIR)
1340# Batch compilation is supported by nmake 1.62 (part of VS 5.0) and later)
1341!IF "$(_NMAKE_VER)" == ""
1342.cpp{$(OUTDIR)/}.obj:
1343!ELSE
1344.cpp{$(OUTDIR)/}.obj::
1345!ENDIF
1346	$(CC) $(CFLAGS_OUTDIR) $<
1347
1348$(OUTDIR)/arabic.obj:	$(OUTDIR) arabic.c  $(INCL)
1349
1350$(OUTDIR)/autocmd.obj:	$(OUTDIR) autocmd.c  $(INCL)
1351
1352$(OUTDIR)/beval.obj:	$(OUTDIR) beval.c  $(INCL)
1353
1354$(OUTDIR)/blob.obj:	$(OUTDIR) blob.c  $(INCL)
1355
1356$(OUTDIR)/blowfish.obj:	$(OUTDIR) blowfish.c  $(INCL)
1357
1358$(OUTDIR)/buffer.obj:	$(OUTDIR) buffer.c  $(INCL)
1359
1360$(OUTDIR)/charset.obj:	$(OUTDIR) charset.c  $(INCL)
1361
1362$(OUTDIR)/crypt.obj:	$(OUTDIR) crypt.c  $(INCL)
1363
1364$(OUTDIR)/crypt_zip.obj: $(OUTDIR) crypt_zip.c  $(INCL)
1365
1366$(OUTDIR)/dict.obj:	$(OUTDIR) dict.c  $(INCL)
1367
1368$(OUTDIR)/diff.obj:	$(OUTDIR) diff.c  $(INCL)
1369
1370$(OUTDIR)/xdiffi.obj:	$(OUTDIR) xdiff/xdiffi.c  $(XDIFF_DEPS)
1371	$(CC) $(CFLAGS_OUTDIR) xdiff/xdiffi.c
1372
1373$(OUTDIR)/xemit.obj:	$(OUTDIR) xdiff/xemit.c  $(XDIFF_DEPS)
1374	$(CC) $(CFLAGS_OUTDIR) xdiff/xemit.c
1375
1376$(OUTDIR)/xprepare.obj:	$(OUTDIR) xdiff/xprepare.c  $(XDIFF_DEPS)
1377	$(CC) $(CFLAGS_OUTDIR) xdiff/xprepare.c
1378
1379$(OUTDIR)/xutils.obj:	$(OUTDIR) xdiff/xutils.c  $(XDIFF_DEPS)
1380	$(CC) $(CFLAGS_OUTDIR) xdiff/xutils.c
1381
1382$(OUTDIR)/xhistogram.obj:	$(OUTDIR) xdiff/xhistogram.c  $(XDIFF_DEPS)
1383	$(CC) $(CFLAGS_OUTDIR) xdiff/xhistogram.c
1384
1385$(OUTDIR)/xpatience.obj:	$(OUTDIR) xdiff/xpatience.c  $(XDIFF_DEPS)
1386	$(CC) $(CFLAGS_OUTDIR) xdiff/xpatience.c
1387
1388$(OUTDIR)/digraph.obj:	$(OUTDIR) digraph.c  $(INCL)
1389
1390$(OUTDIR)/edit.obj:	$(OUTDIR) edit.c  $(INCL)
1391
1392$(OUTDIR)/eval.obj:	$(OUTDIR) eval.c  $(INCL)
1393
1394$(OUTDIR)/evalfunc.obj:	$(OUTDIR) evalfunc.c  $(INCL)
1395
1396$(OUTDIR)/ex_cmds.obj:	$(OUTDIR) ex_cmds.c  $(INCL)
1397
1398$(OUTDIR)/ex_cmds2.obj:	$(OUTDIR) ex_cmds2.c  $(INCL)
1399
1400$(OUTDIR)/ex_docmd.obj:	$(OUTDIR) ex_docmd.c  $(INCL)
1401
1402$(OUTDIR)/ex_eval.obj:	$(OUTDIR) ex_eval.c  $(INCL)
1403
1404$(OUTDIR)/ex_getln.obj:	$(OUTDIR) ex_getln.c  $(INCL)
1405
1406$(OUTDIR)/farsi.obj:	$(OUTDIR) farsi.c  $(INCL)
1407
1408$(OUTDIR)/fileio.obj:	$(OUTDIR) fileio.c  $(INCL)
1409
1410$(OUTDIR)/fold.obj:	$(OUTDIR) fold.c  $(INCL)
1411
1412$(OUTDIR)/getchar.obj:	$(OUTDIR) getchar.c  $(INCL)
1413
1414$(OUTDIR)/hardcopy.obj:	$(OUTDIR) hardcopy.c  $(INCL)
1415
1416$(OUTDIR)/hashtab.obj:	$(OUTDIR) hashtab.c  $(INCL)
1417
1418$(OUTDIR)/indent.obj:	$(OUTDIR) indent.c  $(INCL)
1419
1420$(OUTDIR)/gui.obj:	$(OUTDIR) gui.c  $(INCL) $(GUI_INCL)
1421
1422$(OUTDIR)/gui_beval.obj:	$(OUTDIR) gui_beval.c $(INCL) $(GUI_INCL)
1423
1424$(OUTDIR)/gui_w32.obj:	$(OUTDIR) gui_w32.c $(INCL) $(GUI_INCL)
1425
1426$(OUTDIR)/gui_dwrite.obj:	$(OUTDIR) gui_dwrite.cpp $(INCL) $(GUI_INCL)
1427
1428$(OUTDIR)/if_cscope.obj: $(OUTDIR) if_cscope.c  $(INCL) if_cscope.h
1429
1430$(OUTDIR)/if_lua.obj: $(OUTDIR) if_lua.c  $(INCL)
1431	$(CC) $(CFLAGS_OUTDIR) $(LUA_INC) if_lua.c
1432
1433auto/if_perl.c : if_perl.xs typemap
1434	$(XSUBPP) -prototypes -typemap $(XSUBPP_TYPEMAP) \
1435		-typemap typemap if_perl.xs -output $@
1436
1437$(OUTDIR)/if_perl.obj: $(OUTDIR) auto/if_perl.c  $(INCL)
1438	$(CC) $(CFLAGS_OUTDIR) $(PERL_INC) auto/if_perl.c
1439
1440$(OUTDIR)/if_perlsfio.obj: $(OUTDIR) if_perlsfio.c  $(INCL)
1441	$(CC) $(CFLAGS_OUTDIR) $(PERL_INC) if_perlsfio.c
1442
1443$(OUTDIR)/if_mzsch.obj: $(OUTDIR) if_mzsch.c $(MZSCHEME_INCL) $(INCL) $(MZSCHEME_EXTRA_DEP)
1444	$(CC) $(CFLAGS_OUTDIR) if_mzsch.c \
1445		-DMZSCHEME_COLLECTS="\"$(MZSCHEME_COLLECTS:\=\\)\""
1446
1447lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib:
1448	lib /DEF:"$(MZSCHEME)\lib\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).def"
1449
1450$(OUTDIR)/if_python.obj: $(OUTDIR) if_python.c if_py_both.h $(INCL)
1451	$(CC) $(CFLAGS_OUTDIR) $(PYTHON_INC) if_python.c
1452
1453$(OUTDIR)/if_python3.obj: $(OUTDIR) if_python3.c if_py_both.h $(INCL)
1454	$(CC) $(CFLAGS_OUTDIR) $(PYTHON3_INC) if_python3.c
1455
1456$(OUTDIR)/if_ole.obj: $(OUTDIR) if_ole.cpp  $(INCL) if_ole.h
1457
1458$(OUTDIR)/if_ruby.obj: $(OUTDIR) if_ruby.c  $(INCL)
1459	$(CC) $(CFLAGS_OUTDIR) $(RUBY_INC) if_ruby.c
1460
1461$(OUTDIR)/if_tcl.obj: $(OUTDIR) if_tcl.c  $(INCL)
1462	$(CC) $(CFLAGS_OUTDIR) $(TCL_INC) if_tcl.c
1463
1464$(OUTDIR)/iscygpty.obj:	$(OUTDIR) iscygpty.c $(CUI_INCL)
1465	$(CC) $(CFLAGS_OUTDIR) iscygpty.c -D_WIN32_WINNT=0x0600 -DUSE_DYNFILEID -DENABLE_STUB_IMPL
1466
1467$(OUTDIR)/json.obj:	$(OUTDIR) json.c  $(INCL)
1468
1469$(OUTDIR)/list.obj:	$(OUTDIR) list.c  $(INCL)
1470
1471$(OUTDIR)/main.obj:	$(OUTDIR) main.c  $(INCL) $(CUI_INCL)
1472
1473$(OUTDIR)/mark.obj:	$(OUTDIR) mark.c  $(INCL)
1474
1475$(OUTDIR)/memfile.obj:	$(OUTDIR) memfile.c  $(INCL)
1476
1477$(OUTDIR)/memline.obj:	$(OUTDIR) memline.c  $(INCL)
1478
1479$(OUTDIR)/menu.obj:	$(OUTDIR) menu.c  $(INCL)
1480
1481$(OUTDIR)/message.obj:	$(OUTDIR) message.c  $(INCL)
1482
1483$(OUTDIR)/misc1.obj:	$(OUTDIR) misc1.c  $(INCL)
1484
1485$(OUTDIR)/misc2.obj:	$(OUTDIR) misc2.c  $(INCL)
1486
1487$(OUTDIR)/move.obj:	$(OUTDIR) move.c  $(INCL)
1488
1489$(OUTDIR)/mbyte.obj: $(OUTDIR) mbyte.c  $(INCL)
1490
1491$(OUTDIR)/netbeans.obj: $(OUTDIR) netbeans.c $(NBDEBUG_SRC) $(INCL)
1492
1493$(OUTDIR)/channel.obj: $(OUTDIR) channel.c $(INCL)
1494
1495$(OUTDIR)/normal.obj:	$(OUTDIR) normal.c  $(INCL)
1496
1497$(OUTDIR)/option.obj:	$(OUTDIR) option.c  $(INCL)
1498
1499$(OUTDIR)/ops.obj:	$(OUTDIR) ops.c  $(INCL)
1500
1501$(OUTDIR)/os_mswin.obj:	$(OUTDIR) os_mswin.c  $(INCL)
1502
1503$(OUTDIR)/terminal.obj:	$(OUTDIR) terminal.c  $(INCL) $(TERM_DEPS)
1504
1505$(OUTDIR)/winclip.obj:	$(OUTDIR) winclip.c  $(INCL)
1506
1507$(OUTDIR)/os_win32.obj:	$(OUTDIR) os_win32.c  $(INCL) $(MZSCHEME_INCL)
1508
1509$(OUTDIR)/os_w32exe.obj:	$(OUTDIR) os_w32exe.c  $(INCL)
1510
1511$(OUTDIR)/pathdef.obj:	$(OUTDIR) $(PATHDEF_SRC) $(INCL)
1512	$(CC) $(CFLAGS_OUTDIR) $(PATHDEF_SRC)
1513
1514$(OUTDIR)/popupmnu.obj:	$(OUTDIR) popupmnu.c  $(INCL)
1515
1516$(OUTDIR)/quickfix.obj:	$(OUTDIR) quickfix.c  $(INCL)
1517
1518$(OUTDIR)/regexp.obj:	$(OUTDIR) regexp.c regexp_nfa.c  $(INCL)
1519
1520$(OUTDIR)/screen.obj:	$(OUTDIR) screen.c  $(INCL)
1521
1522$(OUTDIR)/search.obj:	$(OUTDIR) search.c  $(INCL)
1523
1524$(OUTDIR)/sha256.obj:	$(OUTDIR) sha256.c  $(INCL)
1525
1526$(OUTDIR)/sign.obj:	$(OUTDIR) sign.c  $(INCL)
1527
1528$(OUTDIR)/spell.obj:	$(OUTDIR) spell.c  $(INCL)
1529
1530$(OUTDIR)/spellfile.obj:	$(OUTDIR) spellfile.c  $(INCL)
1531
1532$(OUTDIR)/syntax.obj:	$(OUTDIR) syntax.c  $(INCL)
1533
1534$(OUTDIR)/tag.obj:	$(OUTDIR) tag.c  $(INCL)
1535
1536$(OUTDIR)/term.obj:	$(OUTDIR) term.c  $(INCL)
1537
1538$(OUTDIR)/textprop.obj:	$(OUTDIR) textprop.c  $(INCL)
1539
1540$(OUTDIR)/ui.obj:	$(OUTDIR) ui.c  $(INCL)
1541
1542$(OUTDIR)/undo.obj:	$(OUTDIR) undo.c  $(INCL)
1543
1544$(OUTDIR)/userfunc.obj:	$(OUTDIR) userfunc.c  $(INCL)
1545
1546$(OUTDIR)/window.obj:	$(OUTDIR) window.c  $(INCL)
1547
1548$(OUTDIR)/xpm_w32.obj: $(OUTDIR) xpm_w32.c
1549	$(CC) $(CFLAGS_OUTDIR) $(XPM_INC) xpm_w32.c
1550
1551$(OUTDIR)/vim.res:	$(OUTDIR) vim.rc gvim.exe.mnf version.h tools.bmp \
1552				tearoff.bmp vim.ico vim_error.ico \
1553				vim_alert.ico vim_info.ico vim_quest.ico
1554	$(RC) /nologo /l 0x409 /Fo$(OUTDIR)/vim.res $(RCFLAGS) vim.rc
1555
1556iid_ole.c if_ole.h vim.tlb: if_ole.idl
1557	midl /nologo /error none /proxy nul /iid iid_ole.c /tlb vim.tlb \
1558		/header if_ole.h if_ole.idl
1559
1560dimm.h dimm_i.c: dimm.idl
1561	midl /nologo /error none /proxy nul dimm.idl
1562
1563$(OUTDIR)/dimm_i.obj: $(OUTDIR) dimm_i.c $(INCL)
1564
1565$(OUTDIR)/glbl_ime.obj:	$(OUTDIR) glbl_ime.cpp  dimm.h $(INCL)
1566
1567
1568CCCTERM = $(CC) $(CFLAGS) -Ilibvterm/include -DINLINE="" \
1569	-DVSNPRINTF=vim_vsnprintf \
1570	-DIS_COMBINING_FUNCTION=utf_iscomposing_uint \
1571	-DWCWIDTH_FUNCTION=utf_uint2cells \
1572	-D_CRT_SECURE_NO_WARNINGS
1573
1574$(OUTDIR)/encoding.obj: $(OUTDIR) libvterm/src/encoding.c $(TERM_DEPS)
1575	$(CCCTERM) -Fo$@ libvterm/src/encoding.c
1576
1577$(OUTDIR)/keyboard.obj: $(OUTDIR) libvterm/src/keyboard.c $(TERM_DEPS)
1578	$(CCCTERM) -Fo$@ libvterm/src/keyboard.c
1579
1580$(OUTDIR)/mouse.obj: $(OUTDIR) libvterm/src/mouse.c $(TERM_DEPS)
1581	$(CCCTERM) -Fo$@ libvterm/src/mouse.c
1582
1583$(OUTDIR)/parser.obj: $(OUTDIR) libvterm/src/parser.c $(TERM_DEPS)
1584	$(CCCTERM) -Fo$@ libvterm/src/parser.c
1585
1586$(OUTDIR)/pen.obj: $(OUTDIR) libvterm/src/pen.c $(TERM_DEPS)
1587	$(CCCTERM) -Fo$@ libvterm/src/pen.c
1588
1589$(OUTDIR)/termscreen.obj: $(OUTDIR) libvterm/src/termscreen.c $(TERM_DEPS)
1590	$(CCCTERM) -Fo$@ libvterm/src/termscreen.c
1591
1592$(OUTDIR)/state.obj: $(OUTDIR) libvterm/src/state.c $(TERM_DEPS)
1593	$(CCCTERM) -Fo$@ libvterm/src/state.c
1594
1595$(OUTDIR)/unicode.obj: $(OUTDIR) libvterm/src/unicode.c $(TERM_DEPS)
1596	$(CCCTERM) -Fo$@ libvterm/src/unicode.c
1597
1598$(OUTDIR)/vterm.obj: $(OUTDIR) libvterm/src/vterm.c $(TERM_DEPS)
1599	$(CCCTERM) -Fo$@ libvterm/src/vterm.c
1600
1601
1602# $CFLAGS may contain backslashes and double quotes, escape them both.
1603E0_CFLAGS = $(CFLAGS:\=\\)
1604E_CFLAGS = $(E0_CFLAGS:"=\")
1605# ") stop the string
1606# $LINKARGS2 may contain backslashes and double quotes, escape them both.
1607E0_LINKARGS2 = $(LINKARGS2:\=\\)
1608E_LINKARGS2 = $(E0_LINKARGS2:"=\")
1609# ") stop the string
1610
1611$(PATHDEF_SRC): auto
1612	@echo creating $(PATHDEF_SRC)
1613	@echo /* pathdef.c */ > $(PATHDEF_SRC)
1614	@echo #include "vim.h" >> $(PATHDEF_SRC)
1615	@echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC:\=\\)"; >> $(PATHDEF_SRC)
1616	@echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR:\=\\)"; >> $(PATHDEF_SRC)
1617	@echo char_u *all_cflags = (char_u *)"$(CC:\=\\) $(E_CFLAGS)"; >> $(PATHDEF_SRC)
1618	@echo char_u *all_lflags = (char_u *)"$(link:\=\\) $(LINKARGS1:\=\\) $(E_LINKARGS2)"; >> $(PATHDEF_SRC)
1619	@echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> $(PATHDEF_SRC)
1620	@echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> $(PATHDEF_SRC)
1621
1622auto:
1623	if not exist auto/nul mkdir auto
1624
1625# End Custom Build
1626proto.h: \
1627	proto/arabic.pro \
1628	proto/autocmd.pro \
1629	proto/blob.pro \
1630	proto/blowfish.pro \
1631	proto/buffer.pro \
1632	proto/charset.pro \
1633	proto/crypt.pro \
1634	proto/crypt_zip.pro \
1635	proto/dict.pro \
1636	proto/diff.pro \
1637	proto/digraph.pro \
1638	proto/edit.pro \
1639	proto/eval.pro \
1640	proto/evalfunc.pro \
1641	proto/ex_cmds.pro \
1642	proto/ex_cmds2.pro \
1643	proto/ex_docmd.pro \
1644	proto/ex_eval.pro \
1645	proto/ex_getln.pro \
1646	proto/farsi.pro \
1647	proto/fileio.pro \
1648	proto/getchar.pro \
1649	proto/hardcopy.pro \
1650	proto/hashtab.pro \
1651	proto/indent.pro \
1652	proto/json.pro \
1653	proto/list.pro \
1654	proto/main.pro \
1655	proto/mark.pro \
1656	proto/memfile.pro \
1657	proto/memline.pro \
1658	proto/menu.pro \
1659	proto/message.pro \
1660	proto/misc1.pro \
1661	proto/misc2.pro \
1662	proto/move.pro \
1663	proto/mbyte.pro \
1664	proto/normal.pro \
1665	proto/ops.pro \
1666	proto/option.pro \
1667	proto/os_mswin.pro \
1668	proto/winclip.pro \
1669	proto/os_win32.pro \
1670	proto/popupmnu.pro \
1671	proto/quickfix.pro \
1672	proto/regexp.pro \
1673	proto/screen.pro \
1674	proto/search.pro \
1675	proto/sha256.pro \
1676	proto/sign.pro \
1677	proto/spell.pro \
1678	proto/spellfile.pro \
1679	proto/syntax.pro \
1680	proto/tag.pro \
1681	proto/term.pro \
1682	proto/textprop.pro \
1683	proto/ui.pro \
1684	proto/undo.pro \
1685	proto/userfunc.pro \
1686	proto/window.pro \
1687	$(NETBEANS_PRO) \
1688	$(CHANNEL_PRO)
1689
1690.SUFFIXES: .cod .i
1691
1692# Generate foo.cod (mixed source and assembly listing) from foo.c via "nmake
1693# foo.cod"
1694.c.cod:
1695	$(CC) $(CFLAGS) /FAcs $<
1696
1697# Generate foo.i (preprocessor listing) from foo.c via "nmake foo.i"
1698.c.i:
1699	$(CC) $(CFLAGS) /P /C $<
1700
1701# vim: set noet sw=8 ts=8 sts=0 wm=0 tw=0:
1702