xref: /vim-8.2.3635/src/Make_mvc.mak (revision 89cb5e0f)
1# Makefile for Vim on Win32 (Windows NT and Windows 95), using the
2# Microsoft Visual C++ 2.x and MSVC 4.x compilers (or newer).
3# It builds on Windows 95 and all four NT platforms: i386, Alpha, MIPS, and
4# PowerPC.  The NT/i386 binary and the Windows 95 binary are identical.
5#
6# This makefile can build the console, GUI, OLE-enable, Perl-enabled and
7# Python-enabled versions of vim for Win32 platforms.
8#
9# When compiling different versions, do "nmake clean" first!
10#
11# The basic command line to build vim is:
12#	nmake -f Make_mvc.mak
13# This will build the console version of vim with no additional interfaces.
14# To add interfaces, define any of the following:
15#	GUI interface: GUI=yes (default is no)
16#	OLE interface: OLE=yes (usually with GUI=yes)
17#	Multibyte support: MBYTE=yes
18#	IME support: IME=yes	(requires GUI=yes)
19#	  DYNAMIC_IME=[yes or no]  (to load the imm32.dll dynamically, default
20#	  is yes)
21#	Global IME support: GIME=yes (requires GUI=yes)
22#	MzScheme interface: MZSCHEME=[Path to MzScheme directory], MZSCHEME_VER=[version, 205_000, ...]
23#	Perl interface:
24#	  PERL=[Path to Perl directory]
25#	  DYNAMIC_PERL=yes (to load the Perl DLL dynamically)
26#	  PERL_VER=[Perl version, in the form 55 (5.005), 56 (5.6.x), etc] (default is 56)
27#	Python interface:
28#	  PYTHON=[Path to Python directory]
29#	  DYNAMIC_PYTHON=yes (to load the Python DLL dynamically)
30#	  PYTHON_VER=[Python version, eg 15, 20]  (default is 22)
31#	Ruby interface:
32#	  RUBY=[Path to Ruby directory]
33#	  DYNAMIC_RUBY=yes (to load the Ruby DLL dynamically)
34#	  RUBY_VER=[Ruby version, eg 16, 17] (default is 18)
35#	  RUBY_VER_LONG=[Ruby version, eg 1.6, 1.7] (default is 1.8)
36#	    You must set RUBY_VER_LONG when change RUBY_VER.
37#	Tcl interface:
38#	  TCL=[Path to Tcl directory]
39#	  DYNAMIC_TCL=yes (to load the Tcl DLL dynamically)
40#	  TCL_VER=[Tcl version, e.g. 80, 83]  (default is 83)
41#	  TCL_VER_LONG=[Tcl version, eg 8.3] (default is 8.3)
42#	    You must set TCL_VER_LONG when you set TCL_VER.
43#	Debug version: DEBUG=yes
44#	Mapfile: MAP=[no, yes or lines] (default is yes)
45#	  no:    Don't write a mapfile.
46#	  yes:   Write a normal mapfile.
47#	  lines: Write a mapfile with line numbers (only for VC6 and later)
48#	SNiFF+ interface: SNIFF=yes
49#	Cscope support: CSCOPE=yes
50#	Iconv library support (always dynamically loaded):
51#	  ICONV=[yes or no]  (default is yes)
52#	Intl library support (always dynamically loaded):
53#	  GETTEXT=[yes or no]  (default is yes)
54#	See http://sourceforge.net/projects/gettext/
55#       PostScript printing: POSTSCRIPT=yes (default is no)
56#       Feature Set: FEATURES=[TINY, SMALL, NORMAL, BIG, or HUGE] (default is BIG)
57#       Version Support: WINVER=[0x0400, 0x0500] (default is 0x0400)
58#       Processor Version: CPUNR=[i386, i486, i586, i686] (default is i386)
59#       Optimization: OPTIMIZE=[SPACE, SPEED, MAXSPEED] (default is MAXSPEED)
60#       Netbeans Support: NETBEANS=[yes or no] (default is yes if GUI is yes)
61#       Netbeans Debugging Support: NBDEBUG=[yes or no] (default is no)
62#       XPM Image Support: XPM=[path to XPM directory]
63#
64# You can combine any of these interfaces
65#
66# Example: To build the non-debug, GUI version with Perl interface:
67#	nmake -f Make_mvc.mak GUI=yes PERL=C:\Perl
68#
69# To build using Borland C++, use Make_bc3.mak or Make_bc5.mak.
70#
71# DEBUG with Make_mvc.mak and Make_dvc.mak:
72#	This makefile gives a fineness of control which is not supported in
73#	Visual C++ configuration files.  Therefore, debugging requires a bit of
74#	extra work.
75#	Make_dvc.mak is a Visual C++ project to access that support.
76#	To use Make_dvc.mak:
77#	1) Build Vim with Make_mvc.mak.
78#	     Use a "DEBUG=yes" argument to build Vim with debug support.
79#	     E.g. the following builds gvimd.exe:
80#		nmake -f Make_mvc.mak debug=yes gui=yes
81#	2) Use MS Devstudio and set it up to allow that file to be debugged:
82#	    i) Pass Make_dvc.mak to the IDE.
83#		 Use the "open workspace" menu entry to load Make_dvc.mak.
84#		 Alternatively, from the command line:
85#			msdev /nologo Make_dvc.mak
86#		Note: Make_dvc.mak is in VC4.0 format. Later VC versions see
87#		this and offer to convert it to their own format. Accept that.
88#		It creates a file called Make_dvc.dsw which can then be used
89#		for further operations.  E.g.
90#		    msdev /nologo Make_dvc.dsw
91#	    ii) Set the built executable for debugging:
92#		a) Alt+F7/Debug takes you to the Debug dialog.
93#		b) Fill "Executable for debug session". e.g. gvimd.exe
94#		c) Fill "Program arguments". e.g. -R dosinst.c
95#		d) Complete the dialog
96#	3) You can now debug the executable you built with Make_mvc.mak
97#
98#	Note: Make_dvc.mak builds vimrun.exe, because it must build something
99#	to be a valid makefile..
100
101### See feature.h for a list of optionals.
102# If you want to build some optional features without modifying the source,
103# you can set DEFINES on the command line, e.g.,
104#	nmake -f makefile.mvc "DEFINES=-DEMACS_TAGS"
105
106# Build on both Windows NT and Windows 95
107
108TARGETOS = BOTH
109
110# Select one of eight object code directories, depends on GUI, OLE and DEBUG.
111# If you change something else, do "make clean" first!
112!if "$(GUI)" == "yes"
113OBJDIR = .\ObjG
114!else
115OBJDIR = .\ObjC
116!endif
117!if "$(OLE)" == "yes"
118OBJDIR = $(OBJDIR)O
119!endif
120!ifdef MZSCHEME
121OBJDIR = $(OBJDIR)Z
122!endif
123!if "$(DEBUG)" == "yes"
124OBJDIR = $(OBJDIR)d
125!endif
126
127# ntwin32.mak requires that CPU be set appropriately
128
129!ifdef PROCESSOR_ARCHITECTURE
130# We're on Windows NT or using VC 6
131CPU = $(PROCESSOR_ARCHITECTURE)
132! if "$(CPU)" == "x86"
133CPU = i386
134! endif
135!else  # !PROCESSOR_ARCHITECTURE
136# We're on Windows 95
137CPU = i386
138!endif # !PROCESSOR_ARCHITECTURE
139
140
141# Build a retail version by default
142
143!if "$(DEBUG)" != "yes"
144NODEBUG = 1
145!else
146MAKEFLAGS_GVIMEXT = DEBUG=yes
147!endif
148
149
150# Build a multithreaded version for the Windows 95 dead keys hack
151# Commented out because it doesn't work.
152# MULTITHREADED = 1
153
154
155# Get all sorts of useful, standard macros from the SDK.  (Note that
156# MSVC 2.2 does not install <ntwin32.mak> in the \msvc20\include
157# directory, but you can find it in \msvc20\include on the CD-ROM.
158# You may also need <win32.mak> from the same place.)
159
160!include <ntwin32.mak>
161
162
163#>>>>> path of the compiler and linker; name of include and lib directories
164# PATH = c:\msvc20\bin;$(PATH)
165# INCLUDE = c:\msvc20\include
166# LIB = c:\msvc20\lib
167
168!ifndef CTAGS
169CTAGS = ctags
170!endif
171
172!if "$(SNIFF)" == "yes"
173# SNIFF - Include support for SNiFF+.
174SNIFF_INCL  = if_sniff.h
175SNIFF_OBJ   = $(OBJDIR)/if_sniff.obj
176SNIFF_LIB    = shell32.lib
177SNIFF_DEFS  = -DFEAT_SNIFF
178# The SNiFF integration needs multithreaded libraries!
179MULTITHREADED = yes
180!endif
181
182!ifndef CSCOPE
183CSCOPE = yes
184!endif
185
186!if "$(CSCOPE)" == "yes"
187# CSCOPE - Include support for Cscope
188CSCOPE_INCL  = if_cscope.h
189CSCOPE_OBJ   = $(OBJDIR)/if_cscope.obj
190CSCOPE_DEFS  = -DFEAT_CSCOPE
191!endif
192
193!ifndef NETBEANS
194NETBEANS = $(GUI)
195!endif
196
197# Only allow NETBEANS and XPM for a GUI build.
198!if "$(GUI)" == "yes"
199!if "$(NETBEANS)" == "yes"
200# NETBEANS - Include support for Netbeans integration
201NETBEANS_PRO	= proto/netbeans.pro
202NETBEANS_OBJ	= $(OBJDIR)/netbeans.obj $(OBJDIR)/gui_beval.obj
203NETBEANS_DEFS	= -DFEAT_NETBEANS_INTG
204
205!if "$(NBDEBUG)" == "yes"
206NBDEBUG_DEFS	= -DNBDEBUG
207NBDEBUG_INCL	= nbdebug.h
208NBDEBUG_SRC	= nbdebug.c
209!endif
210NETBEANS_LIB   = WSock32.lib
211!endif
212
213!ifdef XPM
214# XPM - Include support for XPM signs
215# you can get xpm.lib from http://iamphet.nm.ru/xpm or create it yourself
216XPM_OBJ   = $(OBJDIR)/xpm_w32.obj
217XPM_DEFS  = -DFEAT_XPM_W32
218XPM_LIB   = $(XPM)\lib\libXpm.lib
219XPM_INC	  = -I $(XPM)\include
220!endif
221!endif
222
223!if defined(USE_MSVCRT)
224CVARS = $(cvarsdll)
225!elseif defined(MULTITHREADED)
226CVARS = $(cvarsmt)
227!else
228CVARS = $(cvars)
229!endif
230
231# need advapi32.lib for GetUserName()
232# need shell32.lib for ExtractIcon()
233# gdi32.lib and comdlg32.lib for printing support
234# ole32.lib and uuid.lib are needed for FEAT_SHORTCUT
235CON_LIB = advapi32.lib shell32.lib gdi32.lib comdlg32.lib ole32.lib uuid.lib
236!if "$(VC6)" == "yes"
237CON_LIB = $(CON_LIB) /DELAYLOAD:comdlg32.dll /DELAYLOAD:ole32.dll DelayImp.lib
238!endif
239
240### Set the default $(WINVER) to make it work with VC++7.0 (VS.NET)
241#  When set to 0x0500 ":browse" stops working.
242!ifndef WINVER
243WINVER = 0x0400
244!endif
245
246# If you have a fixed directory for $VIM or $VIMRUNTIME, other than the normal
247# default, use these lines.
248#VIMRCLOC = somewhere
249#VIMRUNTIMEDIR = somewhere
250
251CFLAGS = -c /W3 /nologo $(CVARS) -I. -Iproto -DHAVE_PATHDEF -DWIN32 \
252		$(SNIFF_DEFS) $(CSCOPE_DEFS) $(NETBEANS_DEFS) \
253		$(NBDEBUG_DEFS) $(XPM_DEFS) \
254		$(DEFINES) -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER)
255
256#>>>>> end of choices
257###########################################################################
258
259!ifdef OS
260OS_TYPE	= winnt
261DEL_TREE = rmdir /s /q
262!else
263OS_TYPE	= win95
264DEL_TREE = deltree /y
265!endif
266
267INTDIR=$(OBJDIR)
268OUTDIR=$(OBJDIR)
269
270# Convert processor ID to MVC-compatible number
271!if "$(CPUNR)" == "i386"
272CPUARG = /G3
273!elseif "$(CPUNR)" == "i486"
274CPUARG = /G4
275!elseif "$(CPUNR)" == "i586"
276CPUARG = /G5
277!elseif "$(CPUNR)" == "i686"
278CPUARG = /G6
279!else
280CPUARG =
281!endif
282
283!ifdef NODEBUG
284VIM = vim
285!if "$(OPTIMIZE)" == "SPACE"
286OPTFLAG = /O1
287!elseif "$(OPTIMIZE)" == "SPEED"
288OPTFLAG = /O2
289!else # MAXSPEED
290OPTFLAG = /Ox
291!endif
292CFLAGS = $(CFLAGS) $(OPTFLAG) -DNDEBUG /Zi $(CPUARG)
293RCFLAGS = $(rcflags) $(rcvars) -DNDEBUG
294PDB = /Fd$(OUTDIR)/
295LINK_PDB = /PDB:$(OUTDIR)/
296! ifdef USE_MSVCRT
297CFLAGS = $(CFLAGS) -MD
298LIBC = msvcrt.lib
299! elseif defined(MULTITHREADED)
300LIBC = libcmt.lib
301! else
302LIBC = libc.lib
303! endif
304!else  # DEBUG
305VIM = vimd
306# MSVC 4.1
307PDB = /Fd$(OUTDIR)/
308LINK_PDB = /PDB:$(OUTDIR)/
309# MSVC 2.2
310# PDB = /Fd$(OUTDIR)/vim.pdb
311# LINK_PDB = /PDB:$(OUTDIR)/vim.pdb
312CFLAGS = $(CFLAGS) -D_DEBUG -DDEBUG /Zi /Od
313RCFLAGS = $(rcflags) $(rcvars) -D_DEBUG -DDEBUG
314# The /fixed:no is needed for Quantify. Assume not 4.? as unsupported in VC4.0.
315! if "$(_NMAKE_VER)" == ""
316LIBC =
317! else
318LIBC = /fixed:no
319! endif
320
321! ifndef USE_MSVCRT
322LIBC = $(LIBC) libcd.lib
323! else
324CFLAGS = $(CFLAGS) -MDd
325LIBC = $(LIBC) msvcrtd.lib
326! endif
327!endif # DEBUG
328
329INCL =	vim.h os_win32.h ascii.h feature.h globals.h keymap.h macros.h \
330	proto.h option.h structs.h term.h $(SNIFF_INCL) $(CSCOPE_INCL) \
331	$(NBDEBUG_INCL)
332
333OBJ = \
334	$(OUTDIR)\buffer.obj \
335	$(OUTDIR)\charset.obj \
336	$(OUTDIR)\diff.obj \
337	$(OUTDIR)\digraph.obj \
338	$(OUTDIR)\edit.obj \
339	$(OUTDIR)\eval.obj \
340	$(OUTDIR)\ex_cmds.obj \
341	$(OUTDIR)\ex_cmds2.obj \
342	$(OUTDIR)\ex_docmd.obj \
343	$(OUTDIR)\ex_eval.obj \
344	$(OUTDIR)\ex_getln.obj \
345	$(OUTDIR)\fileio.obj \
346	$(OUTDIR)\fold.obj \
347	$(OUTDIR)\getchar.obj \
348	$(OUTDIR)\main.obj \
349	$(OUTDIR)\mark.obj \
350	$(OUTDIR)\mbyte.obj \
351	$(OUTDIR)\memfile.obj \
352	$(OUTDIR)\memline.obj \
353	$(OUTDIR)\menu.obj \
354	$(OUTDIR)\message.obj \
355	$(OUTDIR)\misc1.obj \
356	$(OUTDIR)\misc2.obj \
357	$(OUTDIR)\move.obj \
358	$(OUTDIR)\normal.obj \
359	$(OUTDIR)\ops.obj \
360	$(OUTDIR)\option.obj \
361	$(OUTDIR)\os_mswin.obj \
362	$(OUTDIR)\os_win32.obj \
363	$(OUTDIR)\pathdef.obj \
364	$(OUTDIR)\quickfix.obj \
365	$(OUTDIR)\regexp.obj \
366	$(OUTDIR)\screen.obj \
367	$(OUTDIR)\search.obj \
368	$(OUTDIR)\syntax.obj \
369	$(OUTDIR)\tag.obj \
370	$(OUTDIR)\term.obj \
371	$(OUTDIR)\ui.obj \
372	$(OUTDIR)\undo.obj \
373	$(OUTDIR)\window.obj \
374	$(OUTDIR)\vim.res
375
376!if "$(OLE)" == "yes"
377CFLAGS = $(CFLAGS) -DFEAT_OLE
378RCFLAGS = $(RCFLAGS) -DFEAT_OLE
379OLE_OBJ = $(OUTDIR)\if_ole.obj
380OLE_IDL = if_ole.idl
381OLE_LIB = oleaut32.lib
382!endif
383
384!if "$(IME)" == "yes"
385CFLAGS = $(CFLAGS) -DFEAT_MBYTE_IME
386!ifndef DYNAMIC_IME
387DYNAMIC_IME = yes
388!endif
389!if "$(DYNAMIC_IME)" == "yes"
390CFLAGS = $(CFLAGS) -DDYNAMIC_IME
391!else
392IME_LIB = imm32.lib
393!endif
394!endif
395
396!if "$(GIME)" == "yes"
397CFLAGS = $(CFLAGS) -DGLOBAL_IME
398OBJ = $(OBJ) $(OUTDIR)\dimm_i.obj $(OUTDIR)\glbl_ime.obj
399MBYTE = yes
400!endif
401
402!if "$(MBYTE)" == "yes"
403CFLAGS = $(CFLAGS) -DFEAT_MBYTE
404!endif
405
406!if "$(GUI)" == "yes"
407SUBSYSTEM = windows
408CFLAGS = $(CFLAGS) -DFEAT_GUI_W32
409RCFLAGS = $(RCFLAGS) -DFEAT_GUI_W32
410VIM = g$(VIM)
411GUI_INCL = \
412	gui.h \
413	regexp.h \
414	ascii.h \
415	ex_cmds.h \
416	farsi.h \
417	feature.h \
418	globals.h \
419	keymap.h \
420	macros.h \
421	option.h \
422	os_dos.h \
423	os_win32.h
424GUI_OBJ = \
425	$(OUTDIR)\gui.obj \
426	$(OUTDIR)\gui_w32.obj \
427	$(OUTDIR)\os_w32exe.obj
428GUI_LIB = \
429	oldnames.lib kernel32.lib gdi32.lib $(IME_LIB) \
430	winspool.lib comctl32.lib advapi32.lib shell32.lib \
431	/machine:$(CPU) /nodefaultlib
432!else
433SUBSYSTEM = console
434!endif
435
436# iconv.dll library (dynamically loaded)
437!ifndef ICONV
438ICONV = yes
439!endif
440!if "$(ICONV)" == "yes"
441CFLAGS = $(CFLAGS) -DDYNAMIC_ICONV
442!endif
443
444# libintl.dll library
445!ifndef GETTEXT
446GETTEXT = yes
447!endif
448!if "$(GETTEXT)" == "yes"
449CFLAGS = $(CFLAGS) -DDYNAMIC_GETTEXT
450!endif
451
452# TCL interface
453!ifdef TCL
454!ifndef TCL_VER
455TCL_VER = 83
456TCL_VER_LONG = 8.3
457!endif
458!message Tcl requested (version $(TCL_VER)) - root dir is "$(TCL)"
459!if "$(DYNAMIC_TCL)" == "yes"
460!message Tcl DLL will be loaded dynamically
461TCL_DLL = tcl$(TCL_VER).dll
462CFLAGS  = $(CFLAGS) -DFEAT_TCL -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"$(TCL_DLL)\" -DDYNAMIC_TCL_VER=\"$(TCL_VER_LONG)\"
463TCL_OBJ	= $(OUTDIR)\if_tcl.obj
464TCL_INC	= /I "$(TCL)\Include" /I "$(TCL)"
465TCL_LIB = $(TCL)\lib\tclstub$(TCL_VER).lib
466!else
467CFLAGS  = $(CFLAGS) -DFEAT_TCL
468TCL_OBJ	= $(OUTDIR)\if_tcl.obj
469TCL_INC	= /I "$(TCL)\Include" /I "$(TCL)"
470TCL_LIB = $(TCL)\lib\tcl$(TCL_VER)vc.lib
471!endif
472!endif
473
474# PYTHON interface
475!ifdef PYTHON
476!ifndef PYTHON_VER
477PYTHON_VER = 22
478!endif
479!message Python requested (version $(PYTHON_VER)) - root dir is "$(PYTHON)"
480!if "$(DYNAMIC_PYTHON)" == "yes"
481!message Python DLL will be loaded dynamically
482!endif
483CFLAGS = $(CFLAGS) -DFEAT_PYTHON
484PYTHON_OBJ = $(OUTDIR)\if_python.obj
485PYTHON_INC = /I "$(PYTHON)\Include" /I "$(PYTHON)\PC"
486!if "$(DYNAMIC_PYTHON)" == "yes"
487CFLAGS = $(CFLAGS) -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python$(PYTHON_VER).dll\"
488PYTHON_LIB = /nodefaultlib:python$(PYTHON_VER).lib
489!else
490PYTHON_LIB = $(PYTHON)\libs\python$(PYTHON_VER).lib
491!endif
492!endif
493
494# MzScheme interface
495!ifdef MZSCHEME
496!message MzScheme requested - root dir is "$(MZSCHEME)"
497!ifndef MZSCHEME_VER
498MZSCHEME_VER = 205_000
499!endif
500CFLAGS = $(CFLAGS) -DFEAT_MZSCHEME -I $(MZSCHEME)\include
501MZSCHEME_OBJ = $(OUTDIR)\if_mzsch.obj
502MZSCHEME_LIB = $(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib $(MZSCHEME)\lib\msvc\libmzsch$(MZSCHEME_VER).lib
503!endif
504
505# Perl interface
506!ifdef PERL
507!ifndef PERL_VER
508PERL_VER = 56
509!endif
510!message Perl requested (version $(PERL_VER)) - root dir is "$(PERL)"
511!if "$(DYNAMIC_PERL)" == "yes"
512!if $(PERL_VER) >= 56
513!message Perl DLL will be loaded dynamically
514!else
515!message Dynamic loading is not supported for Perl versions earlier than 5.6.0
516!message Reverting to static loading...
517!undef DYNAMIC_PERL
518!endif
519!endif
520
521# Is Perl installed in architecture-specific directories?
522!if exist($(PERL)\Bin\MSWin32-x86)
523PERL_ARCH = \MSWin32-x86
524!endif
525
526PERL_INCDIR = $(PERL)\Lib$(PERL_ARCH)\Core
527
528# Version-dependent stuff
529!if $(PERL_VER) == 55
530PERL_LIB = $(PERL_INCDIR)\perl.lib
531!else
532PERL_DLL = perl$(PERL_VER).dll
533PERL_LIB = $(PERL_INCDIR)\perl$(PERL_VER).lib
534!endif
535
536CFLAGS = $(CFLAGS) -DFEAT_PERL
537
538# Do we want to load Perl dynamically?
539!if "$(DYNAMIC_PERL)" == "yes"
540CFLAGS = $(CFLAGS) -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"$(PERL_DLL)\"
541!undef PERL_LIB
542!endif
543
544PERL_EXE = $(PERL)\Bin$(PERL_ARCH)\perl
545PERL_INC = /I $(PERL_INCDIR)
546PERL_OBJ = $(OUTDIR)\if_perl.obj $(OUTDIR)\if_perlsfio.obj
547XSUBPP = $(PERL)\lib\ExtUtils\xsubpp
548XSUBPP_TYPEMAP = $(PERL)\lib\ExtUtils\typemap
549
550!endif
551
552#
553# Support Ruby interface
554#
555!ifdef RUBY
556#  Set default value
557!ifndef RUBY_VER
558RUBY_VER = 18
559!endif
560!ifndef RUBY_VER_LONG
561RUBY_VER_LONG = 1.8
562!endif
563
564!if $(RUBY_VER) >= 18
565!ifndef RUBY_PLATFORM
566RUBY_PLATFORM = i386-mswin32
567!endif
568!ifndef RUBY_INSTALL_NAME
569RUBY_INSTALL_NAME = msvcrt-ruby$(RUBY_VER)
570!endif
571!else
572!ifndef RUBY_PLATFORM
573RUBY_PLATFORM = i586-mswin32
574!endif
575!ifndef RUBY_INSTALL_NAME
576RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_VER)
577!endif
578!endif # $(RUBY_VER) >= 18
579
580!message Ruby requested (version $(RUBY_VER)) - root dir is "$(RUBY)"
581CFLAGS = $(CFLAGS) -DFEAT_RUBY
582RUBY_OBJ = $(OUTDIR)\if_ruby.obj
583RUBY_INC = /I "$(RUBY)\lib\ruby\$(RUBY_VER_LONG)\$(RUBY_PLATFORM)"
584RUBY_LIB = $(RUBY)\lib\$(RUBY_INSTALL_NAME).lib
585# Do we want to load Ruby dynamically?
586!if "$(DYNAMIC_RUBY)" == "yes"
587!message Ruby DLL will be loaded dynamically
588CFLAGS = $(CFLAGS) -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\" -DDYNAMIC_RUBY_VER=$(RUBY_VER)
589!undef RUBY_LIB
590!endif
591!endif # RUBY
592
593#
594# Support PostScript printing
595#
596!if "$(POSTSCRIPT)" == "yes"
597CFLAGS = $(CFLAGS) -DMSWINPS
598!endif # POSTSCRIPT
599
600#
601# FEATURES: TINY, SMALL, NORMAL, BIG or HUGE
602#
603!if "$(FEATURES)"==""
604FEATURES = BIG
605!endif
606CFLAGS = $(CFLAGS) -DFEAT_$(FEATURES)
607
608#
609# End extra featuare include
610#
611!message
612
613conflags = /nologo /subsystem:$(SUBSYSTEM) /incremental:no
614
615!IF "$(MAP)" == "yes"
616# "/map" is for debugging
617conflags = $(conflags) /map
618!ELSEIF "$(MAP)" == "lines"
619# "/mapinfo:lines" is for debugging, only works for VC6 and later
620conflags = $(conflags) /map /mapinfo:lines
621!ENDIF
622
623LINKARGS1 = $(linkdebug) $(conflags) /nodefaultlib:libc
624LINKARGS2 = $(CON_LIB) $(GUI_LIB) $(LIBC) $(OLE_LIB)  user32.lib $(SNIFF_LIB) \
625		$(MZSCHEME_LIB) $(PERL_LIB) $(PYTHON_LIB) $(RUBY_LIB) $(TCL_LIB) \
626		$(NETBEANS_LIB) $(XPM_LIB) $(LINK_PDB)
627
628all:	$(VIM) vimrun.exe install.exe uninstal.exe xxd/xxd.exe GvimExt/gvimext.dll
629
630$(VIM): $(OUTDIR) $(OBJ) $(GUI_OBJ) $(OLE_OBJ) $(OLE_IDL) $(MZSCHEME_OBJ) $(PERL_OBJ) $(PYTHON_OBJ) $(RUBY_OBJ) $(TCL_OBJ) $(SNIFF_OBJ) $(CSCOPE_OBJ) $(NETBEANS_OBJ) $(XPM_OBJ) version.c version.h
631	$(CC) $(CFLAGS)  version.c /Fo$(OUTDIR)/version.obj $(PDB)
632	$(link) $(LINKARGS1) -out:$*.exe $(OBJ) $(GUI_OBJ) $(OLE_OBJ) \
633		$(MZSCHEME_OBJ) $(PERL_OBJ) $(PYTHON_OBJ) $(RUBY_OBJ) $(TCL_OBJ) $(SNIFF_OBJ) \
634		$(CSCOPE_OBJ) $(NETBEANS_OBJ) $(XPM_OBJ) \
635		$(OUTDIR)\version.obj $(LINKARGS2)
636
637$(VIM).exe: $(VIM)
638
639$(OUTDIR):
640	if not exist $(OUTDIR)/nul    mkdir $(OUTDIR)
641
642install.exe: dosinst.c
643	$(CC) /nologo -DNDEBUG -DWIN32 dosinst.c kernel32.lib shell32.lib ole32.lib advapi32.lib uuid.lib
644	- if exist install.exe del install.exe
645	ren dosinst.exe install.exe
646
647uninstal.exe: uninstal.c
648	$(CC) /nologo -DNDEBUG -DWIN32 uninstal.c shell32.lib advapi32.lib
649
650vimrun.exe: vimrun.c
651	$(CC) /nologo -DNDEBUG vimrun.c
652
653xxd/xxd.exe: xxd/xxd.c
654	cd xxd
655	$(MAKE) /NOLOGO -f Make_mvc.mak
656	cd ..
657
658GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h
659	cd GvimExt
660	$(MAKE) /NOLOGO -f Makefile $(MAKEFLAGS_GVIMEXT)
661	cd ..
662
663
664tags: notags
665	$(CTAGS) *.c *.cpp *.h if_perl.xs proto\*.pro
666
667notags:
668	- if exist tags del tags
669
670clean:
671	- $(DEL_TREE) $(OUTDIR) auto
672	- if exist *.obj del *.obj
673	- if exist $(VIM).exe del $(VIM).exe
674	- if exist $(VIM).ilk del $(VIM).ilk
675	- if exist $(VIM).pdb del $(VIM).pdb
676	- if exist $(VIM).map del $(VIM).map
677	- if exist $(VIM).ncb del $(VIM).ncb
678	- if exist vimrun.exe del vimrun.exe
679	- if exist install.exe del install.exe
680	- if exist uninstal.exe del uninstal.exe
681	- if exist if_perl.c del if_perl.c
682	- if exist dimm.h del dimm.h
683	- if exist dimm_i.c del dimm_i.c
684	- if exist dimm.tlb del dimm.tlb
685	- if exist dosinst.exe del dosinst.exe
686	cd xxd
687	$(MAKE) /NOLOGO -f Make_mvc.mak clean
688	cd ..
689	cd GvimExt
690	$(MAKE) /NOLOGO -f Makefile clean
691	cd ..
692	cd GvimExt
693	$(MAKE) /NOLOGO -f Makefile clean
694	cd ..
695	- if exist testdir\*.out del testdir\*.out
696
697test:
698	cd testdir
699	$(MAKE) /NOLOGO -f Make_dos.mak win32
700	cd ..
701
702###########################################################################
703
704# Create a default rule for transforming .c files to .obj files in $(OUTDIR)
705# Batch compilation is supported by nmake 1.62 (part of VS 5.0) and later)
706!IF "$(_NMAKE_VER)" == ""
707.c{$(OUTDIR)/}.obj:
708!ELSE
709.c{$(OUTDIR)/}.obj::
710!ENDIF
711	$(CC) $(CFLAGS) /Fo$(OUTDIR)/ $(PDB) $<
712
713# Create a default rule for transforming .cpp files to .obj files in $(OUTDIR)
714# Batch compilation is supported by nmake 1.62 (part of VS 5.0) and later)
715!IF "$(_NMAKE_VER)" == ""
716.cpp{$(OUTDIR)/}.obj:
717!ELSE
718.cpp{$(OUTDIR)/}.obj::
719!ENDIF
720	$(CC) $(CFLAGS) /Fo$(OUTDIR)/ $(PDB) $<
721
722$(OUTDIR)/buffer.obj:	$(OUTDIR) buffer.c  $(INCL)
723
724$(OUTDIR)/charset.obj:	$(OUTDIR) charset.c  $(INCL)
725
726$(OUTDIR)/diff.obj:	$(OUTDIR) diff.c  $(INCL)
727
728$(OUTDIR)/digraph.obj:	$(OUTDIR) digraph.c  $(INCL)
729
730$(OUTDIR)/edit.obj:	$(OUTDIR) edit.c  $(INCL)
731
732$(OUTDIR)/eval.obj:	$(OUTDIR) eval.c  $(INCL)
733
734$(OUTDIR)/ex_cmds.obj:	$(OUTDIR) ex_cmds.c  $(INCL)
735
736$(OUTDIR)/ex_cmds2.obj:	$(OUTDIR) ex_cmds2.c  $(INCL)
737
738$(OUTDIR)/ex_docmd.obj:	$(OUTDIR) ex_docmd.c  $(INCL) ex_cmds.h
739
740$(OUTDIR)/ex_eval.obj:	$(OUTDIR) ex_eval.c  $(INCL) ex_cmds.h
741
742$(OUTDIR)/ex_getln.obj:	$(OUTDIR) ex_getln.c  $(INCL)
743
744$(OUTDIR)/fileio.obj:	$(OUTDIR) fileio.c  $(INCL)
745
746$(OUTDIR)/fold.obj:	$(OUTDIR) fold.c  $(INCL)
747
748$(OUTDIR)/getchar.obj:	$(OUTDIR) getchar.c  $(INCL)
749
750$(OUTDIR)/gui.obj:	$(OUTDIR) gui.c  $(INCL) $(GUI_INCL)
751
752$(OUTDIR)/gui_w32.obj:	$(OUTDIR) gui_w32.c gui_w48.c $(INCL) $(GUI_INCL)
753
754$(OUTDIR)/if_cscope.obj: $(OUTDIR) if_cscope.c  $(INCL)
755
756if_perl.c : if_perl.xs typemap
757	$(PERL_EXE) $(XSUBPP) -prototypes -typemap $(XSUBPP_TYPEMAP) -typemap typemap if_perl.xs > if_perl.c
758
759$(OUTDIR)/if_perl.obj: $(OUTDIR) if_perl.c  $(INCL)
760	$(CC) $(CFLAGS) $(PERL_INC) if_perl.c /Fo$(OUTDIR)/if_perl.obj $(PDB)
761
762$(OUTDIR)/if_perlsfio.obj: $(OUTDIR) if_perlsfio.c  $(INCL)
763	$(CC) $(CFLAGS) $(PERL_INC) if_perlsfio.c /Fo$(OUTDIR)/if_perlsfio.obj $(PDB)
764
765$(OUTDIR)/if_mzsch.obj: $(OUTDIR) if_mzsch.c  $(INCL)
766	$(CC) $(CFLAGS) $(PERL_INC) if_mzsch.c /Fo$(OUTDIR)/if_mzsch.obj $(PDB) -DMZSCHEME_COLLECTS=\"$(MZSCHEME:\=\\)\\collects\"
767
768$(OUTDIR)/if_python.obj: $(OUTDIR) if_python.c  $(INCL)
769	$(CC) $(CFLAGS) $(PYTHON_INC) if_python.c /Fo$(OUTDIR)/if_python.obj $(PDB)
770
771$(OUTDIR)/if_ole.obj: $(OUTDIR) if_ole.cpp  $(INCL) if_ole.h
772
773$(OUTDIR)/if_ruby.obj: $(OUTDIR) if_ruby.c  $(INCL)
774	$(CC) $(CFLAGS) $(RUBY_INC) if_ruby.c /Fo$(OUTDIR)/if_ruby.obj $(PDB)
775
776$(OUTDIR)/if_sniff.obj:	$(OUTDIR) if_sniff.c  $(INCL)
777	$(CC) $(CFLAGS) if_sniff.c /Fo$(OUTDIR)/if_sniff.obj $(PDB)
778
779$(OUTDIR)/if_tcl.obj: $(OUTDIR) if_tcl.c  $(INCL)
780	$(CC) $(CFLAGS) $(TCL_INC) if_tcl.c /Fo$(OUTDIR)/if_tcl.obj $(PDB)
781
782$(OUTDIR)/main.obj:	$(OUTDIR) main.c  $(INCL)
783
784$(OUTDIR)/mark.obj:	$(OUTDIR) mark.c  $(INCL)
785
786$(OUTDIR)/memfile.obj:	$(OUTDIR) memfile.c  $(INCL)
787
788$(OUTDIR)/memline.obj:	$(OUTDIR) memline.c  $(INCL)
789
790$(OUTDIR)/menu.obj:	$(OUTDIR) menu.c  $(INCL)
791
792$(OUTDIR)/message.obj:	$(OUTDIR) message.c  $(INCL)
793
794$(OUTDIR)/misc1.obj:	$(OUTDIR) misc1.c  $(INCL)
795
796$(OUTDIR)/misc2.obj:	$(OUTDIR) misc2.c  $(INCL)
797
798$(OUTDIR)/move.obj:	$(OUTDIR) move.c  $(INCL)
799
800$(OUTDIR)/mbyte.obj: $(OUTDIR) mbyte.c  $(INCL)
801
802$(OUTDIR)/netbeans.obj: $(OUTDIR) netbeans.c $(NBDEBUG_SRC) $(INCL)
803
804$(OUTDIR)/normal.obj:	$(OUTDIR) normal.c  $(INCL)
805
806$(OUTDIR)/option.obj:	$(OUTDIR) option.c  $(INCL)
807
808$(OUTDIR)/ops.obj:	$(OUTDIR) ops.c  $(INCL)
809
810$(OUTDIR)/os_mswin.obj:	$(OUTDIR) os_mswin.c  $(INCL)
811
812$(OUTDIR)/os_win32.obj:	$(OUTDIR) os_win32.c  $(INCL) os_win32.h
813
814$(OUTDIR)/os_w32exe.obj:	$(OUTDIR) os_w32exe.c  $(INCL)
815
816$(OUTDIR)/pathdef.obj:	$(OUTDIR) auto/pathdef.c  $(INCL)
817	$(CC) $(CFLAGS) auto/pathdef.c /Fo$(OUTDIR)/pathdef.obj $(PDB)
818
819$(OUTDIR)/quickfix.obj:	$(OUTDIR) quickfix.c  $(INCL)
820
821$(OUTDIR)/regexp.obj:	$(OUTDIR) regexp.c  $(INCL)
822
823$(OUTDIR)/screen.obj:	$(OUTDIR) screen.c  $(INCL)
824
825$(OUTDIR)/search.obj:	$(OUTDIR) search.c  $(INCL)
826
827$(OUTDIR)/syntax.obj:	$(OUTDIR) syntax.c  $(INCL)
828
829$(OUTDIR)/tag.obj:	$(OUTDIR) tag.c  $(INCL)
830
831$(OUTDIR)/term.obj:	$(OUTDIR) term.c  $(INCL)
832
833$(OUTDIR)/ui.obj:	$(OUTDIR) ui.c  $(INCL)
834
835$(OUTDIR)/undo.obj:	$(OUTDIR) undo.c  $(INCL)
836
837$(OUTDIR)/window.obj:	$(OUTDIR) window.c  $(INCL)
838
839$(OUTDIR)/xpm_w32.obj: $(OUTDIR) xpm_w32.c
840	$(CC) $(CFLAGS) $(XPM_INC) xpm_w32.c /Fo$(OUTDIR)/xpm_w32.obj $(PDB)
841
842$(OUTDIR)/vim.res:	$(OUTDIR) vim.rc version.h tools.bmp tearoff.bmp vim.ico vim_error.ico vim_alert.ico vim_info.ico vim_quest.ico
843	$(RC) /l 0x409 /Fo$(OUTDIR)/vim.res $(RCFLAGS) vim.rc
844
845iid_ole.c if_ole.h vim.tlb: if_ole.idl $(INTDIR) $(OUTDIR)
846	midl /nologo /proxy nul /iid iid_ole.c /tlb vim.tlb /header if_ole.h if_ole.idl
847
848dimm.h dimm_i.c: dimm.idl
849	midl /nologo /proxy nul dimm.idl
850
851$(OUTDIR)/dimm_i.obj: $(OUTDIR) dimm_i.c $(INCL)
852
853$(OUTDIR)/glbl_ime.obj:	$(OUTDIR) glbl_ime.cpp  dimm.h $(INCL)
854
855# $CFLAGS may contain backslashes and double quotes, escape them both.
856E0_CFLAGS = $(CFLAGS:\=\\)
857E_CFLAGS = $(E0_CFLAGS:"=\")
858
859auto/pathdef.c: auto
860	@echo creating auto/pathdef.c
861	@echo /* pathdef.c */ > auto\pathdef.c
862	@echo #include "vim.h" >> auto\pathdef.c
863	@echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC:\=\\)"; >> auto\pathdef.c
864	@echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR:\=\\)"; >> auto\pathdef.c
865	@echo char_u *all_cflags = (char_u *)"$(CC:\=\\) $(E_CFLAGS)"; >> auto\pathdef.c
866	@echo char_u *all_lflags = (char_u *)"$(link:\=\\) $(LINKARGS1:\=\\) $(LINKARGS2:\=\\)"; >> auto\pathdef.c
867	@echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> auto\pathdef.c
868	@echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> auto\pathdef.c
869
870auto:
871	if not exist auto/nul mkdir auto
872
873# End Custom Build
874proto.h: \
875	proto/buffer.pro \
876	proto/charset.pro \
877	proto/diff.pro \
878	proto/digraph.pro \
879	proto/edit.pro \
880	proto/eval.pro \
881	proto/ex_cmds.pro \
882	proto/ex_cmds2.pro \
883	proto/ex_docmd.pro \
884	proto/ex_eval.pro \
885	proto/ex_getln.pro \
886	proto/fileio.pro \
887	proto/getchar.pro \
888	proto/main.pro \
889	proto/mark.pro \
890	proto/memfile.pro \
891	proto/memline.pro \
892	proto/menu.pro \
893	proto/message.pro \
894	proto/misc1.pro \
895	proto/misc2.pro \
896	proto/move.pro \
897	proto/mbyte.pro \
898	proto/normal.pro \
899	proto/ops.pro \
900	proto/option.pro \
901	proto/os_mswin.pro \
902	proto/os_win32.pro \
903	proto/quickfix.pro \
904	proto/regexp.pro \
905	proto/screen.pro \
906	proto/search.pro \
907	proto/syntax.pro \
908	proto/tag.pro \
909	proto/term.pro \
910	proto/ui.pro \
911	proto/undo.pro \
912	proto/window.pro \
913	$(NETBEANS_PRO)
914
915# vim: set noet sw=8 ts=8 sts=0 wm=0 tw=0:
916