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