1#
2# Makefile for Vim.
3# Compiler: Borland C++ 5.0 and later 32-bit compiler
4#  Targets: Dos16 or Win32 (Windows NT and Windows 95) (with/without GUI)
5#
6# Contributed by Ben Singer.
7# Updated 4/1997 by Ron Aaron
8#	6/1997 - added support for 16 bit DOS
9#	Note: this has been tested, and works, for BC5.  Your mileage may vary.
10#	Has been reported NOT to work with BC 4.52.  Maybe it can be fixed?
11#	10/1997 - ron - fixed bugs w/ BC 5.02
12#	8/1998 - ron - updated with new targets, fixed some stuff
13#	3/2000 - Bram: Made it work with BC 5.5 free command line compiler,
14#			cleaned up variables.
15#	6/2001 - Dan - Added support for compiling Python and TCL
16#	7/2001 - Dan - Added support for compiling Ruby
17#
18# It builds on Windows 95 and NT-Intel, producing the same binary in either
19# case.  To build using Microsoft Visual C++, use Make_mvc.mak.
20#
21# This should work with the free Borland command line compiler, version 5.5.
22# You need at least sp1 (service pack 1).  With sp2 it compiles faster.
23# Use a command like this:
24# <path>\bin\make /f Make_bc5.mak BOR=<path>
25#
26
27# let the make utility do the hard work:
28.AUTODEPEND
29.CACHEAUTODEPEND
30
31# VARIABLES:
32# name		value (default)
33#
34# BOR		path to root of Borland C install (c:\bc5)
35# LINK		name of the linker ($(BOR)\bin\ilink if OSTYPE is DOS16,
36#		$(BOR)\bin\ilink32 otherwise)
37# GUI		no or yes: set to yes if you want the GUI version (yes)
38# LUA     define to path to Lua dir to get Lua support (not defined)
39#   LUA_VER	  define to version of Lua being used (51)
40#   DYNAMIC_LUA  no or yes: set to yes to load the Lua DLL dynamically (no)
41# PERL		define to path to Perl dir to get Perl support (not defined)
42#   PERL_VER	  define to version of Perl being used (56)
43#   DYNAMIC_PERL  no or yes: set to yes to load the Perl DLL dynamically (no)
44# PYTHON	define to path to Python dir to get PYTHON support (not defined)
45#   PYTHON_VER	    define to version of Python being used (22)
46#   DYNAMIC_PYTHON  no or yes: use yes to load the Python DLL dynamically (no)
47# PYTHON3	define to path to Python3 dir to get PYTHON3 support (not defined)
48#   PYTHON3_VER	    define to version of Python3 being used (31)
49#   DYNAMIC_PYTHON3  no or yes: use yes to load the Python3 DLL dynamically (no)
50# TCL		define to path to TCL dir to get TCL support (not defined)
51#   TCL_VER	define to version of TCL being used (83)
52#   DYNAMIC_TCL no or yes: use yes to load the TCL DLL dynamically (no)
53# RUBY		define to path to Ruby dir to get Ruby support (not defined)
54#		NOTE: You may have to remove the defines for uid_t and gid_t
55#		from the Ruby config.h header file.
56#   RUBY_VER	define to version of Ruby being used (16)
57#		NOTE: compilation on WinNT/2K/XP requires
58#		at least version 1.6.5 of Ruby.  Earlier versions
59#		of Ruby will cause a compile error on these systems.
60#   RUBY_VER_LONG  same, but in format with dot. (1.6)
61#   DYNAMIC_RUBY no or yes: use yes to load the Ruby DLL dynamically (no)
62# MBYTE		no or yes: set to yes for multi-byte support (yes)
63#		NOTE: multi-byte support is broken in the Borland libraries,
64#		not everything will work properly!  Esp. handling multi-byte
65#		file names.
66# IME		no or yes: set to yes for multi-byte IME support (yes)
67#   DYNAMIC_IME no or yes: set to yes to load imm32.dll dynamically (yes)
68# GETTEXT	no or yes: set to yes for multi-language support (yes)
69# ICONV		no or yes: set to yes for dynamic iconv support (yes)
70# OLE		no or yes: set to yes to make OLE gvim (no)
71# OSTYPE	DOS16 or WIN32 (WIN32)
72# DEBUG		no or yes: set to yes if you wish a DEBUGging build (no)
73# CODEGUARD	no or yes: set to yes if you want to use CODEGUARD (no)
74# CPUNR		1 through 6: select -CPU argument to compile with (3)
75#		3 for 386, 4 for 486, 5 for pentium, 6 for pentium pro.
76# USEDLL	no or yes: set to yes to use the Runtime library DLL (no)
77#		For USEDLL=yes the cc3250.dll is required to run Vim.
78# VIMDLL	no or yes: create vim32.dll, and stub (g)vim.exe (no)
79# ALIGN		1, 2 or 4: Alignment to use (4 for Win32, 2 for DOS16)
80# FASTCALL	no or yes: set to yes to use register-based function protocol (yes)
81# OPTIMIZE	SPACE, SPEED, or MAXSPEED: type of optimization (MAXSPEED)
82# POSTSCRIPT	no or yes: set to yes for PostScript printing
83# FEATURES	TINY, SMALL, NORMAL, BIG or HUGE
84#		(BIG for WIN32, SMALL for DOS16)
85# WINVER	0x0400 or 0x0500: minimum Win32 version to support (0x0400)
86# CSCOPE	no or yes: include support for Cscope interface (yes)
87# NETBEANS	no or yes: include support for Netbeans interface (yes if GUI
88#		is yes)
89# NBDEBUG	no or yes: include support for debugging Netbeans interface (no)
90# XPM		define to path to XPM dir to get support for loading XPM images.
91
92### BOR: root of the BC installation
93!if ("$(BOR)"=="")
94BOR = c:\bc5
95!endif
96
97### LINK: Name of the linker: tlink or ilink32 (this is below, depends on
98# $(OSTYPE)
99
100### GUI: yes for GUI version, no for console version
101!if ("$(GUI)"=="")
102GUI = yes
103!endif
104
105### MBYTE: yes for multibyte support, no to disable it.
106!if ("$(MBYTE)"=="")
107MBYTE = yes
108!endif
109
110### IME: yes for multibyte support, no to disable it.
111!if ("$(IME)"=="")
112IME = yes
113!endif
114!if ("$(DYNAMIC_IME)"=="")
115DYNAMIC_IME = yes
116!endif
117
118### GETTEXT: yes for multilanguage support, no to disable it.
119!if ("$(GETTEXT)"=="")
120GETTEXT = yes
121!endif
122
123### ICONV: yes to enable dynamic-iconv support, no to disable it
124!if ("$(ICONV)"=="")
125ICONV = yes
126!endif
127
128### CSCOPE: yes to enable Cscope support, no to disable it
129!if ("$(CSCOPE)"=="")
130CSCOPE = yes
131!endif
132
133### NETBEANS: yes to enable NetBeans interface support, no to disable it
134!if ("$(NETBEANS)"=="") && ("$(GUI)"=="yes")
135NETBEANS = yes
136!endif
137
138### LUA: uncomment this line if you want lua support in vim
139# LUA=c:\lua
140
141### PERL: uncomment this line if you want perl support in vim
142# PERL=c:\perl
143
144### PYTHON: uncomment this line if you want python support in vim
145# PYTHON=c:\python22
146
147### PYTHON3: uncomment this line if you want python3 support in vim
148# PYTHON3=c:\python31
149
150### RUBY: uncomment this line if you want ruby support in vim
151# RUBY=c:\ruby
152
153### TCL: uncomment this line if you want tcl support in vim
154# TCL=c:\tcl
155
156### OLE: no for normal gvim, yes for OLE-capable gvim (only works with GUI)
157#OLE = yes
158
159### OSTYPE: DOS16 for Windows 3.1 version, WIN32 for Windows 95/98/NT/2000
160#   version
161!if ("$(OSTYPE)"=="")
162OSTYPE = WIN32
163!endif
164
165### DEBUG: Uncomment to make an executable for debugging
166# DEBUG = yes
167!if ("$(DEBUG)"=="yes")
168DEBUG_FLAG = -v
169!endif
170
171### CODEGUARD: Uncomment to use the CODEGUARD stuff (BC 5.0 or later):
172# CODEGUARD = yes
173!if ("$(CODEGUARD)"=="yes")
174CODEGUARD_FLAG = -vG
175!endif
176
177### CPUNR: set your target processor (3 to 6)
178!if ("$(CPUNR)" == "i386") || ("$(CPUNR)" == "3")
179CPUNR = 3
180!elif ("$(CPUNR)" == "i486") || ("$(CPUNR)" == "4")
181CPUNR = 4
182!elif ("$(CPUNR)" == "i586") || ("$(CPUNR)" == "5")
183CPUNR = 5
184!elif ("$(CPUNR)" == "i686") || ("$(CPUNR)" == "6")
185CPUNR = 6
186!else
187CPUNR = 3
188!endif
189
190### Comment out to use precompiled headers (faster, but uses lots of disk!)
191HEADERS = -H -H=vim.csm -Hc
192
193### USEDLL: no for statically linked version of run-time, yes for DLL runtime
194!if ("$(USEDLL)"=="")
195USEDLL = no
196!endif
197
198### VIMDLL: yes for a DLL version of VIM (NOT RECOMMENDED), no otherwise
199#VIMDLL = yes
200
201### ALIGN: alignment you desire: (1,2 or 4: s/b 4 for Win32, 2 for DOS)
202!if ("$(ALIGN)"=="")
203!if ($(OSTYPE)==DOS16)
204ALIGN = 2
205!else
206ALIGN = 4
207!endif
208!endif
209
210### FASTCALL: yes to use FASTCALL calling convention (RECOMMENDED!), no otherwise
211#   Incompatible when calling external functions (like MSVC-compiled DLLs), so
212#   don't use FASTCALL when linking with external libs.
213!if ("$(FASTCALL)"=="") && \
214	("$(LUA)"=="") && \
215	("$(PYTHON)"=="") && \
216	("$(PYTHON3)"=="") && \
217	("$(PERL)"=="") && \
218	("$(TCL)"=="") && \
219	("$(RUBY)"=="") && \
220	("$(ICONV)"!="yes") && \
221	("$(IME)"!="yes") && \
222	("$(MBYTE)"!="yes") && \
223	("$(XPM)"=="")
224FASTCALL = yes
225!endif
226
227### OPTIMIZE: SPEED to optimize for speed, SPACE otherwise (SPEED RECOMMENDED)
228!if ("$(OPTIMIZE)"=="")
229OPTIMIZE = MAXSPEED
230!endif
231
232### FEATURES: TINY, SMALL, NORMAL, BIG or HUGE (BIG for WIN32, SMALL for DOS16)
233!if ("$(FEATURES)"=="")
234! if ($(OSTYPE)==DOS16)
235FEATURES = SMALL
236! else
237FEATURES = BIG
238! endif
239!endif
240
241### POSTSCRIPT: uncomment this line if you want PostScript printing
242#POSTSCRIPT = yes
243
244###
245# If you have a fixed directory for $VIM or $VIMRUNTIME, other than the normal
246# default, use these lines.
247#VIMRCLOC = somewhere
248#VIMRUNTIMEDIR = somewhere
249
250### Set the default $(WINVER) to make it work with Bcc 5.5.
251!ifndef WINVER
252WINVER = 0x0400
253!endif
254
255#
256# Sanity checks for the above options:
257#
258
259!if ($(OSTYPE)==DOS16)
260!if (($(CPUNR)+0)>4)
261!error CPUNR Must be less than or equal to 4 for DOS16
262!endif
263
264!if (($(ALIGN)+0)>2)
265!error ALIGN Must be less than or equal to 2 for DOS16
266!endif
267
268!else	# not DOS16
269!if (($(CPUNR)+0)<3)
270!error CPUNR Must be greater or equal to 3 for WIN32
271!endif
272!endif
273
274!if ($(OSTYPE)!=WIN32) && ($(OSTYPE)!=DOS16)
275!error Check the OSTYPE variable again: $(OSTYPE) is not supported!
276!endif
277
278#
279# Optimizations: change as desired (RECOMMENDATION: Don't change!):
280#
281!if ("$(DEBUG)"=="yes")
282OPT = -Od -N
283!else
284!if ("$(OPTIMIZE)"=="SPACE")
285OPT = -O1 -f- -d
286!elif ("$(OPTIMIZE)"=="MAXSPEED")
287OPT = -O2 -f- -d -Ocavi -O
288!else
289OPT = -O2 -f- -d -Oc -O
290!endif
291!if ("$(FASTCALL)"=="yes")
292OPT = $(OPT) -pr
293!endif
294!if ("$(CODEGUARD)"!="yes")
295OPT = $(OPT) -vi-
296!endif
297!endif
298!if ($(OSTYPE)==DOS16)
299!undef GUI
300!undef VIMDLL
301!undef USEDLL
302!endif
303# shouldn't have to change:
304LIB = $(BOR)\lib
305INCLUDE = $(BOR)\include;.;proto
306DEFINES = -DFEAT_$(FEATURES) -DWIN32 -DHAVE_PATHDEF \
307	  -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER)
308
309!ifdef LUA
310INTERP_DEFINES = $(INTERP_DEFINES) -DFEAT_LUA
311INCLUDE = $(LUA)\include;$(INCLUDE)
312!  ifndef LUA_VER
313LUA_VER = 51
314!  endif
315!  if ("$(DYNAMIC_LUA)" == "yes")
316INTERP_DEFINES = $(INTERP_DEFINES) -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua$(LUA_VER).dll\"
317LUA_LIB_FLAG = /nodefaultlib:
318!  endif
319!endif
320
321!ifdef PERL
322INTERP_DEFINES = $(INTERP_DEFINES) -DFEAT_PERL
323INCLUDE = $(PERL)\lib\core;$(INCLUDE)
324!  ifndef PERL_VER
325PERL_VER = 56
326!  endif
327!  if ("$(DYNAMIC_PERL)" == "yes")
328!    if ($(PERL_VER) > 55)
329INTERP_DEFINES = $(INTERP_DEFINES) -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl$(PERL_VER).dll\"
330PERL_LIB_FLAG = /nodefaultlib:
331!    else
332!      message "Cannot dynamically load Perl versions less than 5.6.  Loading statically..."
333!    endif
334!  endif
335!endif
336
337!ifdef PYTHON
338!ifdef PYTHON3
339DYNAMIC_PYTHON=yes
340DYNAMIC_PYTHON3=yes
341!endif
342!endif
343
344!ifdef PYTHON
345INTERP_DEFINES = $(INTERP_DEFINES) -DFEAT_PYTHON
346!ifndef PYTHON_VER
347PYTHON_VER = 22
348!endif
349!if "$(DYNAMIC_PYTHON)" == "yes"
350INTERP_DEFINES = $(INTERP_DEFINES) -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python$(PYTHON_VER).dll\"
351PYTHON_LIB_FLAG = /nodefaultlib:
352!endif
353!endif
354
355!ifdef PYTHON3
356INTERP_DEFINES = $(INTERP_DEFINES) -DFEAT_PYTHON3
357!ifndef PYTHON3_VER
358PYTHON3_VER = 31
359!endif
360!if "$(DYNAMIC_PYTHON3)" == "yes"
361INTERP_DEFINES = $(INTERP_DEFINES) -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"python$(PYTHON3_VER).dll\"
362PYTHON3_LIB_FLAG = /nodefaultlib:
363!endif
364!endif
365
366
367!ifdef RUBY
368!ifndef RUBY_VER
369RUBY_VER = 16
370!endif
371!ifndef RUBY_VER_LONG
372RUBY_VER_LONG = 1.6
373!endif
374
375!if "$(RUBY_VER)" == "16"
376!ifndef RUBY_PLATFORM
377RUBY_PLATFORM = i586-mswin32
378!endif
379!ifndef RUBY_INSTALL_NAME
380RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_VER)
381!endif
382!else
383!ifndef RUBY_PLATFORM
384RUBY_PLATFORM = i386-mswin32
385!endif
386!ifndef RUBY_INSTALL_NAME
387RUBY_INSTALL_NAME = msvcrt-ruby$(RUBY_VER)
388!endif
389!endif
390
391INTERP_DEFINES = $(INTERP_DEFINES) -DFEAT_RUBY
392INCLUDE = $(RUBY)\lib\ruby\$(RUBY_VER_LONG)\$(RUBY_PLATFORM);$(INCLUDE)
393
394!if "$(DYNAMIC_RUBY)" == "yes"
395INTERP_DEFINES = $(INTERP_DEFINES) -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\"
396INTERP_DEFINES = $(INTERP_DEFINES) -DDYNAMIC_RUBY_VER=$(RUBY_VER)
397RUBY_LIB_FLAG = /nodefaultlib:
398!endif
399!endif
400
401!ifdef TCL
402INTERP_DEFINES = $(INTERP_DEFINES) -DFEAT_TCL
403INCLUDE = $(TCL)\include;$(INCLUDE)
404!ifndef TCL_VER
405TCL_VER = 83
406!endif
407TCL_LIB = $(TCL)\lib\tcl$(TCL_VER).lib
408TCL_LIB_FLAG =
409!if "$(DYNAMIC_TCL)" == "yes"
410INTERP_DEFINES = $(INTERP_DEFINES) -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl$(TCL_VER).dll\"
411TCL_LIB = tclstub$(TCL_VER)-bor.lib
412TCL_LIB_FLAG =
413!endif
414!endif
415#
416# DO NOT change below:
417#
418CPUARG = -$(CPUNR)
419ALIGNARG = -a$(ALIGN)
420#
421!if ("$(DEBUG)"=="yes")
422DEFINES=$(DEFINES) -DDEBUG
423!endif
424#
425!if ("$(OLE)"=="yes")
426DEFINES = $(DEFINES) -DFEAT_OLE
427!endif
428#
429!if ("$(MBYTE)"=="yes")
430MBDEFINES = $(MBDEFINES) -DFEAT_MBYTE
431!endif
432!if ("$(IME)"=="yes")
433MBDEFINES = $(MBDEFINES) -DFEAT_MBYTE_IME
434!if ("$(DYNAMIC_IME)" == "yes")
435MBDEFINES = $(MBDEFINES) -DDYNAMIC_IME
436!endif
437!endif
438!if ("$(ICONV)"=="yes")
439MBDEFINES = $(MBDEFINES) -DDYNAMIC_ICONV
440!endif
441!if ("$(GETTEXT)"=="yes")
442MBDEFINES = $(MBDEFINES) -DDYNAMIC_GETTEXT
443!endif
444
445!if ("$(CSCOPE)"=="yes")
446DEFINES = $(DEFINES) -DFEAT_CSCOPE
447!endif
448
449!if ("$(GUI)"=="yes")
450DEFINES = $(DEFINES) -DFEAT_GUI_W32 -DFEAT_CLIPBOARD
451!if ("$(DEBUG)"=="yes")
452TARGET = gvimd.exe
453!else
454TARGET = gvim.exe
455!endif
456!if ("$(VIMDLL)"=="yes")
457EXETYPE=-WD
458DEFINES = $(DEFINES) -DVIMDLL
459!else
460EXETYPE=-W
461!endif
462STARTUPOBJ = c0w32.obj
463LINK2 = -aa
464RESFILE = vim.res
465!else
466!undef NETBEANS
467!undef XPM
468!undef VIMDLL
469!if ("$(DEBUG)"=="yes")
470TARGET = vimd.exe
471!else
472# for now, anyway: VIMDLL is only for the GUI version
473TARGET = vim.exe
474!endif
475!if ($(OSTYPE)==DOS16)
476DEFINES= -DFEAT_$(FEATURES) -DMSDOS
477EXETYPE=-ml
478STARTUPOBJ = c0l.obj
479LINK2 =
480!else
481EXETYPE=-WC
482STARTUPOBJ = c0x32.obj
483LINK2 = -ap -OS -o -P
484!endif
485RESFILE = vim.res
486!endif
487
488!if ("$(NETBEANS)"=="yes")
489DEFINES = $(DEFINES) -DFEAT_NETBEANS_INTG
490!if ("$(NBDEBUG)"=="yes")
491DEFINES = $(DEFINES) -DNBDEBUG
492NBDEBUG_DEP = nbdebug.h nbdebug.c
493!endif
494!endif
495
496!ifdef XPM
497!if ("$(GUI)"=="yes")
498DEFINES = $(DEFINES) -DFEAT_XPM_W32
499INCLUDE = $(XPM)\include;$(INCLUDE)
500!endif
501!endif
502
503!if ("$(USEDLL)"=="yes")
504DEFINES = $(DEFINES) -D_RTLDLL
505!endif
506
507!if ("$(DEBUG)"=="yes")
508OBJDIR	= $(OSTYPE)\objdbg
509!else
510!if ("$(GUI)"=="yes")
511!if ("$(OLE)"=="yes")
512OBJDIR	= $(OSTYPE)\oleobj
513!else
514OBJDIR	= $(OSTYPE)\gobj
515!endif
516!else
517OBJDIR	= $(OSTYPE)\obj
518!endif
519!endif
520
521!if ("$(POSTSCRIPT)"=="yes")
522DEFINES = $(DEFINES) -DMSWINPS
523!endif
524
525##### BASE COMPILER/TOOLS RULES #####
526MAKE = $(BOR)\bin\make
527CFLAGS = -w-aus -w-par -w-pch -w-ngu -w-csu -I$(INCLUDE)
528!if ($(OSTYPE)==DOS16)
529BRC =
530!if ("$(LINK)"=="")
531LINK	= $(BOR)\BIN\TLink
532!endif
533CC   = $(BOR)\BIN\Bcc
534LFLAGS	= -Tde -c -m -L$(LIB) $(DEBUG_FLAG) $(LINK2)
535LFLAGSDLL  =
536CFLAGS = $(CFLAGS) -H- $(HEADERS)
537!else
538BRC = $(BOR)\BIN\brc32
539!if ("$(LINK)"=="")
540LINK	= $(BOR)\BIN\ILink32
541!endif
542CC   = $(BOR)\BIN\Bcc32
543LFLAGS	= -OS -Tpe -c -m -L$(LIB) $(DEBUG_FLAG) $(LINK2)
544LFLAGSDLL  = -Tpd -c -m -L$(LIB) $(DEBUG_FLAG) $(LINK2)
545CFLAGS = $(CFLAGS) -d -RT- -k- -Oi $(HEADERS) -f-
546!endif
547
548CC1 = -c
549CC2 = -o
550CCARG = +$(OBJDIR)\bcc.cfg
551
552# implicit rules:
553
554# Without the following, the implicit rule in BUILTINS.MAK is picked up
555# for a rule for .c.obj rather than the local implicit rule
556.SUFFIXES
557.SUFFIXES .c .obj
558.path.c = .
559
560{.}.c{$(OBJDIR)}.obj:
561	$(CC) $(CCARG) $(CC1) -n$(OBJDIR)\ {$< }
562
563.cpp.obj:
564	$(CC) $(CCARG) $(CC1) $(CC2)$@ $*.cpp
565
566!if ($(OSTYPE)==DOS16)
567!else # win32:
568vimmain = \
569	$(OBJDIR)\os_w32exe.obj
570!if ("$(VIMDLL)"=="yes")
571vimwinmain = \
572	$(OBJDIR)\os_w32dll.obj
573!else
574vimwinmain = \
575	$(OBJDIR)\os_w32exe.obj
576!endif
577!endif
578
579vimobj =  \
580	$(OBJDIR)\blowfish.obj \
581	$(OBJDIR)\buffer.obj \
582	$(OBJDIR)\charset.obj \
583	$(OBJDIR)\diff.obj \
584	$(OBJDIR)\digraph.obj \
585	$(OBJDIR)\edit.obj \
586	$(OBJDIR)\eval.obj \
587	$(OBJDIR)\ex_cmds.obj \
588	$(OBJDIR)\ex_cmds2.obj \
589	$(OBJDIR)\ex_docmd.obj \
590	$(OBJDIR)\ex_eval.obj \
591	$(OBJDIR)\ex_getln.obj \
592	$(OBJDIR)\fileio.obj \
593	$(OBJDIR)\fold.obj \
594	$(OBJDIR)\getchar.obj \
595	$(OBJDIR)\hardcopy.obj \
596	$(OBJDIR)\hashtab.obj \
597	$(OBJDIR)\main.obj \
598	$(OBJDIR)\mark.obj \
599	$(OBJDIR)\memfile.obj \
600	$(OBJDIR)\memline.obj \
601	$(OBJDIR)\menu.obj \
602	$(OBJDIR)\message.obj \
603	$(OBJDIR)\misc1.obj \
604	$(OBJDIR)\misc2.obj \
605	$(OBJDIR)\move.obj \
606	$(OBJDIR)\mbyte.obj \
607	$(OBJDIR)\normal.obj \
608	$(OBJDIR)\ops.obj \
609	$(OBJDIR)\option.obj \
610	$(OBJDIR)\popupmnu.obj \
611	$(OBJDIR)\quickfix.obj \
612	$(OBJDIR)\regexp.obj \
613	$(OBJDIR)\screen.obj \
614	$(OBJDIR)\search.obj \
615	$(OBJDIR)\sha256.obj \
616	$(OBJDIR)\spell.obj \
617	$(OBJDIR)\syntax.obj \
618	$(OBJDIR)\tag.obj \
619	$(OBJDIR)\term.obj \
620	$(OBJDIR)\ui.obj \
621	$(OBJDIR)\undo.obj \
622	$(OBJDIR)\version.obj \
623	$(OBJDIR)\window.obj \
624	$(OBJDIR)\pathdef.obj
625
626!if ("$(OLE)"=="yes")
627vimobj = $(vimobj) \
628	$(OBJDIR)\if_ole.obj
629!endif
630
631!ifdef LUA
632vimobj = $(vimobj) \
633    $(OBJDIR)\if_lua.obj
634!endif
635
636!ifdef PERL
637vimobj = $(vimobj) \
638    $(OBJDIR)\if_perl.obj
639!endif
640
641!ifdef PYTHON
642vimobj = $(vimobj) \
643    $(OBJDIR)\if_python.obj
644!endif
645
646!ifdef PYTHON3
647vimobj = $(vimobj) \
648    $(OBJDIR)\if_python3.obj
649!endif
650
651!ifdef RUBY
652vimobj = $(vimobj) \
653    $(OBJDIR)\if_ruby.obj
654!endif
655
656!ifdef TCL
657vimobj = $(vimobj) \
658    $(OBJDIR)\if_tcl.obj
659!endif
660
661!if ("$(CSCOPE)"=="yes")
662vimobj = $(vimobj) \
663    $(OBJDIR)\if_cscope.obj
664!endif
665
666!if ("$(NETBEANS)"=="yes")
667vimobj = $(vimobj) \
668    $(OBJDIR)\netbeans.obj
669!endif
670
671!ifdef XPM
672vimobj = $(vimobj) \
673    $(OBJDIR)\xpm_w32.obj
674!endif
675
676!if ("$(VIMDLL)"=="yes")
677vimdllobj = $(vimobj)
678!if ("$(DEBUG)"=="yes")
679DLLTARGET = vim32d.dll
680!else
681DLLTARGET = vim32.dll
682!endif
683!else
684DLLTARGET = joebob
685!endif
686
687!if ("$(GUI)"=="yes")
688vimobj = $(vimobj) \
689	$(vimwinmain) \
690	$(OBJDIR)\gui.obj \
691	$(OBJDIR)\gui_beval.obj \
692	$(OBJDIR)\gui_w32.obj
693!endif
694
695!if ($(OSTYPE)==WIN32)
696vimobj = $(vimobj) \
697	$(OBJDIR)\os_win32.obj $(OBJDIR)\os_mswin.obj
698!elif ($(OSTYPE)==DOS16)
699vimobj = $(vimobj) \
700	$(OBJDIR)\os_msdos.obj
701!endif
702# Blab what we are going to do:
703MSG = Compiling $(OSTYPE) $(TARGET) $(OLETARGET), with:
704!if ("$(GUI)"=="yes")
705MSG = $(MSG) GUI
706!endif
707!if ("$(OLE)"=="yes")
708MSG = $(MSG) OLE
709!endif
710!if ("$(USEDLL)"=="yes")
711MSG = $(MSG) USEDLL
712!endif
713!if ("$(VIMDLL)"=="yes")
714MSG = $(MSG) VIMDLL
715!endif
716!if ("$(FASTCALL)"=="yes")
717MSG = $(MSG) FASTCALL
718!endif
719!if ("$(MBYTE)"=="yes")
720MSG = $(MSG) MBYTE
721!endif
722!if ("$(IME)"=="yes")
723MSG = $(MSG) IME
724! if "$(DYNAMIC_IME)" == "yes"
725MSG = $(MSG)(dynamic)
726! endif
727!endif
728!if ("$(GETTEXT)"=="yes")
729MSG = $(MSG) GETTEXT
730!endif
731!if ("$(ICONV)"=="yes")
732MSG = $(MSG) ICONV
733!endif
734!if ("$(DEBUG)"=="yes")
735MSG = $(MSG) DEBUG
736!endif
737!if ("$(CODEGUARD)"=="yes")
738MSG = $(MSG) CODEGUARD
739!endif
740!if ("$(CSCOPE)"=="yes")
741MSG = $(MSG) CSCOPE
742!endif
743!if ("$(NETBEANS)"=="yes")
744MSG = $(MSG) NETBEANS
745!endif
746!ifdef XPM
747MSG = $(MSG) XPM
748!endif
749!ifdef LUA
750MSG = $(MSG) LUA
751! if "$(DYNAMIC_LUA)" == "yes"
752MSG = $(MSG)(dynamic)
753! endif
754!endif
755!ifdef PERL
756MSG = $(MSG) PERL
757! if "$(DYNAMIC_PERL)" == "yes"
758MSG = $(MSG)(dynamic)
759! endif
760!endif
761!ifdef PYTHON
762MSG = $(MSG) PYTHON
763! if "$(DYNAMIC_PYTHON)" == "yes"
764MSG = $(MSG)(dynamic)
765! endif
766!endif
767!ifdef PYTHON3
768MSG = $(MSG) PYTHON3
769! if "$(DYNAMIC_PYTHON3)" == "yes"
770MSG = $(MSG)(dynamic)
771! endif
772!endif
773!ifdef RUBY
774MSG = $(MSG) RUBY
775! if "$(DYNAMIC_RUBY)" == "yes"
776MSG = $(MSG)(dynamic)
777! endif
778!endif
779!ifdef TCL
780MSG = $(MSG) TCL
781! if "$(DYNAMIC_TCL)" == "yes"
782MSG = $(MSG)(dynamic)
783! endif
784!endif
785MSG = $(MSG) cpu=$(CPUARG)
786MSG = $(MSG) Align=$(ALIGNARG)
787
788!message $(MSG)
789
790!if ($(OSTYPE)==DOS16)
791TARGETS = $(TARGET)
792!else
793!if ("$(VIMDLL)"=="yes")
794TARGETS = $(DLLTARGET)
795!endif
796TARGETS = $(TARGETS) $(TARGET)
797!endif
798
799# Targets:
800all: vim vimrun.exe install.exe xxd uninstal.exe GvimExt/gvimext.dll
801
802vim: $(OSTYPE) $(OBJDIR) $(OBJDIR)\bcc.cfg $(TARGETS)
803	@if exist $(OBJDIR)\version.obj del $(OBJDIR)\version.obj
804	@if exist auto\pathdef.c del auto\pathdef.c
805
806$(OSTYPE):
807	-@md $(OSTYPE)
808
809$(OBJDIR):
810	-@md $(OBJDIR)
811
812xxd:
813	@cd xxd
814	$(MAKE) /f Make_bc5.mak BOR="$(BOR)" BCC="$(CC)"
815	@cd ..
816
817GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h
818	cd GvimExt
819	$(MAKE) /f Make_bc5.mak USEDLL=$(USEDLL) BOR=$(BOR)
820	cd ..
821
822install.exe: dosinst.c $(OBJDIR)\bcc.cfg
823!if ($(OSTYPE)==WIN32)
824	$(CC) $(CCARG) -WC -DWIN32 -einstall dosinst.c
825!else
826	$(CC) $(CCARG) -WC -einstall dosinst.c
827!endif
828
829uninstal.exe: uninstal.c $(OBJDIR)\bcc.cfg
830!if ($(OSTYPE)==WIN32)
831	$(CC) $(CCARG) -WC -DWIN32 -O2 -euninstal uninstal.c
832!else
833	$(CC) $(CCARG) -WC -O2 -euninstal uninstal.c
834!endif
835
836clean:
837!if "$(OS)" == "Windows_NT"
838	# For Windows NT/2000, doesn't work on Windows 95/98...
839	# $(COMSPEC) needed to ensure rmdir.exe is not run
840	-@$(COMSPEC) /C rmdir /Q /S $(OBJDIR)
841!else
842	# For Windows 95/98, doesn't work on Windows NT/2000...
843	-@deltree /y $(OBJDIR)
844!endif
845	-@del *.res
846	-@del vim32*.dll
847	-@del vim32*.lib
848	-@del *vim*.exe
849	-@del *install*.exe
850	-@del *.csm
851	-@del *.map
852	-@del *.ilc
853	-@del *.ild
854	-@del *.ilf
855	-@del *.ils
856	-@del *.tds
857!ifdef LUA
858	-@del lua.lib
859!endif
860!ifdef PERL
861	-@del perl.lib
862!endif
863!ifdef PYTHON
864	-@del python.lib
865!endif
866!ifdef PYTHON3
867	-@del python3.lib
868!endif
869!ifdef RUBY
870	-@del ruby.lib
871!endif
872!ifdef TCL
873	-@del tcl.lib
874!endif
875!ifdef XPM
876	-@del xpm.lib
877!endif
878	cd xxd
879	$(MAKE) /f Make_bc5.mak BOR="$(BOR)" clean
880	cd ..
881	cd GvimExt
882	$(MAKE) /f Make_bc5.mak BOR="$(BOR)" clean
883	cd ..
884
885$(DLLTARGET): $(OBJDIR) $(vimdllobj)
886  $(LINK) @&&|
887	$(LFLAGSDLL) +
888	c0d32.obj +
889	$(vimdllobj)
890	$<,$*
891!if ("$(CODEGUARD)"=="yes")
892	cg32.lib+
893!endif
894# $(OSTYPE)==WIN32 causes os_mswin.c compilation. FEAT_SHORTCUT in it needs OLE
895!if ("$(OLE)"=="yes" || $(OSTYPE)==WIN32)
896	ole2w32.lib +
897!endif
898!if ($(OSTYPE)==WIN32)
899	import32.lib+
900!ifdef LUA
901	$(LUA_LIB_FLAG)lua.lib+
902!endif
903!ifdef PERL
904	$(PERL_LIB_FLAG)perl.lib+
905!endif
906!ifdef PYTHON
907	$(PYTHON_LIB_FLAG)python.lib+
908!endif
909!ifdef PYTHON3
910	$(PYTHON3_LIB_FLAG)python3.lib+
911!endif
912!ifdef RUBY
913	$(RUBY_LIB_FLAG)ruby.lib+
914!endif
915!ifdef TCL
916	$(TCL_LIB_FLAG)tcl.lib+
917!endif
918!ifdef XPM
919	xpm.lib+
920!endif
921!if ("$(USEDLL)"=="yes")
922	cw32i.lib
923!else
924	cw32.lib
925!endif
926	vim.def
927!else
928	cl.lib
929!endif
930|
931
932!if ("$(VIMDLL)"=="yes")
933$(TARGET): $(OBJDIR) $(DLLTARGET) $(vimmain) $(OBJDIR)\$(RESFILE)
934!else
935$(TARGET): $(OBJDIR) $(vimobj) $(OBJDIR)\$(RESFILE)
936!endif
937  $(LINK) @&&|
938	$(LFLAGS) +
939	$(STARTUPOBJ) +
940!if ("$(VIMDLL)"=="yes")
941	$(vimmain)
942!else
943	$(vimobj)
944!endif
945	$<,$*
946!if ($(OSTYPE)==WIN32)
947!if ("$(CODEGUARD)"=="yes")
948	cg32.lib+
949!endif
950# $(OSTYPE)==WIN32 causes os_mswin.c compilation. FEAT_SHORTCUT in it needs OLE
951!if ("$(OLE)"=="yes" || $(OSTYPE)==WIN32)
952	ole2w32.lib +
953!endif
954	import32.lib+
955!ifdef LUA
956	$(LUA_LIB_FLAG)lua.lib+
957!endif
958!ifdef PERL
959	$(PERL_LIB_FLAG)perl.lib+
960!endif
961!ifdef PYTHON
962	$(PYTHON_LIB_FLAG)python.lib+
963!endif
964!ifdef PYTHON3
965	$(PYTHON3_LIB_FLAG)python3.lib+
966!endif
967!ifdef RUBY
968	$(RUBY_LIB_FLAG)ruby.lib+
969!endif
970!ifdef TCL
971	$(TCL_LIB_FLAG)tcl.lib+
972!endif
973!ifdef XPM
974	xpm.lib+
975!endif
976!if ("$(USEDLL)"=="yes")
977	cw32i.lib
978!else
979	cw32.lib
980!endif
981
982	$(OBJDIR)\$(RESFILE)
983!else
984	emu.lib + cl.lib
985!endif
986|
987
988test:
989	cd testdir
990	$(MAKE) /NOLOGO -f Make_dos.mak win32
991	cd ..
992
993$(OBJDIR)\ex_docmd.obj:  ex_docmd.c ex_cmds.h
994
995$(OBJDIR)\ex_eval.obj:  ex_eval.c ex_cmds.h
996
997$(OBJDIR)\if_ole.obj: if_ole.cpp
998
999$(OBJDIR)\if_lua.obj: if_lua.c lua.lib
1000	$(CC) $(CCARG) $(CC1) $(CC2)$@ -pc if_lua.c
1001
1002$(OBJDIR)\if_perl.obj: if_perl.c perl.lib
1003	$(CC) $(CCARG) $(CC1) $(CC2)$@ -pc if_perl.c
1004
1005if_perl.c: if_perl.xs typemap
1006	$(PERL)\bin\perl.exe $(PERL)\lib\ExtUtils\xsubpp -prototypes -typemap \
1007	    $(PERL)\lib\ExtUtils\typemap if_perl.xs > $@
1008
1009$(OBJDIR)\if_python.obj: if_python.c python.lib
1010	$(CC) -I$(PYTHON)\include $(CCARG) $(CC1) $(CC2)$@ -pc if_python.c
1011
1012$(OBJDIR)\if_python3.obj: if_python3.c python3.lib
1013	$(CC) -I$(PYTHON3)\include $(CCARG) $(CC1) $(CC2)$@ -pc if_python3.c
1014
1015$(OBJDIR)\if_ruby.obj: if_ruby.c ruby.lib
1016	$(CC) $(CCARG) $(CC1) $(CC2)$@ -pc if_ruby.c
1017
1018$(OBJDIR)\if_tcl.obj: if_tcl.c tcl.lib
1019	$(CC) $(CCARG) $(CC1) $(CC2)$@ -pc if_tcl.c
1020
1021$(OBJDIR)\xpm_w32.obj: xpm_w32.c xpm.lib
1022	$(CC) $(CCARG) $(CC1) $(CC2)$@ -pc xpm_w32.c
1023
1024$(OBJDIR)\netbeans.obj: netbeans.c $(NBDEBUG_DEP)
1025	$(CC) $(CCARG) $(CC1) $(CC2)$@ netbeans.c
1026
1027$(OBJDIR)\vim.res: vim.rc version.h tools.bmp tearoff.bmp \
1028		vim.ico vim_error.ico vim_alert.ico vim_info.ico vim_quest.ico
1029	$(BRC) -fo$(OBJDIR)\vim.res -i $(BOR)\include -w32 -r vim.rc @&&|
1030	$(DEFINES)
1031|
1032
1033$(OBJDIR)\pathdef.obj:	auto\pathdef.c
1034	$(CC) $(CCARG) $(CC1) $(CC2)$@ auto\pathdef.c
1035
1036
1037# Need to escape both quotes and backslashes in $INTERP_DEFINES
1038INTERP_DEFINES_ESC_BKS=$(INTERP_DEFINES:\=\\)
1039INTERP_DEFINES_ESC=$(INTERP_DEFINES_ESC_BKS:"=\")
1040
1041# Note:  the silly /*"*/ below are there to trick make into accepting
1042# the # character as something other than a comment without messing up
1043# the preprocessor directive.
1044auto\pathdef.c::
1045	-@md auto
1046	@echo creating auto/pathdef.c
1047	@copy /y &&|
1048/* pathdef.c */
1049/*"*/#include "vim.h"/*"*/
1050
1051char_u *default_vim_dir = (char_u *)"$(VIMRCLOC:\=\\)";
1052char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR:\=\\)";
1053char_u *all_cflags = (char_u *)"$(CC:\=\\) $(CFLAGS:\=\\) $(DEFINES) $(MBDEFINES) $(INTERP_DEFINES_ESC) $(OPT) $(EXETYPE) $(CPUARG) $(ALIGNARG) $(DEBUG_FLAG) $(CODEGUARD_FLAG)";
1054char_u *all_lflags = (char_u *)"$(LINK:\=\\) $(LFLAGS:\=\\)";
1055char_u *compiled_user = (char_u *)"$(USERNAME)";
1056char_u *compiled_sys = (char_u *)"$(USERDOMAIN)";
1057| auto\pathdef.c
1058
1059lua.lib: $(LUA)\lib\lua$(LUA_VER).lib
1060	coff2omf $(LUA)\lib\lua$(LUA_VER).lib $@
1061
1062perl.lib: $(PERL)\lib\CORE\perl$(PERL_VER).lib
1063	coff2omf $(PERL)\lib\CORE\perl$(PERL_VER).lib $@
1064
1065python.lib: $(PYTHON)\libs\python$(PYTHON_VER).lib
1066	coff2omf $(PYTHON)\libs\python$(PYTHON_VER).lib $@
1067
1068python3.lib: $(PYTHON3)\libs\python$(PYTHON3_VER).lib
1069	coff2omf $(PYTHON3)\libs\python$(PYTHON3_VER).lib $@
1070
1071ruby.lib: $(RUBY)\lib\$(RUBY_INSTALL_NAME).lib
1072	coff2omf $(RUBY)\lib\$(RUBY_INSTALL_NAME).lib $@
1073
1074# For some reason, the coff2omf method doesn't work on libXpm.lib, so
1075# we have to manually generate an import library straight from the DLL.
1076xpm.lib: $(XPM)\lib\libXpm.lib
1077	implib -a $@ $(XPM)\bin\libXpm.dll
1078
1079tcl.lib: $(TCL_LIB)
1080!if ("$(DYNAMIC_TCL)" == "yes")
1081	copy $(TCL_LIB) $@
1082!else
1083	coff2omf $(TCL_LIB) $@
1084!endif
1085
1086!if ("$(DYNAMIC_TCL)" == "yes")
1087tclstub$(TCL_VER)-bor.lib:
1088	-@IF NOT EXIST $@ ECHO You must download tclstub$(TCL_VER)-bor.lib separately and\
1089	place it in the src directory in order to compile a dynamic TCL-enabled\
1090	(g)vim with the Borland compiler.  You can get the tclstub$(TCL_VER)-bor.lib file\
1091	at http://mywebpage.netscape.com/sharppeople/vim/tclstub$(TCL_VER)-bor.lib
1092!endif
1093
1094# vimrun.exe:
1095vimrun.exe: vimrun.c
1096!if ("$(USEDLL)"=="yes")
1097	$(CC) -WC -O1 -I$(INCLUDE) -L$(LIB) -D_RTLDLL vimrun.c cw32mti.lib
1098!else
1099	$(CC) -WC -O1 -I$(INCLUDE) -L$(LIB) vimrun.c
1100!endif
1101
1102# The dependency on $(OBJDIR) is to have bcc.cfg generated each time.
1103$(OBJDIR)\bcc.cfg: Make_bc5.mak $(OBJDIR)
1104  copy /y &&|
1105	$(CFLAGS)
1106	-L$(LIB)
1107	$(DEFINES)
1108	$(MBDEFINES)
1109	$(INTERP_DEFINES)
1110	$(EXETYPE)
1111	$(DEBUG_FLAG)
1112	$(OPT)
1113	$(CODEGUARD_FLAG)
1114	$(CPUARG)
1115	$(ALIGNARG)
1116| $@
1117
1118# vi:set sts=4 sw=4:
1119
1120