blob: 61300722ff3d5c5171c1f8f2cc1b63d792d5ab48 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001#
2# Makefile for VIM on Win32, using Cygnus gcc
Bram Moolenaare88a5f32013-11-28 16:32:38 +01003# Last updated by Dan Sharp. Last Change: 2013 Nov 28
Bram Moolenaar65c1b012005-01-31 19:02:28 +00004#
5# Also read INSTALLpc.txt!
Bram Moolenaar071d4272004-06-13 20:20:40 +00006#
7# This compiles Vim as a Windows application. If you want Vim to run as a
8# Cygwin application use the Makefile (just like on Unix).
9#
10# GUI no or yes: set to yes if you want the GUI version (yes)
11# PERL define to path to Perl dir to get Perl support (not defined)
12# PERL_VER define to version of Perl being used (56)
13# DYNAMIC_PERL no or yes: set to yes to load the Perl DLL dynamically (yes)
14# PYTHON define to path to Python dir to get PYTHON support (not defined)
15# PYTHON_VER define to version of Python being used (22)
16# DYNAMIC_PYTHON no or yes: use yes to load the Python DLL dynamically (yes)
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +020017# PYTHON3 define to path to Python3 dir to get PYTHON3 support (not defined)
18# PYTHON3_VER define to version of Python3 being used (22)
19# DYNAMIC_PYTHON3 no or yes: use yes to load the Python3 DLL dynamically (yes)
Bram Moolenaar071d4272004-06-13 20:20:40 +000020# TCL define to path to TCL dir to get TCL support (not defined)
21# TCL_VER define to version of TCL being used (83)
22# DYNAMIC_TCL no or yes: use yes to load the TCL DLL dynamically (yes)
23# RUBY define to path to Ruby dir to get Ruby support (not defined)
Bram Moolenaardd53a412012-11-28 16:18:29 +010024# RUBY_VER define to version of Ruby being used (16)
25# RUBY_VER_LONG same, but in format with dot. (1.6)
26# You must set RUBY_VER_LONG when changing RUBY_VER.
27# You must set RUBY_API_VER version to RUBY_VER_LONG.
28# Don't set ruby API version to RUBY_VER like 191.
Bram Moolenaar071d4272004-06-13 20:20:40 +000029# DYNAMIC_RUBY no or yes: use yes to load the Ruby DLL dynamically (yes)
Bram Moolenaar281bdce2005-01-25 21:53:18 +000030# MZSCHEME define to path to MzScheme dir to get MZSCHEME support (not defined)
31# MZSCHEME_VER define to version of MzScheme being used (209_000)
32# DYNAMIC_MZSCHEME no or yes: use yes to load the MzScheme DLLs dynamically (yes)
Bram Moolenaar65c1b012005-01-31 19:02:28 +000033# MZSCHEME_DLLS path to MzScheme DLLs (libmzgc and libmzsch), for "static" build.
Bram Moolenaar2d0860d2010-11-03 21:59:30 +010034# MZSCHEME_USE_RACKET define to use "racket" instead of "mzsch".
Bram Moolenaar0ba04292010-07-14 23:23:17 +020035# LUA define to path to Lua dir to get Lua support (not defined)
36# LUA_VER define to version of Lua being used (51)
37# DYNAMIC_LUA no or yes: use yes to load the Lua DLL dynamically (yes)
Bram Moolenaar071d4272004-06-13 20:20:40 +000038# GETTEXT no or yes: set to yes for dynamic gettext support (yes)
39# ICONV no or yes: set to yes for dynamic iconv support (yes)
40# MBYTE no or yes: set to yes to include multibyte support (yes)
41# IME no or yes: set to yes to include IME support (yes)
42# DYNAMIC_IME no or yes: set to yes to load imm32.dll dynamically (yes)
43# OLE no or yes: set to yes to make OLE gvim (no)
44# DEBUG no or yes: set to yes if you wish a DEBUGging build (no)
Bram Moolenaar1cd871b2004-12-19 22:46:22 +000045# CPUNR No longer supported, use ARCH.
Bram Moolenaar48f80c22010-02-24 15:08:27 +010046# ARCH i386 through pentium4: select -march argument to compile with
47# (i386)
Bram Moolenaar071d4272004-06-13 20:20:40 +000048# USEDLL no or yes: set to yes to use the Runtime library DLL (no)
49# For USEDLL=yes the cygwin1.dll is required to run Vim.
Bram Moolenaarc2149ea2013-02-13 17:06:11 +010050# For "no" the mingw-gcc-g++ package or the mingw64-i686-gcc-g++
Bram Moolenaar84a05ac2013-05-06 04:24:17 +020051# package is required to compile Vim. Or set CC to gcc-3 and add
Bram Moolenaar164fca32010-07-14 13:58:07 +020052# -L/lib/w32api to EXTRA_LIBS.
Bram Moolenaar071d4272004-06-13 20:20:40 +000053# POSTSCRIPT no or yes: set to yes for PostScript printing (no)
54# FEATURES TINY, SMALL, NORMAL, BIG or HUGE (BIG)
Bram Moolenaar95b557b2012-07-06 13:40:50 +020055# WINVER Lowest Win32 version to support. (0x0500)
Bram Moolenaar071d4272004-06-13 20:20:40 +000056# CSCOPE no or yes: to include cscope interface support (yes)
57# OPTIMIZE SPACE, SPEED, or MAXSPEED: set optimization level (MAXSPEED)
58# NETBEANS no or yes: to include netbeans interface support (yes when GUI
59# is yes)
Bram Moolenaarc9b4b052006-04-30 18:54:39 +000060# NBDEBUG no or yes: to include netbeans interface debugging support (no)
Bram Moolenaar071d4272004-06-13 20:20:40 +000061# XPM define to path to XPM dir to get XPM image support (not defined)
62#>>>>> choose options:
63ifndef GUI
64GUI=yes
65endif
66
67ifndef FEATURES
68FEATURES = BIG
69endif
70
71ifndef GETTEXT
72GETTEXT = yes
73endif
74
75ifndef ICONV
76ICONV = yes
77endif
78
79ifndef MBYTE
80MBYTE = yes
81endif
82
83ifndef IME
84IME = yes
85endif
86
Bram Moolenaar071d4272004-06-13 20:20:40 +000087ifndef ARCH
88ARCH = i386
89endif
90
91ifndef WINVER
Bram Moolenaar95b557b2012-07-06 13:40:50 +020092WINVER = 0x0500
Bram Moolenaar071d4272004-06-13 20:20:40 +000093endif
94
95ifndef CSCOPE
96CSCOPE = yes
97endif
98
99ifndef NETBEANS
100ifeq ($(GUI),yes)
101NETBEANS = yes
102endif
103endif
104
105ifndef OPTIMIZE
106OPTIMIZE = MAXSPEED
107endif
108
Bram Moolenaar5004e882013-02-16 18:16:15 +0100109
110# Link against the shared version of libstdc++ by default. Set
111# STATIC_STDCPLUS to "yes" to link against static version instead.
112ifndef STATIC_STDCPLUS
113STATIC_STDCPLUS=no
114endif
115
Bram Moolenaar071d4272004-06-13 20:20:40 +0000116### See feature.h for a list of optionals.
117### Any other defines can be included here.
118
119DEFINES = -DWIN32 -DHAVE_PATHDEF -DFEAT_$(FEATURES) \
120 -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER)
Bram Moolenaar254e0282013-07-06 13:35:08 +0200121ifeq ($(ARCH),x86-64)
122DEFINES+=-DMS_WIN64
123endif
Bram Moolenaar1cd871b2004-12-19 22:46:22 +0000124INCLUDES = -march=$(ARCH) -Iproto
Bram Moolenaar071d4272004-06-13 20:20:40 +0000125
126#>>>>> name of the compiler and linker, name of lib directory
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100127ifeq (yes, $(USEDLL))
128# CROSS_COMPILE is used for the gvimext DLL.
129CROSS_COMPILE = i686-pc-mingw32-
Bram Moolenaar071d4272004-06-13 20:20:40 +0000130CC = gcc
131RC = windres
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100132else
133# i686-pc-mingw32-gcc, i686-w64-mingw32-gcc or gcc-3 can be used.
134CROSS_COMPILE = i686-pc-mingw32-
135CC = $(CROSS_COMPILE)gcc
136RC = $(CROSS_COMPILE)windres
137endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000138
139##############################
140# DYNAMIC_PERL=yes and no both work
141##############################
142ifdef PERL
143DEFINES += -DFEAT_PERL
144INCLUDES += -I$(PERL)/lib/CORE
145EXTRA_OBJS += $(OUTDIR)/if_perl.o
146
147ifndef DYNAMIC_PERL
148DYNAMIC_PERL = yes
149endif
150
151ifndef PERL_VER
152PERL_VER = 56
153endif
154
155ifeq (yes, $(DYNAMIC_PERL))
156DEFINES += -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl$(PERL_VER).dll\"
157else
158EXTRA_LIBS += $(PERL)/lib/CORE/perl$(PERL_VER).lib
159endif
160endif
161
162##############################
163# DYNAMIC_PYTHON=yes works.
164# DYNAMIC_PYTHON=no does not (unresolved externals on link).
165##############################
166ifdef PYTHON
167DEFINES += -DFEAT_PYTHON
Bram Moolenaar071d4272004-06-13 20:20:40 +0000168EXTRA_OBJS += $(OUTDIR)/if_python.o
169
170ifndef DYNAMIC_PYTHON
171DYNAMIC_PYTHON = yes
172endif
173
174ifndef PYTHON_VER
175PYTHON_VER = 22
176endif
177
178ifeq (yes, $(DYNAMIC_PYTHON))
179DEFINES += -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python$(PYTHON_VER).dll\"
180else
181EXTRA_LIBS += $(PYTHON)/libs/python$(PYTHON_VER).lib
182endif
183endif
184
185##############################
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200186# DYNAMIC_PYTHON3=yes works.
187# DYNAMIC_PYTHON3=no does not (unresolved externals on link).
188##############################
189ifdef PYTHON3
190DEFINES += -DFEAT_PYTHON3
191EXTRA_OBJS += $(OUTDIR)/if_python3.o
192
193ifndef DYNAMIC_PYTHON3
194DYNAMIC_PYTHON3 = yes
195endif
196
197ifndef PYTHON3_VER
198PYTHON3_VER = 31
199endif
200
201ifeq (yes, $(DYNAMIC_PYTHON3))
202DEFINES += -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"python$(PYTHON3_VER).dll\"
203else
204EXTRA_LIBS += $(PYTHON3)/libs/python$(PYTHON3_VER).lib
205endif
206endif
207
208##############################
Bram Moolenaar071d4272004-06-13 20:20:40 +0000209# DYNAMIC_RUBY=yes works.
210# DYNAMIC_RUBY=no does not (process exits).
211##############################
212ifdef RUBY
213
Bram Moolenaar071d4272004-06-13 20:20:40 +0000214ifndef DYNAMIC_RUBY
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100215DYNAMIC_RUBY=yes
216endif
217# Set default value
218ifndef RUBY_VER
219RUBY_VER = 16
220endif
221ifndef RUBY_VER_LONG
222RUBY_VER_LONG = 1.6
223endif
224ifndef RUBY_API_VER
225RUBY_API_VER = $(subst .,,$(RUBY_VER_LONG))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000226endif
227
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100228ifndef RUBY_PLATFORM
Bram Moolenaar071d4272004-06-13 20:20:40 +0000229ifeq ($(RUBY_VER), 16)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000230RUBY_PLATFORM = i586-mswin32
Bram Moolenaar071d4272004-06-13 20:20:40 +0000231else
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100232ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/i386-mingw32),)
233RUBY_PLATFORM = i386-mingw32
234else
Bram Moolenaardb3fbe52013-03-07 15:16:21 +0100235ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/x64-mingw32),)
236RUBY_PLATFORM = x64-mingw32
237else
Bram Moolenaar071d4272004-06-13 20:20:40 +0000238RUBY_PLATFORM = i386-mswin32
239endif
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100240endif
241endif
Bram Moolenaardb3fbe52013-03-07 15:16:21 +0100242endif
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100243
Bram Moolenaar071d4272004-06-13 20:20:40 +0000244ifndef RUBY_INSTALL_NAME
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100245ifeq ($(RUBY_VER), 16)
246RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_API_VER)
247else
Bram Moolenaardb3fbe52013-03-07 15:16:21 +0100248ifeq ($(ARCH),x86-64)
249RUBY_INSTALL_NAME = x64-msvcrt-ruby$(RUBY_API_VER)
250else
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100251RUBY_INSTALL_NAME = msvcrt-ruby$(RUBY_API_VER)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000252endif
253endif
Bram Moolenaardb3fbe52013-03-07 15:16:21 +0100254endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000255
Bram Moolenaardd53a412012-11-28 16:18:29 +0100256ifeq (19, $(word 1,$(sort 19 $(RUBY_VER))))
257RUBY_19_OR_LATER = 1
258endif
259
Bram Moolenaar071d4272004-06-13 20:20:40 +0000260DEFINES += -DFEAT_RUBY
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100261ifneq ($(findstring w64-mingw32,$(CC)),)
262# A workaround for mingw-w64
263DEFINES += -DHAVE_STRUCT_TIMESPEC -DHAVE_STRUCT_TIMEZONE
264endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000265INCLUDES += -I$(RUBY)/lib/ruby/$(RUBY_VER_LONG)/$(RUBY_PLATFORM)
Bram Moolenaardd53a412012-11-28 16:18:29 +0100266ifdef RUBY_19_OR_LATER
267INCLUDES += -I$(RUBY)/include/ruby-$(RUBY_VER_LONG) -I$(RUBY)/include/ruby-$(RUBY_VER_LONG)/$(RUBY_PLATFORM)
268endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000269EXTRA_OBJS += $(OUTDIR)/if_ruby.o
270
271ifeq (yes, $(DYNAMIC_RUBY))
272DEFINES += -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\"
273DEFINES += -DDYNAMIC_RUBY_VER=$(RUBY_VER)
274else
Bram Moolenaare88a5f32013-11-28 16:32:38 +0100275EXTRA_LIBS += $(RUBY)/lib/$(RUBY_INSTALL_NAME)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000276endif
277endif
278
279##############################
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000280# DYNAMIC_MZSCHEME=yes works
281# DYNAMIC_MZSCHEME=no works too
282##############################
283ifdef MZSCHEME
284DEFINES += -DFEAT_MZSCHEME
285INCLUDES += -I$(MZSCHEME)/include
286EXTRA_OBJS += $(OUTDIR)/if_mzsch.o
287
288ifndef DYNAMIC_MZSCHEME
289DYNAMIC_MZSCHEME = yes
290endif
291
292ifndef MZSCHEME_VER
293MZSCHEME_VER = 209_000
294endif
295
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000296ifndef MZSCHEME_PRECISE_GC
297MZSCHEME_PRECISE_GC=no
298endif
299
300# for version 4.x we need to generate byte-code for Scheme base
301ifndef MZSCHEME_GENERATE_BASE
302MZSCHEME_GENERATE_BASE=no
303endif
304
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100305ifndef MZSCHEME_USE_RACKET
306MZSCHEME_MAIN_LIB=mzsch
307else
308MZSCHEME_MAIN_LIB=racket
309endif
310
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000311ifeq (yes, $(DYNAMIC_MZSCHEME))
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100312DEFINES += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000313else
314ifndef MZSCHEME_DLLS
315MZSCHEME_DLLS = $(MZSCHEME)
316endif
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000317ifeq (yes,$(MZSCHEME_PRECISE_GC))
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100318MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER)
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000319else
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100320MZSCHEME_LIB = -l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000321endif
322EXTRA_LIBS += -L$(MZSCHEME_DLLS) -L$(MZSCHEME_DLLS)/lib $(MZSCHEME_LIB)
323endif
324ifeq (yes,$(MZSCHEME_GENERATE_BASE))
325DEFINES += -DINCLUDE_MZSCHEME_BASE
326MZ_EXTRA_DEP += mzscheme_base.c
327endif
328ifeq (yes,$(MZSCHEME_PRECISE_GC))
329DEFINES += -DMZ_PRECISE_GC
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000330endif
331endif
332
333##############################
Bram Moolenaar071d4272004-06-13 20:20:40 +0000334# DYNAMIC_TCL=yes and no both work.
335##############################
336ifdef TCL
337DEFINES += -DFEAT_TCL
338INCLUDES += -I$(TCL)/include
339EXTRA_OBJS += $(OUTDIR)/if_tcl.o
340
341ifndef DYNAMIC_TCL
342DYNAMIC_TCL = yes
343endif
344
345ifndef TCL_VER
346TCL_VER = 83
347endif
348
349ifeq (yes, $(DYNAMIC_TCL))
350DEFINES += -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl$(TCL_VER).dll\"
351EXTRA_LIBS += $(TCL)/lib/tclstub$(TCL_VER).lib
352else
353EXTRA_LIBS += $(TCL)/lib/tcl$(TCL_VER).lib
354endif
355endif
356
357##############################
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200358# DYNAMIC_LUA=yes works.
359# DYNAMIC_LUA=no does not (unresolved externals on link).
360##############################
361ifdef LUA
362DEFINES += -DFEAT_LUA
363INCLUDES += -I$(LUA)/include
364EXTRA_OBJS += $(OUTDIR)/if_lua.o
365
366ifndef DYNAMIC_LUA
367DYNAMIC_LUA = yes
368endif
369
370ifndef LUA_VER
371LUA_VER = 51
372endif
373
374ifeq (yes, $(DYNAMIC_LUA))
375DEFINES += -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua$(LUA_VER).dll\"
376else
377EXTRA_LIBS += $(LUA)/lib/lua$(LUA_VER).lib
378endif
379endif
380
381##############################
Bram Moolenaar071d4272004-06-13 20:20:40 +0000382ifeq (yes, $(GETTEXT))
383DEFINES += -DDYNAMIC_GETTEXT
384endif
385
386##############################
387ifeq (yes, $(ICONV))
388DEFINES += -DDYNAMIC_ICONV
389endif
390
391##############################
392ifeq (yes, $(MBYTE))
393DEFINES += -DFEAT_MBYTE
394endif
395
396##############################
397ifeq (yes, $(IME))
398DEFINES += -DFEAT_MBYTE_IME
399
400ifndef DYNAMIC_IME
401DYNAMIC_IME = yes
402endif
403
404ifeq (yes, $(DYNAMIC_IME))
405DEFINES += -DDYNAMIC_IME
406else
407EXTRA_LIBS += -limm32
408endif
409endif
410
411##############################
412ifeq (yes, $(DEBUG))
413DEFINES += -DDEBUG
414INCLUDES += -g -fstack-check
415DEBUG_SUFFIX = d
416else
417
418ifeq ($(OPTIMIZE), SIZE)
419OPTFLAG = -Os
420else
421ifeq ($(OPTIMIZE), MAXSPEED)
Bram Moolenaar1cd871b2004-12-19 22:46:22 +0000422OPTFLAG = -O3 -fomit-frame-pointer -freg-struct-return
Bram Moolenaar071d4272004-06-13 20:20:40 +0000423else
424OPTFLAG = -O2
425endif
426endif
427
428# A bug in the GCC <= 3.2 optimizer can cause a crash. The
429# following option removes the problem optimization.
430OPTFLAG += -fno-strength-reduce
431
432INCLUDES += -s
433
434endif
435
436##############################
437# USEDLL=yes will build a Cygwin32 executable that relies on cygwin1.dll.
438# USEDLL=no will build a Mingw32 executable with no extra dll dependencies.
439##############################
440ifeq (yes, $(USEDLL))
441DEFINES += -D_MAX_PATH=256 -D__CYGWIN__
Bram Moolenaar071d4272004-06-13 20:20:40 +0000442endif
443
444##############################
445ifeq (yes, $(POSTSCRIPT))
446DEFINES += -DMSWINPS
447endif
448
449##############################
450ifeq (yes, $(CSCOPE))
451DEFINES += -DFEAT_CSCOPE
452EXTRA_OBJS += $(OUTDIR)/if_cscope.o
453endif
454
455##############################
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000456ifeq ($(GUI),yes)
457
458##############################
Bram Moolenaar071d4272004-06-13 20:20:40 +0000459ifeq (yes, $(NETBEANS))
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000460# Only allow NETBEANS for a GUI build.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000461DEFINES += -DFEAT_NETBEANS_INTG
Bram Moolenaar408fb622005-03-07 23:03:19 +0000462EXTRA_OBJS += $(OUTDIR)/netbeans.o
Bram Moolenaar071d4272004-06-13 20:20:40 +0000463EXTRA_LIBS += -lwsock32
464
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000465ifeq (yes, $(NBDEBUG))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000466DEFINES += -DNBDEBUG
467NBDEBUG_DEP = nbdebug.h nbdebug.c
468endif
469
470endif
471
472##############################
473ifdef XPM
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000474# Only allow XPM for a GUI build.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000475DEFINES += -DFEAT_XPM_W32
476INCLUDES += -I$(XPM)/include
477EXTRA_OBJS += $(OUTDIR)/xpm_w32.o
478EXTRA_LIBS += -L$(XPM)/lib -lXpm
479endif
480
481##############################
Bram Moolenaar071d4272004-06-13 20:20:40 +0000482EXE = gvim$(DEBUG_SUFFIX).exe
483OUTDIR = gobj$(DEBUG_SUFFIX)
484DEFINES += -DFEAT_GUI_W32 -DFEAT_CLIPBOARD
Bram Moolenaar408fb622005-03-07 23:03:19 +0000485EXTRA_OBJS += $(OUTDIR)/gui.o $(OUTDIR)/gui_w32.o $(OUTDIR)/gui_beval.o $(OUTDIR)/os_w32exe.o
Bram Moolenaar45360022005-07-21 21:08:21 +0000486EXTRA_LIBS += -mwindows -lcomctl32 -lversion
Bram Moolenaar071d4272004-06-13 20:20:40 +0000487else
488EXE = vim$(DEBUG_SUFFIX).exe
489OUTDIR = obj$(DEBUG_SUFFIX)
490LIBS += -luser32 -lgdi32 -lcomdlg32
491endif
492
493##############################
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000494ifeq (yes, $(OLE))
495DEFINES += -DFEAT_OLE
496EXTRA_OBJS += $(OUTDIR)/if_ole.o
Bram Moolenaar5004e882013-02-16 18:16:15 +0100497EXTRA_LIBS += -loleaut32
498ifeq (yes, $(STATIC_STDCPLUS))
Bram Moolenaar452ff5b2013-02-20 13:34:19 +0100499EXTRA_LIBS += -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
Bram Moolenaar5004e882013-02-16 18:16:15 +0100500else
501EXTRA_LIBS += -lstdc++
502endif
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000503endif
504
505##############################
Bram Moolenaar071d4272004-06-13 20:20:40 +0000506ifneq (sh.exe, $(SHELL))
507DEL = rm
Bram Moolenaar32e4e1f2005-01-16 21:57:33 +0000508MKDIR = mkdir -p
Bram Moolenaar071d4272004-06-13 20:20:40 +0000509DIRSLASH = /
510else
511DEL = del
Bram Moolenaar32e4e1f2005-01-16 21:57:33 +0000512MKDIR = mkdir
Bram Moolenaar071d4272004-06-13 20:20:40 +0000513DIRSLASH = \\
514endif
515
516#>>>>> end of choices
517###########################################################################
518
519INCL = vim.h globals.h option.h keymap.h macros.h ascii.h term.h os_win32.h \
520 structs.h version.h
521
522CFLAGS = $(OPTFLAG) $(DEFINES) $(INCLUDES)
523
524RCFLAGS = -O coff $(DEFINES)
525
526OBJ = \
Bram Moolenaaredac1852010-05-18 20:34:20 +0200527 $(OUTDIR)/blowfish.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000528 $(OUTDIR)/buffer.o \
529 $(OUTDIR)/charset.o \
530 $(OUTDIR)/diff.o \
531 $(OUTDIR)/digraph.o \
532 $(OUTDIR)/edit.o \
533 $(OUTDIR)/eval.o \
534 $(OUTDIR)/ex_cmds.o \
535 $(OUTDIR)/ex_cmds2.o \
536 $(OUTDIR)/ex_docmd.o \
537 $(OUTDIR)/ex_eval.o \
538 $(OUTDIR)/ex_getln.o \
539 $(OUTDIR)/fileio.o \
540 $(OUTDIR)/fold.o \
541 $(OUTDIR)/getchar.o \
Bram Moolenaar58d98232005-07-23 22:25:46 +0000542 $(OUTDIR)/hardcopy.o \
Bram Moolenaar76b92b22006-03-24 22:46:53 +0000543 $(OUTDIR)/hashtab.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000544 $(OUTDIR)/main.o \
545 $(OUTDIR)/mark.o \
546 $(OUTDIR)/memfile.o \
547 $(OUTDIR)/memline.o \
548 $(OUTDIR)/menu.o \
549 $(OUTDIR)/message.o \
550 $(OUTDIR)/misc1.o \
551 $(OUTDIR)/misc2.o \
552 $(OUTDIR)/move.o \
553 $(OUTDIR)/mbyte.o \
554 $(OUTDIR)/normal.o \
555 $(OUTDIR)/ops.o \
556 $(OUTDIR)/option.o \
557 $(OUTDIR)/os_win32.o \
558 $(OUTDIR)/os_mswin.o \
Bram Moolenaar693e40c2013-02-26 14:56:42 +0100559 $(OUTDIR)/winclip.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000560 $(OUTDIR)/pathdef.o \
Bram Moolenaar76b92b22006-03-24 22:46:53 +0000561 $(OUTDIR)/popupmnu.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000562 $(OUTDIR)/quickfix.o \
563 $(OUTDIR)/regexp.o \
564 $(OUTDIR)/screen.o \
565 $(OUTDIR)/search.o \
Bram Moolenaaredac1852010-05-18 20:34:20 +0200566 $(OUTDIR)/sha256.o \
Bram Moolenaarfc735152005-03-22 22:54:12 +0000567 $(OUTDIR)/spell.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000568 $(OUTDIR)/syntax.o \
569 $(OUTDIR)/tag.o \
570 $(OUTDIR)/term.o \
571 $(OUTDIR)/ui.o \
572 $(OUTDIR)/undo.o \
573 $(OUTDIR)/version.o \
574 $(OUTDIR)/vimrc.o \
575 $(OUTDIR)/window.o \
576 $(EXTRA_OBJS)
577
578all: $(EXE) xxd/xxd.exe vimrun.exe install.exe uninstal.exe GvimExt/gvimext.dll
579
580# According to the Cygwin doc 1.2 FAQ, kernel32 should not be specified for
581# linking unless calling ld directly.
582# See /usr/doc/cygwin-doc-1.2/html/faq_toc.html#TOC93 for more information.
583$(EXE): $(OUTDIR) $(OBJ)
584 $(CC) $(CFLAGS) -o $(EXE) $(OBJ) $(LIBS) -luuid -lole32 $(EXTRA_LIBS)
585
586xxd/xxd.exe: xxd/xxd.c
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100587 $(MAKE) -C xxd -f Make_cyg.mak CC=$(CC) USEDLL=$(USEDLL)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000588
589GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h
Bram Moolenaar2369e352011-09-30 16:56:02 +0200590 $(MAKE) -C GvimExt -f Make_cyg.mak CROSS_COMPILE=$(CROSS_COMPILE)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000591
592vimrun.exe: vimrun.c
593 $(CC) $(CFLAGS) -o vimrun.exe vimrun.c $(LIBS)
594
595install.exe: dosinst.c
596 $(CC) $(CFLAGS) -o install.exe dosinst.c $(LIBS) -luuid -lole32
597
598uninstal.exe: uninstal.c
599 $(CC) $(CFLAGS) -o uninstal.exe uninstal.c $(LIBS)
600
601$(OUTDIR):
Bram Moolenaar32e4e1f2005-01-16 21:57:33 +0000602 $(MKDIR) $(OUTDIR)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000603
604tags:
605 command /c ctags *.c $(INCL)
606
607clean:
608 -$(DEL) $(OUTDIR)$(DIRSLASH)*.o
609 -rmdir $(OUTDIR)
Bram Moolenaarcf3630f2005-01-08 16:04:29 +0000610 -$(DEL) $(EXE) vimrun.exe install.exe uninstal.exe
Bram Moolenaar071d4272004-06-13 20:20:40 +0000611ifdef PERL
612 -$(DEL) if_perl.c
613endif
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000614ifdef MZSCHEME
615 -$(DEL) mzscheme_base.c
616endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000617 -$(DEL) pathdef.c
618 $(MAKE) -C xxd -f Make_cyg.mak clean
Bram Moolenaar2369e352011-09-30 16:56:02 +0200619 $(MAKE) -C GvimExt -f Make_cyg.mak clean
Bram Moolenaar071d4272004-06-13 20:20:40 +0000620
Bram Moolenaarcf3630f2005-01-08 16:04:29 +0000621distclean: clean
622 -$(DEL) obj$(DIRSLASH)*.o
623 -rmdir obj
624 -$(DEL) gobj$(DIRSLASH)*.o
625 -rmdir gobj
626 -$(DEL) objd$(DIRSLASH)*.o
627 -rmdir objd
628 -$(DEL) gobjd$(DIRSLASH)*.o
629 -rmdir gobjd
630 -$(DEL) *.exe
631
Bram Moolenaar071d4272004-06-13 20:20:40 +0000632###########################################################################
633
634$(OUTDIR)/%.o : %.c $(INCL)
635 $(CC) -c $(CFLAGS) $< -o $@
636
637$(OUTDIR)/ex_docmd.o: ex_docmd.c $(INCL) ex_cmds.h
638 $(CC) -c $(CFLAGS) ex_docmd.c -o $(OUTDIR)/ex_docmd.o
639
640$(OUTDIR)/ex_eval.o: ex_eval.c $(INCL) ex_cmds.h
641 $(CC) -c $(CFLAGS) ex_eval.c -o $(OUTDIR)/ex_eval.o
642
Bram Moolenaar4da70db2013-01-23 13:55:20 +0100643$(OUTDIR)/gui_w32.o: gui_w32.c gui_w48.c $(INCL)
644 $(CC) -c $(CFLAGS) gui_w32.c -o $(OUTDIR)/gui_w32.o
645
Bram Moolenaar071d4272004-06-13 20:20:40 +0000646$(OUTDIR)/if_cscope.o: if_cscope.c $(INCL) if_cscope.h
647 $(CC) -c $(CFLAGS) if_cscope.c -o $(OUTDIR)/if_cscope.o
648
649$(OUTDIR)/if_ole.o: if_ole.cpp $(INCL)
Bram Moolenaar61bfb9f2007-09-30 20:28:48 +0000650 $(CC) -c $(CFLAGS) if_ole.cpp -o $(OUTDIR)/if_ole.o
Bram Moolenaar071d4272004-06-13 20:20:40 +0000651
Bram Moolenaardd9a4a42013-06-03 20:12:51 +0200652$(OUTDIR)/if_python.o : if_python.c if_py_both.h $(INCL)
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200653 $(CC) -c $(CFLAGS) -I$(PYTHON)/include $< -o $@
654
Bram Moolenaardd9a4a42013-06-03 20:12:51 +0200655$(OUTDIR)/if_python3.o : if_python3.c if_py_both.h $(INCL)
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200656 $(CC) -c $(CFLAGS) -I$(PYTHON3)/include $< -o $@
657
Bram Moolenaar071d4272004-06-13 20:20:40 +0000658if_perl.c: if_perl.xs typemap
Bram Moolenaarcf3630f2005-01-08 16:04:29 +0000659 $(PERL)/bin/perl `cygpath -d $(PERL)/lib/ExtUtils/xsubpp` \
660 -prototypes -typemap \
661 `cygpath -d $(PERL)/lib/ExtUtils/typemap` if_perl.xs > $@
Bram Moolenaar071d4272004-06-13 20:20:40 +0000662
663$(OUTDIR)/if_perl.o: if_perl.c $(INCL)
664ifeq (yes, $(USEDLL))
665 $(CC) -c $(CFLAGS) -I/usr/include/mingw -D__MINGW32__ if_perl.c -o $(OUTDIR)/if_perl.o
666endif
667
668$(OUTDIR)/if_ruby.o: if_ruby.c $(INCL)
669ifeq (16, $(RUBY_VER))
670 $(CC) -c $(CFLAGS) -U_WIN32 if_ruby.c -o $(OUTDIR)/if_ruby.o
671endif
672
673$(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_DEP)
674 $(CC) -c $(CFLAGS) netbeans.c -o $(OUTDIR)/netbeans.o
675
Bram Moolenaarfbc0d2e2013-05-19 19:40:29 +0200676$(OUTDIR)/regexp.o: regexp.c regexp_nfa.c $(INCL)
677 $(CC) -c $(CFLAGS) regexp.c -o $(OUTDIR)/regexp.o
678
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000679$(OUTDIR)/if_mzsch.o: if_mzsch.c $(INCL) if_mzsch.h $(MZ_EXTRA_DEP)
680 $(CC) -c $(CFLAGS) if_mzsch.c -o $(OUTDIR)/if_mzsch.o
681
Bram Moolenaar071d4272004-06-13 20:20:40 +0000682$(OUTDIR)/vimrc.o: vim.rc version.h gui_w32_rc.h
683 $(RC) $(RCFLAGS) vim.rc -o $(OUTDIR)/vimrc.o
684
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000685mzscheme_base.c:
686 $(MZSCHEME)/mzc --c-mods mzscheme_base.c ++lib scheme/base
687
Bram Moolenaar071d4272004-06-13 20:20:40 +0000688pathdef.c: $(INCL)
689ifneq (sh.exe, $(SHELL))
690 @echo creating pathdef.c
691 @echo '/* pathdef.c */' > pathdef.c
692 @echo '#include "vim.h"' >> pathdef.c
693 @echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' >> pathdef.c
694 @echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' >> pathdef.c
695 @echo 'char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)";' >> pathdef.c
696 @echo 'char_u *all_lflags = (char_u *)"$(CC) -s -o $(EXE) $(LIBS) -luuid -lole32 $(EXTRA_LIBS)";' >> pathdef.c
697 @echo 'char_u *compiled_user = (char_u *)"$(USERNAME)";' >> pathdef.c
698 @echo 'char_u *compiled_sys = (char_u *)"$(USERDOMAIN)";' >> pathdef.c
699else
700 @echo creating pathdef.c
701 @echo /* pathdef.c */ > pathdef.c
702 @echo #include "vim.h" >> pathdef.c
703 @echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)"; >> pathdef.c
704 @echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)"; >> pathdef.c
705 @echo char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)"; >> pathdef.c
706 @echo char_u *all_lflags = (char_u *)"$(CC) -s -o $(EXE) $(LIBS) -luuid -lole32 $(EXTRA_LIBS)"; >> pathdef.c
707 @echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> pathdef.c
708 @echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> pathdef.c
709endif
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200710