blob: 5cc0a92f5d69292a3e1424afccd8fe8a52867541 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001# 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)
Bram Moolenaar325b7a22004-07-05 15:58:32 +000022# MzScheme interface: MZSCHEME=[Path to MzScheme directory], MZSCHEME_VER=[version, 205_000, ...]
Bram Moolenaar071d4272004-06-13 20:20:40 +000023# 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)
Bram Moolenaar34114692005-01-02 11:28:13 +000056# Feature Set: FEATURES=[TINY, SMALL, NORMAL, BIG, HUGE] (default is BIG)
Bram Moolenaar071d4272004-06-13 20:20:40 +000057# Version Support: WINVER=[0x0400, 0x0500] (default is 0x0400)
Bram Moolenaarcf3630f2005-01-08 16:04:29 +000058# Processor Version: CPUNR=[i386, i486, i586, i686, pentium4] (default is i386)
Bram Moolenaar071d4272004-06-13 20:20:40 +000059# Optimization: OPTIMIZE=[SPACE, SPEED, MAXSPEED] (default is MAXSPEED)
60# Netbeans Support: NETBEANS=[yes or no] (default is yes if GUI is yes)
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +000061# Netbeans Debugging Support: NBDEBUG=[yes or no] (default is no)
Bram Moolenaar071d4272004-06-13 20:20:40 +000062# 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
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000120!ifdef MZSCHEME
121OBJDIR = $(OBJDIR)Z
122!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000123!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
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000197# Only allow NETBEANS and XPM for a GUI build.
198!if "$(GUI)" == "yes"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000199!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
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000204
205!if "$(NBDEBUG)" == "yes"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000206NBDEBUG_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
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000221!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000222
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
Bram Moolenaarcf3630f2005-01-08 16:04:29 +0000279!elseif "$(CPUNR)" == "pentium4"
Bram Moolenaar34114692005-01-02 11:28:13 +0000280CPUARG = /G7 /arch:SSE2
Bram Moolenaar071d4272004-06-13 20:20:40 +0000281!else
282CPUARG =
283!endif
284
285!ifdef NODEBUG
286VIM = vim
287!if "$(OPTIMIZE)" == "SPACE"
288OPTFLAG = /O1
289!elseif "$(OPTIMIZE)" == "SPEED"
290OPTFLAG = /O2
291!else # MAXSPEED
292OPTFLAG = /Ox
293!endif
Bram Moolenaar34114692005-01-02 11:28:13 +0000294CFLAGS = $(CFLAGS) $(OPTFLAG) -DNDEBUG $(CPUARG)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000295RCFLAGS = $(rcflags) $(rcvars) -DNDEBUG
Bram Moolenaar34114692005-01-02 11:28:13 +0000296PDB =
297LINK_PDB =
Bram Moolenaar071d4272004-06-13 20:20:40 +0000298! ifdef USE_MSVCRT
299CFLAGS = $(CFLAGS) -MD
300LIBC = msvcrt.lib
301! elseif defined(MULTITHREADED)
302LIBC = libcmt.lib
303! else
304LIBC = libc.lib
305! endif
306!else # DEBUG
307VIM = vimd
308# MSVC 4.1
309PDB = /Fd$(OUTDIR)/
310LINK_PDB = /PDB:$(OUTDIR)/
311# MSVC 2.2
312# PDB = /Fd$(OUTDIR)/vim.pdb
313# LINK_PDB = /PDB:$(OUTDIR)/vim.pdb
314CFLAGS = $(CFLAGS) -D_DEBUG -DDEBUG /Zi /Od
315RCFLAGS = $(rcflags) $(rcvars) -D_DEBUG -DDEBUG
316# The /fixed:no is needed for Quantify. Assume not 4.? as unsupported in VC4.0.
317! if "$(_NMAKE_VER)" == ""
318LIBC =
319! else
320LIBC = /fixed:no
321! endif
322
323! ifndef USE_MSVCRT
324LIBC = $(LIBC) libcd.lib
325! else
326CFLAGS = $(CFLAGS) -MDd
327LIBC = $(LIBC) msvcrtd.lib
328! endif
329!endif # DEBUG
330
331INCL = vim.h os_win32.h ascii.h feature.h globals.h keymap.h macros.h \
332 proto.h option.h structs.h term.h $(SNIFF_INCL) $(CSCOPE_INCL) \
333 $(NBDEBUG_INCL)
334
335OBJ = \
336 $(OUTDIR)\buffer.obj \
337 $(OUTDIR)\charset.obj \
338 $(OUTDIR)\diff.obj \
339 $(OUTDIR)\digraph.obj \
340 $(OUTDIR)\edit.obj \
341 $(OUTDIR)\eval.obj \
342 $(OUTDIR)\ex_cmds.obj \
343 $(OUTDIR)\ex_cmds2.obj \
344 $(OUTDIR)\ex_docmd.obj \
345 $(OUTDIR)\ex_eval.obj \
346 $(OUTDIR)\ex_getln.obj \
347 $(OUTDIR)\fileio.obj \
348 $(OUTDIR)\fold.obj \
349 $(OUTDIR)\getchar.obj \
Bram Moolenaar383f9bc2005-01-19 22:18:32 +0000350 $(OUTDIR)\hashtable.obj \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000351 $(OUTDIR)\main.obj \
352 $(OUTDIR)\mark.obj \
353 $(OUTDIR)\mbyte.obj \
354 $(OUTDIR)\memfile.obj \
355 $(OUTDIR)\memline.obj \
356 $(OUTDIR)\menu.obj \
357 $(OUTDIR)\message.obj \
358 $(OUTDIR)\misc1.obj \
359 $(OUTDIR)\misc2.obj \
360 $(OUTDIR)\move.obj \
361 $(OUTDIR)\normal.obj \
362 $(OUTDIR)\ops.obj \
363 $(OUTDIR)\option.obj \
364 $(OUTDIR)\os_mswin.obj \
365 $(OUTDIR)\os_win32.obj \
366 $(OUTDIR)\pathdef.obj \
367 $(OUTDIR)\quickfix.obj \
368 $(OUTDIR)\regexp.obj \
369 $(OUTDIR)\screen.obj \
370 $(OUTDIR)\search.obj \
371 $(OUTDIR)\syntax.obj \
372 $(OUTDIR)\tag.obj \
373 $(OUTDIR)\term.obj \
374 $(OUTDIR)\ui.obj \
375 $(OUTDIR)\undo.obj \
376 $(OUTDIR)\window.obj \
377 $(OUTDIR)\vim.res
378
379!if "$(OLE)" == "yes"
380CFLAGS = $(CFLAGS) -DFEAT_OLE
381RCFLAGS = $(RCFLAGS) -DFEAT_OLE
382OLE_OBJ = $(OUTDIR)\if_ole.obj
383OLE_IDL = if_ole.idl
384OLE_LIB = oleaut32.lib
385!endif
386
387!if "$(IME)" == "yes"
388CFLAGS = $(CFLAGS) -DFEAT_MBYTE_IME
389!ifndef DYNAMIC_IME
390DYNAMIC_IME = yes
391!endif
392!if "$(DYNAMIC_IME)" == "yes"
393CFLAGS = $(CFLAGS) -DDYNAMIC_IME
394!else
395IME_LIB = imm32.lib
396!endif
397!endif
398
399!if "$(GIME)" == "yes"
400CFLAGS = $(CFLAGS) -DGLOBAL_IME
401OBJ = $(OBJ) $(OUTDIR)\dimm_i.obj $(OUTDIR)\glbl_ime.obj
402MBYTE = yes
403!endif
404
405!if "$(MBYTE)" == "yes"
406CFLAGS = $(CFLAGS) -DFEAT_MBYTE
407!endif
408
409!if "$(GUI)" == "yes"
410SUBSYSTEM = windows
411CFLAGS = $(CFLAGS) -DFEAT_GUI_W32
412RCFLAGS = $(RCFLAGS) -DFEAT_GUI_W32
413VIM = g$(VIM)
414GUI_INCL = \
415 gui.h \
416 regexp.h \
417 ascii.h \
418 ex_cmds.h \
419 farsi.h \
420 feature.h \
421 globals.h \
422 keymap.h \
423 macros.h \
424 option.h \
425 os_dos.h \
426 os_win32.h
427GUI_OBJ = \
428 $(OUTDIR)\gui.obj \
429 $(OUTDIR)\gui_w32.obj \
430 $(OUTDIR)\os_w32exe.obj
431GUI_LIB = \
432 oldnames.lib kernel32.lib gdi32.lib $(IME_LIB) \
433 winspool.lib comctl32.lib advapi32.lib shell32.lib \
434 /machine:$(CPU) /nodefaultlib
435!else
436SUBSYSTEM = console
437!endif
438
439# iconv.dll library (dynamically loaded)
440!ifndef ICONV
441ICONV = yes
442!endif
443!if "$(ICONV)" == "yes"
444CFLAGS = $(CFLAGS) -DDYNAMIC_ICONV
445!endif
446
447# libintl.dll library
448!ifndef GETTEXT
449GETTEXT = yes
450!endif
451!if "$(GETTEXT)" == "yes"
452CFLAGS = $(CFLAGS) -DDYNAMIC_GETTEXT
453!endif
454
455# TCL interface
456!ifdef TCL
457!ifndef TCL_VER
458TCL_VER = 83
459TCL_VER_LONG = 8.3
460!endif
461!message Tcl requested (version $(TCL_VER)) - root dir is "$(TCL)"
462!if "$(DYNAMIC_TCL)" == "yes"
463!message Tcl DLL will be loaded dynamically
464TCL_DLL = tcl$(TCL_VER).dll
465CFLAGS = $(CFLAGS) -DFEAT_TCL -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"$(TCL_DLL)\" -DDYNAMIC_TCL_VER=\"$(TCL_VER_LONG)\"
466TCL_OBJ = $(OUTDIR)\if_tcl.obj
467TCL_INC = /I "$(TCL)\Include" /I "$(TCL)"
468TCL_LIB = $(TCL)\lib\tclstub$(TCL_VER).lib
469!else
470CFLAGS = $(CFLAGS) -DFEAT_TCL
471TCL_OBJ = $(OUTDIR)\if_tcl.obj
472TCL_INC = /I "$(TCL)\Include" /I "$(TCL)"
473TCL_LIB = $(TCL)\lib\tcl$(TCL_VER)vc.lib
474!endif
475!endif
476
477# PYTHON interface
478!ifdef PYTHON
479!ifndef PYTHON_VER
480PYTHON_VER = 22
481!endif
482!message Python requested (version $(PYTHON_VER)) - root dir is "$(PYTHON)"
483!if "$(DYNAMIC_PYTHON)" == "yes"
484!message Python DLL will be loaded dynamically
485!endif
486CFLAGS = $(CFLAGS) -DFEAT_PYTHON
487PYTHON_OBJ = $(OUTDIR)\if_python.obj
488PYTHON_INC = /I "$(PYTHON)\Include" /I "$(PYTHON)\PC"
489!if "$(DYNAMIC_PYTHON)" == "yes"
490CFLAGS = $(CFLAGS) -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python$(PYTHON_VER).dll\"
491PYTHON_LIB = /nodefaultlib:python$(PYTHON_VER).lib
492!else
493PYTHON_LIB = $(PYTHON)\libs\python$(PYTHON_VER).lib
494!endif
495!endif
496
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000497# MzScheme interface
498!ifdef MZSCHEME
499!message MzScheme requested - root dir is "$(MZSCHEME)"
500!ifndef MZSCHEME_VER
501MZSCHEME_VER = 205_000
502!endif
503CFLAGS = $(CFLAGS) -DFEAT_MZSCHEME -I $(MZSCHEME)\include
504MZSCHEME_OBJ = $(OUTDIR)\if_mzsch.obj
505MZSCHEME_LIB = $(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib $(MZSCHEME)\lib\msvc\libmzsch$(MZSCHEME_VER).lib
506!endif
507
Bram Moolenaar071d4272004-06-13 20:20:40 +0000508# Perl interface
509!ifdef PERL
510!ifndef PERL_VER
511PERL_VER = 56
512!endif
513!message Perl requested (version $(PERL_VER)) - root dir is "$(PERL)"
514!if "$(DYNAMIC_PERL)" == "yes"
515!if $(PERL_VER) >= 56
516!message Perl DLL will be loaded dynamically
517!else
518!message Dynamic loading is not supported for Perl versions earlier than 5.6.0
519!message Reverting to static loading...
520!undef DYNAMIC_PERL
521!endif
522!endif
523
524# Is Perl installed in architecture-specific directories?
525!if exist($(PERL)\Bin\MSWin32-x86)
526PERL_ARCH = \MSWin32-x86
527!endif
528
529PERL_INCDIR = $(PERL)\Lib$(PERL_ARCH)\Core
530
531# Version-dependent stuff
532!if $(PERL_VER) == 55
533PERL_LIB = $(PERL_INCDIR)\perl.lib
534!else
535PERL_DLL = perl$(PERL_VER).dll
536PERL_LIB = $(PERL_INCDIR)\perl$(PERL_VER).lib
537!endif
538
539CFLAGS = $(CFLAGS) -DFEAT_PERL
540
541# Do we want to load Perl dynamically?
542!if "$(DYNAMIC_PERL)" == "yes"
543CFLAGS = $(CFLAGS) -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"$(PERL_DLL)\"
544!undef PERL_LIB
545!endif
546
547PERL_EXE = $(PERL)\Bin$(PERL_ARCH)\perl
548PERL_INC = /I $(PERL_INCDIR)
549PERL_OBJ = $(OUTDIR)\if_perl.obj $(OUTDIR)\if_perlsfio.obj
550XSUBPP = $(PERL)\lib\ExtUtils\xsubpp
551XSUBPP_TYPEMAP = $(PERL)\lib\ExtUtils\typemap
552
553!endif
554
555#
556# Support Ruby interface
557#
558!ifdef RUBY
559# Set default value
560!ifndef RUBY_VER
561RUBY_VER = 18
562!endif
563!ifndef RUBY_VER_LONG
564RUBY_VER_LONG = 1.8
565!endif
566
567!if $(RUBY_VER) >= 18
568!ifndef RUBY_PLATFORM
569RUBY_PLATFORM = i386-mswin32
570!endif
571!ifndef RUBY_INSTALL_NAME
572RUBY_INSTALL_NAME = msvcrt-ruby$(RUBY_VER)
573!endif
574!else
575!ifndef RUBY_PLATFORM
576RUBY_PLATFORM = i586-mswin32
577!endif
578!ifndef RUBY_INSTALL_NAME
579RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_VER)
580!endif
581!endif # $(RUBY_VER) >= 18
582
583!message Ruby requested (version $(RUBY_VER)) - root dir is "$(RUBY)"
584CFLAGS = $(CFLAGS) -DFEAT_RUBY
585RUBY_OBJ = $(OUTDIR)\if_ruby.obj
586RUBY_INC = /I "$(RUBY)\lib\ruby\$(RUBY_VER_LONG)\$(RUBY_PLATFORM)"
587RUBY_LIB = $(RUBY)\lib\$(RUBY_INSTALL_NAME).lib
588# Do we want to load Ruby dynamically?
589!if "$(DYNAMIC_RUBY)" == "yes"
590!message Ruby DLL will be loaded dynamically
591CFLAGS = $(CFLAGS) -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\" -DDYNAMIC_RUBY_VER=$(RUBY_VER)
592!undef RUBY_LIB
593!endif
594!endif # RUBY
595
596#
597# Support PostScript printing
598#
599!if "$(POSTSCRIPT)" == "yes"
600CFLAGS = $(CFLAGS) -DMSWINPS
601!endif # POSTSCRIPT
602
603#
604# FEATURES: TINY, SMALL, NORMAL, BIG or HUGE
605#
606!if "$(FEATURES)"==""
607FEATURES = BIG
608!endif
609CFLAGS = $(CFLAGS) -DFEAT_$(FEATURES)
610
611#
612# End extra featuare include
613#
614!message
615
616conflags = /nologo /subsystem:$(SUBSYSTEM) /incremental:no
617
618!IF "$(MAP)" == "yes"
619# "/map" is for debugging
620conflags = $(conflags) /map
621!ELSEIF "$(MAP)" == "lines"
622# "/mapinfo:lines" is for debugging, only works for VC6 and later
623conflags = $(conflags) /map /mapinfo:lines
624!ENDIF
625
626LINKARGS1 = $(linkdebug) $(conflags) /nodefaultlib:libc
627LINKARGS2 = $(CON_LIB) $(GUI_LIB) $(LIBC) $(OLE_LIB) user32.lib $(SNIFF_LIB) \
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000628 $(MZSCHEME_LIB) $(PERL_LIB) $(PYTHON_LIB) $(RUBY_LIB) $(TCL_LIB) \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000629 $(NETBEANS_LIB) $(XPM_LIB) $(LINK_PDB)
630
631all: $(VIM) vimrun.exe install.exe uninstal.exe xxd/xxd.exe GvimExt/gvimext.dll
632
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000633$(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
Bram Moolenaar071d4272004-06-13 20:20:40 +0000634 $(CC) $(CFLAGS) version.c /Fo$(OUTDIR)/version.obj $(PDB)
635 $(link) $(LINKARGS1) -out:$*.exe $(OBJ) $(GUI_OBJ) $(OLE_OBJ) \
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000636 $(MZSCHEME_OBJ) $(PERL_OBJ) $(PYTHON_OBJ) $(RUBY_OBJ) $(TCL_OBJ) $(SNIFF_OBJ) \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000637 $(CSCOPE_OBJ) $(NETBEANS_OBJ) $(XPM_OBJ) \
638 $(OUTDIR)\version.obj $(LINKARGS2)
639
640$(VIM).exe: $(VIM)
641
642$(OUTDIR):
Bram Moolenaar1cd871b2004-12-19 22:46:22 +0000643 if not exist $(OUTDIR)/nul mkdir $(OUTDIR)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000644
645install.exe: dosinst.c
646 $(CC) /nologo -DNDEBUG -DWIN32 dosinst.c kernel32.lib shell32.lib ole32.lib advapi32.lib uuid.lib
647 - if exist install.exe del install.exe
648 ren dosinst.exe install.exe
649
650uninstal.exe: uninstal.c
651 $(CC) /nologo -DNDEBUG -DWIN32 uninstal.c shell32.lib advapi32.lib
652
653vimrun.exe: vimrun.c
654 $(CC) /nologo -DNDEBUG vimrun.c
655
656xxd/xxd.exe: xxd/xxd.c
657 cd xxd
658 $(MAKE) /NOLOGO -f Make_mvc.mak
659 cd ..
660
661GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h
662 cd GvimExt
663 $(MAKE) /NOLOGO -f Makefile $(MAKEFLAGS_GVIMEXT)
664 cd ..
665
666
667tags: notags
668 $(CTAGS) *.c *.cpp *.h if_perl.xs proto\*.pro
669
670notags:
671 - if exist tags del tags
672
673clean:
674 - $(DEL_TREE) $(OUTDIR) auto
675 - if exist *.obj del *.obj
676 - if exist $(VIM).exe del $(VIM).exe
677 - if exist $(VIM).ilk del $(VIM).ilk
678 - if exist $(VIM).pdb del $(VIM).pdb
679 - if exist $(VIM).map del $(VIM).map
680 - if exist $(VIM).ncb del $(VIM).ncb
681 - if exist vimrun.exe del vimrun.exe
682 - if exist install.exe del install.exe
683 - if exist uninstal.exe del uninstal.exe
684 - if exist if_perl.c del if_perl.c
685 - if exist dimm.h del dimm.h
686 - if exist dimm_i.c del dimm_i.c
687 - if exist dimm.tlb del dimm.tlb
688 - if exist dosinst.exe del dosinst.exe
689 cd xxd
690 $(MAKE) /NOLOGO -f Make_mvc.mak clean
691 cd ..
692 cd GvimExt
693 $(MAKE) /NOLOGO -f Makefile clean
694 cd ..
695 cd GvimExt
696 $(MAKE) /NOLOGO -f Makefile clean
697 cd ..
698 - if exist testdir\*.out del testdir\*.out
699
700test:
701 cd testdir
702 $(MAKE) /NOLOGO -f Make_dos.mak win32
703 cd ..
704
Bram Moolenaar34114692005-01-02 11:28:13 +0000705testclean:
706 cd testdir
707 $(MAKE) /NOLOGO -f Make_dos.mak clean
708 cd ..
709
Bram Moolenaar071d4272004-06-13 20:20:40 +0000710###########################################################################
711
712# Create a default rule for transforming .c files to .obj files in $(OUTDIR)
713# Batch compilation is supported by nmake 1.62 (part of VS 5.0) and later)
714!IF "$(_NMAKE_VER)" == ""
715.c{$(OUTDIR)/}.obj:
716!ELSE
717.c{$(OUTDIR)/}.obj::
718!ENDIF
719 $(CC) $(CFLAGS) /Fo$(OUTDIR)/ $(PDB) $<
720
721# Create a default rule for transforming .cpp files to .obj files in $(OUTDIR)
722# Batch compilation is supported by nmake 1.62 (part of VS 5.0) and later)
723!IF "$(_NMAKE_VER)" == ""
724.cpp{$(OUTDIR)/}.obj:
725!ELSE
726.cpp{$(OUTDIR)/}.obj::
727!ENDIF
728 $(CC) $(CFLAGS) /Fo$(OUTDIR)/ $(PDB) $<
729
730$(OUTDIR)/buffer.obj: $(OUTDIR) buffer.c $(INCL)
731
732$(OUTDIR)/charset.obj: $(OUTDIR) charset.c $(INCL)
733
734$(OUTDIR)/diff.obj: $(OUTDIR) diff.c $(INCL)
735
736$(OUTDIR)/digraph.obj: $(OUTDIR) digraph.c $(INCL)
737
738$(OUTDIR)/edit.obj: $(OUTDIR) edit.c $(INCL)
739
740$(OUTDIR)/eval.obj: $(OUTDIR) eval.c $(INCL)
741
742$(OUTDIR)/ex_cmds.obj: $(OUTDIR) ex_cmds.c $(INCL)
743
744$(OUTDIR)/ex_cmds2.obj: $(OUTDIR) ex_cmds2.c $(INCL)
745
746$(OUTDIR)/ex_docmd.obj: $(OUTDIR) ex_docmd.c $(INCL) ex_cmds.h
747
748$(OUTDIR)/ex_eval.obj: $(OUTDIR) ex_eval.c $(INCL) ex_cmds.h
749
750$(OUTDIR)/ex_getln.obj: $(OUTDIR) ex_getln.c $(INCL)
751
752$(OUTDIR)/fileio.obj: $(OUTDIR) fileio.c $(INCL)
753
754$(OUTDIR)/fold.obj: $(OUTDIR) fold.c $(INCL)
755
756$(OUTDIR)/getchar.obj: $(OUTDIR) getchar.c $(INCL)
757
Bram Moolenaar383f9bc2005-01-19 22:18:32 +0000758$(OUTDIR)/hashtable.obj: $(OUTDIR) hashtable.c $(INCL)
759
Bram Moolenaar071d4272004-06-13 20:20:40 +0000760$(OUTDIR)/gui.obj: $(OUTDIR) gui.c $(INCL) $(GUI_INCL)
761
762$(OUTDIR)/gui_w32.obj: $(OUTDIR) gui_w32.c gui_w48.c $(INCL) $(GUI_INCL)
763
764$(OUTDIR)/if_cscope.obj: $(OUTDIR) if_cscope.c $(INCL)
765
766if_perl.c : if_perl.xs typemap
767 $(PERL_EXE) $(XSUBPP) -prototypes -typemap $(XSUBPP_TYPEMAP) -typemap typemap if_perl.xs > if_perl.c
768
769$(OUTDIR)/if_perl.obj: $(OUTDIR) if_perl.c $(INCL)
770 $(CC) $(CFLAGS) $(PERL_INC) if_perl.c /Fo$(OUTDIR)/if_perl.obj $(PDB)
771
772$(OUTDIR)/if_perlsfio.obj: $(OUTDIR) if_perlsfio.c $(INCL)
773 $(CC) $(CFLAGS) $(PERL_INC) if_perlsfio.c /Fo$(OUTDIR)/if_perlsfio.obj $(PDB)
774
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000775$(OUTDIR)/if_mzsch.obj: $(OUTDIR) if_mzsch.c $(INCL)
776 $(CC) $(CFLAGS) $(PERL_INC) if_mzsch.c /Fo$(OUTDIR)/if_mzsch.obj $(PDB) -DMZSCHEME_COLLECTS=\"$(MZSCHEME:\=\\)\\collects\"
777
Bram Moolenaar071d4272004-06-13 20:20:40 +0000778$(OUTDIR)/if_python.obj: $(OUTDIR) if_python.c $(INCL)
779 $(CC) $(CFLAGS) $(PYTHON_INC) if_python.c /Fo$(OUTDIR)/if_python.obj $(PDB)
780
781$(OUTDIR)/if_ole.obj: $(OUTDIR) if_ole.cpp $(INCL) if_ole.h
782
783$(OUTDIR)/if_ruby.obj: $(OUTDIR) if_ruby.c $(INCL)
784 $(CC) $(CFLAGS) $(RUBY_INC) if_ruby.c /Fo$(OUTDIR)/if_ruby.obj $(PDB)
785
786$(OUTDIR)/if_sniff.obj: $(OUTDIR) if_sniff.c $(INCL)
787 $(CC) $(CFLAGS) if_sniff.c /Fo$(OUTDIR)/if_sniff.obj $(PDB)
788
789$(OUTDIR)/if_tcl.obj: $(OUTDIR) if_tcl.c $(INCL)
790 $(CC) $(CFLAGS) $(TCL_INC) if_tcl.c /Fo$(OUTDIR)/if_tcl.obj $(PDB)
791
792$(OUTDIR)/main.obj: $(OUTDIR) main.c $(INCL)
793
794$(OUTDIR)/mark.obj: $(OUTDIR) mark.c $(INCL)
795
796$(OUTDIR)/memfile.obj: $(OUTDIR) memfile.c $(INCL)
797
798$(OUTDIR)/memline.obj: $(OUTDIR) memline.c $(INCL)
799
800$(OUTDIR)/menu.obj: $(OUTDIR) menu.c $(INCL)
801
802$(OUTDIR)/message.obj: $(OUTDIR) message.c $(INCL)
803
804$(OUTDIR)/misc1.obj: $(OUTDIR) misc1.c $(INCL)
805
806$(OUTDIR)/misc2.obj: $(OUTDIR) misc2.c $(INCL)
807
808$(OUTDIR)/move.obj: $(OUTDIR) move.c $(INCL)
809
810$(OUTDIR)/mbyte.obj: $(OUTDIR) mbyte.c $(INCL)
811
812$(OUTDIR)/netbeans.obj: $(OUTDIR) netbeans.c $(NBDEBUG_SRC) $(INCL)
813
814$(OUTDIR)/normal.obj: $(OUTDIR) normal.c $(INCL)
815
816$(OUTDIR)/option.obj: $(OUTDIR) option.c $(INCL)
817
818$(OUTDIR)/ops.obj: $(OUTDIR) ops.c $(INCL)
819
820$(OUTDIR)/os_mswin.obj: $(OUTDIR) os_mswin.c $(INCL)
821
822$(OUTDIR)/os_win32.obj: $(OUTDIR) os_win32.c $(INCL) os_win32.h
823
824$(OUTDIR)/os_w32exe.obj: $(OUTDIR) os_w32exe.c $(INCL)
825
826$(OUTDIR)/pathdef.obj: $(OUTDIR) auto/pathdef.c $(INCL)
827 $(CC) $(CFLAGS) auto/pathdef.c /Fo$(OUTDIR)/pathdef.obj $(PDB)
828
829$(OUTDIR)/quickfix.obj: $(OUTDIR) quickfix.c $(INCL)
830
831$(OUTDIR)/regexp.obj: $(OUTDIR) regexp.c $(INCL)
832
833$(OUTDIR)/screen.obj: $(OUTDIR) screen.c $(INCL)
834
835$(OUTDIR)/search.obj: $(OUTDIR) search.c $(INCL)
836
837$(OUTDIR)/syntax.obj: $(OUTDIR) syntax.c $(INCL)
838
839$(OUTDIR)/tag.obj: $(OUTDIR) tag.c $(INCL)
840
841$(OUTDIR)/term.obj: $(OUTDIR) term.c $(INCL)
842
843$(OUTDIR)/ui.obj: $(OUTDIR) ui.c $(INCL)
844
845$(OUTDIR)/undo.obj: $(OUTDIR) undo.c $(INCL)
846
847$(OUTDIR)/window.obj: $(OUTDIR) window.c $(INCL)
848
849$(OUTDIR)/xpm_w32.obj: $(OUTDIR) xpm_w32.c
850 $(CC) $(CFLAGS) $(XPM_INC) xpm_w32.c /Fo$(OUTDIR)/xpm_w32.obj $(PDB)
851
852$(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
853 $(RC) /l 0x409 /Fo$(OUTDIR)/vim.res $(RCFLAGS) vim.rc
854
855iid_ole.c if_ole.h vim.tlb: if_ole.idl $(INTDIR) $(OUTDIR)
856 midl /nologo /proxy nul /iid iid_ole.c /tlb vim.tlb /header if_ole.h if_ole.idl
857
858dimm.h dimm_i.c: dimm.idl
859 midl /nologo /proxy nul dimm.idl
860
861$(OUTDIR)/dimm_i.obj: $(OUTDIR) dimm_i.c $(INCL)
862
863$(OUTDIR)/glbl_ime.obj: $(OUTDIR) glbl_ime.cpp dimm.h $(INCL)
864
Bram Moolenaar89cb5e02004-07-19 20:55:54 +0000865# $CFLAGS may contain backslashes and double quotes, escape them both.
866E0_CFLAGS = $(CFLAGS:\=\\)
867E_CFLAGS = $(E0_CFLAGS:"=\")
868
Bram Moolenaar071d4272004-06-13 20:20:40 +0000869auto/pathdef.c: auto
870 @echo creating auto/pathdef.c
871 @echo /* pathdef.c */ > auto\pathdef.c
872 @echo #include "vim.h" >> auto\pathdef.c
873 @echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC:\=\\)"; >> auto\pathdef.c
874 @echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR:\=\\)"; >> auto\pathdef.c
Bram Moolenaar89cb5e02004-07-19 20:55:54 +0000875 @echo char_u *all_cflags = (char_u *)"$(CC:\=\\) $(E_CFLAGS)"; >> auto\pathdef.c
Bram Moolenaar071d4272004-06-13 20:20:40 +0000876 @echo char_u *all_lflags = (char_u *)"$(link:\=\\) $(LINKARGS1:\=\\) $(LINKARGS2:\=\\)"; >> auto\pathdef.c
877 @echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> auto\pathdef.c
878 @echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> auto\pathdef.c
879
880auto:
881 if not exist auto/nul mkdir auto
882
883# End Custom Build
884proto.h: \
885 proto/buffer.pro \
886 proto/charset.pro \
887 proto/diff.pro \
888 proto/digraph.pro \
889 proto/edit.pro \
890 proto/eval.pro \
891 proto/ex_cmds.pro \
892 proto/ex_cmds2.pro \
893 proto/ex_docmd.pro \
894 proto/ex_eval.pro \
895 proto/ex_getln.pro \
896 proto/fileio.pro \
897 proto/getchar.pro \
Bram Moolenaar383f9bc2005-01-19 22:18:32 +0000898 proto/hashtable.pro \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000899 proto/main.pro \
900 proto/mark.pro \
901 proto/memfile.pro \
902 proto/memline.pro \
903 proto/menu.pro \
904 proto/message.pro \
905 proto/misc1.pro \
906 proto/misc2.pro \
907 proto/move.pro \
908 proto/mbyte.pro \
909 proto/normal.pro \
910 proto/ops.pro \
911 proto/option.pro \
912 proto/os_mswin.pro \
913 proto/os_win32.pro \
914 proto/quickfix.pro \
915 proto/regexp.pro \
916 proto/screen.pro \
917 proto/search.pro \
918 proto/syntax.pro \
919 proto/tag.pro \
920 proto/term.pro \
921 proto/ui.pro \
922 proto/undo.pro \
923 proto/window.pro \
924 $(NETBEANS_PRO)
925
926# vim: set noet sw=8 ts=8 sts=0 wm=0 tw=0: