blob: ff40548df9fb425a49dff25b5f73cdeb2eaa558e [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001#
2# Makefile for VIM on Win32, using Cygnus gcc
Bram Moolenaar07cf3822014-08-10 16:31:50 +02003# Updated by Dan Sharp.
4# Last Change: 2014 Aug 10
Bram Moolenaar65c1b012005-01-31 19:02:28 +00005#
6# Also read INSTALLpc.txt!
Bram Moolenaar071d4272004-06-13 20:20:40 +00007#
8# This compiles Vim as a Windows application. If you want Vim to run as a
9# Cygwin application use the Makefile (just like on Unix).
10#
11# GUI no or yes: set to yes if you want the GUI version (yes)
Bram Moolenaarb5a7a8b2014-08-06 14:52:30 +020012# DIRECTX no or yes: set to yes if you want use DirectWrite (no)
Bram Moolenaar071d4272004-06-13 20:20:40 +000013# PERL define to path to Perl dir to get Perl support (not defined)
14# PERL_VER define to version of Perl being used (56)
15# DYNAMIC_PERL no or yes: set to yes to load the Perl DLL dynamically (yes)
16# PYTHON define to path to Python dir to get PYTHON support (not defined)
17# PYTHON_VER define to version of Python being used (22)
18# DYNAMIC_PYTHON no or yes: use yes to load the Python DLL dynamically (yes)
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +020019# PYTHON3 define to path to Python3 dir to get PYTHON3 support (not defined)
20# PYTHON3_VER define to version of Python3 being used (22)
21# DYNAMIC_PYTHON3 no or yes: use yes to load the Python3 DLL dynamically (yes)
Bram Moolenaar071d4272004-06-13 20:20:40 +000022# TCL define to path to TCL dir to get TCL support (not defined)
23# TCL_VER define to version of TCL being used (83)
24# DYNAMIC_TCL no or yes: use yes to load the TCL DLL dynamically (yes)
25# RUBY define to path to Ruby dir to get Ruby support (not defined)
Bram Moolenaardd53a412012-11-28 16:18:29 +010026# RUBY_VER define to version of Ruby being used (16)
27# RUBY_VER_LONG same, but in format with dot. (1.6)
28# You must set RUBY_VER_LONG when changing RUBY_VER.
29# You must set RUBY_API_VER version to RUBY_VER_LONG.
30# Don't set ruby API version to RUBY_VER like 191.
Bram Moolenaar071d4272004-06-13 20:20:40 +000031# DYNAMIC_RUBY no or yes: use yes to load the Ruby DLL dynamically (yes)
Bram Moolenaar281bdce2005-01-25 21:53:18 +000032# MZSCHEME define to path to MzScheme dir to get MZSCHEME support (not defined)
33# MZSCHEME_VER define to version of MzScheme being used (209_000)
34# DYNAMIC_MZSCHEME no or yes: use yes to load the MzScheme DLLs dynamically (yes)
Bram Moolenaar65c1b012005-01-31 19:02:28 +000035# MZSCHEME_DLLS path to MzScheme DLLs (libmzgc and libmzsch), for "static" build.
Bram Moolenaar2d0860d2010-11-03 21:59:30 +010036# MZSCHEME_USE_RACKET define to use "racket" instead of "mzsch".
Bram Moolenaar0ba04292010-07-14 23:23:17 +020037# LUA define to path to Lua dir to get Lua support (not defined)
38# LUA_VER define to version of Lua being used (51)
39# DYNAMIC_LUA no or yes: use yes to load the Lua DLL dynamically (yes)
Bram Moolenaar071d4272004-06-13 20:20:40 +000040# GETTEXT no or yes: set to yes for dynamic gettext support (yes)
41# ICONV no or yes: set to yes for dynamic iconv support (yes)
42# MBYTE no or yes: set to yes to include multibyte support (yes)
43# IME no or yes: set to yes to include IME support (yes)
44# DYNAMIC_IME no or yes: set to yes to load imm32.dll dynamically (yes)
45# OLE no or yes: set to yes to make OLE gvim (no)
46# DEBUG no or yes: set to yes if you wish a DEBUGging build (no)
Bram Moolenaar1cd871b2004-12-19 22:46:22 +000047# CPUNR No longer supported, use ARCH.
Bram Moolenaar48f80c22010-02-24 15:08:27 +010048# ARCH i386 through pentium4: select -march argument to compile with
49# (i386)
Bram Moolenaar071d4272004-06-13 20:20:40 +000050# USEDLL no or yes: set to yes to use the Runtime library DLL (no)
51# For USEDLL=yes the cygwin1.dll is required to run Vim.
Bram Moolenaarc2149ea2013-02-13 17:06:11 +010052# For "no" the mingw-gcc-g++ package or the mingw64-i686-gcc-g++
Bram Moolenaar84a05ac2013-05-06 04:24:17 +020053# package is required to compile Vim. Or set CC to gcc-3 and add
Bram Moolenaar164fca32010-07-14 13:58:07 +020054# -L/lib/w32api to EXTRA_LIBS.
Bram Moolenaar071d4272004-06-13 20:20:40 +000055# POSTSCRIPT no or yes: set to yes for PostScript printing (no)
56# FEATURES TINY, SMALL, NORMAL, BIG or HUGE (BIG)
Bram Moolenaar95b557b2012-07-06 13:40:50 +020057# WINVER Lowest Win32 version to support. (0x0500)
Bram Moolenaar071d4272004-06-13 20:20:40 +000058# CSCOPE no or yes: to include cscope interface support (yes)
59# OPTIMIZE SPACE, SPEED, or MAXSPEED: set optimization level (MAXSPEED)
60# NETBEANS no or yes: to include netbeans interface support (yes when GUI
61# is yes)
Bram Moolenaarc9b4b052006-04-30 18:54:39 +000062# NBDEBUG no or yes: to include netbeans interface debugging support (no)
Bram Moolenaar071d4272004-06-13 20:20:40 +000063# XPM define to path to XPM dir to get XPM image support (not defined)
64#>>>>> choose options:
65ifndef GUI
66GUI=yes
67endif
68
69ifndef FEATURES
70FEATURES = BIG
71endif
72
73ifndef GETTEXT
74GETTEXT = yes
75endif
76
77ifndef ICONV
78ICONV = yes
79endif
80
81ifndef MBYTE
82MBYTE = yes
83endif
84
85ifndef IME
86IME = yes
87endif
88
Bram Moolenaar071d4272004-06-13 20:20:40 +000089ifndef ARCH
90ARCH = i386
91endif
92
Bram Moolenaarb5a7a8b2014-08-06 14:52:30 +020093ifndef DIRECTX
94DIRECTX = no
95endif
96
Bram Moolenaar071d4272004-06-13 20:20:40 +000097ifndef WINVER
Bram Moolenaar95b557b2012-07-06 13:40:50 +020098WINVER = 0x0500
Bram Moolenaar071d4272004-06-13 20:20:40 +000099endif
100
101ifndef CSCOPE
102CSCOPE = yes
103endif
104
105ifndef NETBEANS
106ifeq ($(GUI),yes)
107NETBEANS = yes
108endif
109endif
110
111ifndef OPTIMIZE
112OPTIMIZE = MAXSPEED
113endif
114
Bram Moolenaar5004e882013-02-16 18:16:15 +0100115
116# Link against the shared version of libstdc++ by default. Set
117# STATIC_STDCPLUS to "yes" to link against static version instead.
118ifndef STATIC_STDCPLUS
119STATIC_STDCPLUS=no
120endif
121
Bram Moolenaar071d4272004-06-13 20:20:40 +0000122### See feature.h for a list of optionals.
123### Any other defines can be included here.
124
125DEFINES = -DWIN32 -DHAVE_PATHDEF -DFEAT_$(FEATURES) \
126 -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER)
Bram Moolenaar254e0282013-07-06 13:35:08 +0200127ifeq ($(ARCH),x86-64)
128DEFINES+=-DMS_WIN64
129endif
Bram Moolenaar1cd871b2004-12-19 22:46:22 +0000130INCLUDES = -march=$(ARCH) -Iproto
Bram Moolenaar071d4272004-06-13 20:20:40 +0000131
132#>>>>> name of the compiler and linker, name of lib directory
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100133ifeq (yes, $(USEDLL))
134# CROSS_COMPILE is used for the gvimext DLL.
135CROSS_COMPILE = i686-pc-mingw32-
Bram Moolenaar071d4272004-06-13 20:20:40 +0000136CC = gcc
137RC = windres
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100138else
139# i686-pc-mingw32-gcc, i686-w64-mingw32-gcc or gcc-3 can be used.
140CROSS_COMPILE = i686-pc-mingw32-
141CC = $(CROSS_COMPILE)gcc
142RC = $(CROSS_COMPILE)windres
143endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000144
145##############################
146# DYNAMIC_PERL=yes and no both work
147##############################
148ifdef PERL
149DEFINES += -DFEAT_PERL
150INCLUDES += -I$(PERL)/lib/CORE
151EXTRA_OBJS += $(OUTDIR)/if_perl.o
152
153ifndef DYNAMIC_PERL
154DYNAMIC_PERL = yes
155endif
156
157ifndef PERL_VER
158PERL_VER = 56
159endif
160
161ifeq (yes, $(DYNAMIC_PERL))
162DEFINES += -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl$(PERL_VER).dll\"
163else
Bram Moolenaar6b107212013-12-11 15:06:40 +0100164EXTRA_LIBS += -L$(PERL)/lib/CORE -lperl$(PERL_VER)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000165endif
166endif
167
168##############################
169# DYNAMIC_PYTHON=yes works.
170# DYNAMIC_PYTHON=no does not (unresolved externals on link).
171##############################
172ifdef PYTHON
173DEFINES += -DFEAT_PYTHON
Bram Moolenaar071d4272004-06-13 20:20:40 +0000174EXTRA_OBJS += $(OUTDIR)/if_python.o
175
176ifndef DYNAMIC_PYTHON
177DYNAMIC_PYTHON = yes
178endif
179
180ifndef PYTHON_VER
181PYTHON_VER = 22
182endif
183
184ifeq (yes, $(DYNAMIC_PYTHON))
185DEFINES += -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python$(PYTHON_VER).dll\"
186else
187EXTRA_LIBS += $(PYTHON)/libs/python$(PYTHON_VER).lib
188endif
189endif
190
191##############################
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200192# DYNAMIC_PYTHON3=yes works.
193# DYNAMIC_PYTHON3=no does not (unresolved externals on link).
194##############################
195ifdef PYTHON3
196DEFINES += -DFEAT_PYTHON3
197EXTRA_OBJS += $(OUTDIR)/if_python3.o
198
199ifndef DYNAMIC_PYTHON3
200DYNAMIC_PYTHON3 = yes
201endif
202
203ifndef PYTHON3_VER
204PYTHON3_VER = 31
205endif
206
207ifeq (yes, $(DYNAMIC_PYTHON3))
208DEFINES += -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"python$(PYTHON3_VER).dll\"
209else
210EXTRA_LIBS += $(PYTHON3)/libs/python$(PYTHON3_VER).lib
211endif
212endif
213
214##############################
Bram Moolenaar071d4272004-06-13 20:20:40 +0000215# DYNAMIC_RUBY=yes works.
216# DYNAMIC_RUBY=no does not (process exits).
217##############################
218ifdef RUBY
219
Bram Moolenaar071d4272004-06-13 20:20:40 +0000220ifndef DYNAMIC_RUBY
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100221DYNAMIC_RUBY=yes
222endif
223# Set default value
224ifndef RUBY_VER
225RUBY_VER = 16
226endif
227ifndef RUBY_VER_LONG
228RUBY_VER_LONG = 1.6
229endif
230ifndef RUBY_API_VER
231RUBY_API_VER = $(subst .,,$(RUBY_VER_LONG))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000232endif
233
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100234ifndef RUBY_PLATFORM
Bram Moolenaar071d4272004-06-13 20:20:40 +0000235ifeq ($(RUBY_VER), 16)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000236RUBY_PLATFORM = i586-mswin32
Bram Moolenaar071d4272004-06-13 20:20:40 +0000237else
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100238ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/i386-mingw32),)
239RUBY_PLATFORM = i386-mingw32
240else
Bram Moolenaardb3fbe52013-03-07 15:16:21 +0100241ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/x64-mingw32),)
242RUBY_PLATFORM = x64-mingw32
243else
Bram Moolenaar071d4272004-06-13 20:20:40 +0000244RUBY_PLATFORM = i386-mswin32
245endif
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100246endif
247endif
Bram Moolenaardb3fbe52013-03-07 15:16:21 +0100248endif
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100249
Bram Moolenaar071d4272004-06-13 20:20:40 +0000250ifndef RUBY_INSTALL_NAME
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100251ifeq ($(RUBY_VER), 16)
252RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_API_VER)
253else
Bram Moolenaardb3fbe52013-03-07 15:16:21 +0100254ifeq ($(ARCH),x86-64)
255RUBY_INSTALL_NAME = x64-msvcrt-ruby$(RUBY_API_VER)
256else
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100257RUBY_INSTALL_NAME = msvcrt-ruby$(RUBY_API_VER)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000258endif
259endif
Bram Moolenaardb3fbe52013-03-07 15:16:21 +0100260endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000261
Bram Moolenaardd53a412012-11-28 16:18:29 +0100262ifeq (19, $(word 1,$(sort 19 $(RUBY_VER))))
263RUBY_19_OR_LATER = 1
264endif
265
Bram Moolenaar071d4272004-06-13 20:20:40 +0000266DEFINES += -DFEAT_RUBY
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100267ifneq ($(findstring w64-mingw32,$(CC)),)
268# A workaround for mingw-w64
269DEFINES += -DHAVE_STRUCT_TIMESPEC -DHAVE_STRUCT_TIMEZONE
270endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000271INCLUDES += -I$(RUBY)/lib/ruby/$(RUBY_VER_LONG)/$(RUBY_PLATFORM)
Bram Moolenaardd53a412012-11-28 16:18:29 +0100272ifdef RUBY_19_OR_LATER
273INCLUDES += -I$(RUBY)/include/ruby-$(RUBY_VER_LONG) -I$(RUBY)/include/ruby-$(RUBY_VER_LONG)/$(RUBY_PLATFORM)
274endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000275EXTRA_OBJS += $(OUTDIR)/if_ruby.o
276
277ifeq (yes, $(DYNAMIC_RUBY))
278DEFINES += -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\"
279DEFINES += -DDYNAMIC_RUBY_VER=$(RUBY_VER)
280else
Bram Moolenaare88a5f32013-11-28 16:32:38 +0100281EXTRA_LIBS += $(RUBY)/lib/$(RUBY_INSTALL_NAME)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000282endif
283endif
284
285##############################
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000286# DYNAMIC_MZSCHEME=yes works
287# DYNAMIC_MZSCHEME=no works too
288##############################
289ifdef MZSCHEME
290DEFINES += -DFEAT_MZSCHEME
291INCLUDES += -I$(MZSCHEME)/include
292EXTRA_OBJS += $(OUTDIR)/if_mzsch.o
293
294ifndef DYNAMIC_MZSCHEME
295DYNAMIC_MZSCHEME = yes
296endif
297
298ifndef MZSCHEME_VER
299MZSCHEME_VER = 209_000
300endif
301
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000302ifndef MZSCHEME_PRECISE_GC
303MZSCHEME_PRECISE_GC=no
304endif
305
306# for version 4.x we need to generate byte-code for Scheme base
307ifndef MZSCHEME_GENERATE_BASE
308MZSCHEME_GENERATE_BASE=no
309endif
310
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100311ifndef MZSCHEME_USE_RACKET
312MZSCHEME_MAIN_LIB=mzsch
313else
314MZSCHEME_MAIN_LIB=racket
315endif
316
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000317ifeq (yes, $(DYNAMIC_MZSCHEME))
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100318DEFINES += -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 +0000319else
320ifndef MZSCHEME_DLLS
321MZSCHEME_DLLS = $(MZSCHEME)
322endif
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000323ifeq (yes,$(MZSCHEME_PRECISE_GC))
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100324MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER)
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000325else
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100326MZSCHEME_LIB = -l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000327endif
328EXTRA_LIBS += -L$(MZSCHEME_DLLS) -L$(MZSCHEME_DLLS)/lib $(MZSCHEME_LIB)
329endif
330ifeq (yes,$(MZSCHEME_GENERATE_BASE))
331DEFINES += -DINCLUDE_MZSCHEME_BASE
332MZ_EXTRA_DEP += mzscheme_base.c
333endif
334ifeq (yes,$(MZSCHEME_PRECISE_GC))
335DEFINES += -DMZ_PRECISE_GC
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000336endif
337endif
338
339##############################
Bram Moolenaar071d4272004-06-13 20:20:40 +0000340# DYNAMIC_TCL=yes and no both work.
341##############################
342ifdef TCL
343DEFINES += -DFEAT_TCL
344INCLUDES += -I$(TCL)/include
345EXTRA_OBJS += $(OUTDIR)/if_tcl.o
346
347ifndef DYNAMIC_TCL
348DYNAMIC_TCL = yes
349endif
350
351ifndef TCL_VER
352TCL_VER = 83
353endif
354
355ifeq (yes, $(DYNAMIC_TCL))
356DEFINES += -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl$(TCL_VER).dll\"
357EXTRA_LIBS += $(TCL)/lib/tclstub$(TCL_VER).lib
358else
359EXTRA_LIBS += $(TCL)/lib/tcl$(TCL_VER).lib
360endif
361endif
362
363##############################
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200364# DYNAMIC_LUA=yes works.
365# DYNAMIC_LUA=no does not (unresolved externals on link).
366##############################
367ifdef LUA
368DEFINES += -DFEAT_LUA
369INCLUDES += -I$(LUA)/include
370EXTRA_OBJS += $(OUTDIR)/if_lua.o
371
372ifndef DYNAMIC_LUA
373DYNAMIC_LUA = yes
374endif
375
376ifndef LUA_VER
377LUA_VER = 51
378endif
379
380ifeq (yes, $(DYNAMIC_LUA))
381DEFINES += -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua$(LUA_VER).dll\"
382else
383EXTRA_LIBS += $(LUA)/lib/lua$(LUA_VER).lib
384endif
385endif
386
387##############################
Bram Moolenaar071d4272004-06-13 20:20:40 +0000388ifeq (yes, $(GETTEXT))
389DEFINES += -DDYNAMIC_GETTEXT
390endif
391
392##############################
393ifeq (yes, $(ICONV))
394DEFINES += -DDYNAMIC_ICONV
395endif
396
397##############################
398ifeq (yes, $(MBYTE))
399DEFINES += -DFEAT_MBYTE
400endif
401
402##############################
403ifeq (yes, $(IME))
404DEFINES += -DFEAT_MBYTE_IME
405
406ifndef DYNAMIC_IME
407DYNAMIC_IME = yes
408endif
409
410ifeq (yes, $(DYNAMIC_IME))
411DEFINES += -DDYNAMIC_IME
412else
413EXTRA_LIBS += -limm32
414endif
415endif
416
417##############################
418ifeq (yes, $(DEBUG))
419DEFINES += -DDEBUG
420INCLUDES += -g -fstack-check
421DEBUG_SUFFIX = d
422else
423
424ifeq ($(OPTIMIZE), SIZE)
425OPTFLAG = -Os
426else
427ifeq ($(OPTIMIZE), MAXSPEED)
Bram Moolenaar1cd871b2004-12-19 22:46:22 +0000428OPTFLAG = -O3 -fomit-frame-pointer -freg-struct-return
Bram Moolenaar071d4272004-06-13 20:20:40 +0000429else
430OPTFLAG = -O2
431endif
432endif
433
434# A bug in the GCC <= 3.2 optimizer can cause a crash. The
435# following option removes the problem optimization.
436OPTFLAG += -fno-strength-reduce
437
438INCLUDES += -s
439
440endif
441
442##############################
443# USEDLL=yes will build a Cygwin32 executable that relies on cygwin1.dll.
444# USEDLL=no will build a Mingw32 executable with no extra dll dependencies.
445##############################
446ifeq (yes, $(USEDLL))
447DEFINES += -D_MAX_PATH=256 -D__CYGWIN__
Bram Moolenaar071d4272004-06-13 20:20:40 +0000448endif
449
450##############################
451ifeq (yes, $(POSTSCRIPT))
452DEFINES += -DMSWINPS
453endif
454
455##############################
456ifeq (yes, $(CSCOPE))
457DEFINES += -DFEAT_CSCOPE
458EXTRA_OBJS += $(OUTDIR)/if_cscope.o
459endif
460
461##############################
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000462ifeq ($(GUI),yes)
463
464##############################
Bram Moolenaar071d4272004-06-13 20:20:40 +0000465ifeq (yes, $(NETBEANS))
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000466# Only allow NETBEANS for a GUI build.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000467DEFINES += -DFEAT_NETBEANS_INTG
Bram Moolenaar408fb622005-03-07 23:03:19 +0000468EXTRA_OBJS += $(OUTDIR)/netbeans.o
Bram Moolenaar071d4272004-06-13 20:20:40 +0000469EXTRA_LIBS += -lwsock32
470
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000471ifeq (yes, $(NBDEBUG))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000472DEFINES += -DNBDEBUG
473NBDEBUG_DEP = nbdebug.h nbdebug.c
474endif
475
476endif
477
478##############################
Bram Moolenaarb5a7a8b2014-08-06 14:52:30 +0200479ifeq (yes, $(DIRECTX))
480# Only allow DIRECTX for a GUI build.
481DEFINES += -DFEAT_DIRECTX -DDYNAMIC_DIRECTX
482EXTRA_OBJS += $(OUTDIR)/gui_dwrite.o
483EXTRA_LIBS += -ld2d1 -ldwrite
484USE_STDCPLUS = yes
485endif
486
487##############################
Bram Moolenaar666578b2014-11-05 13:43:21 +0100488ifndef XPM
489ifeq ($(ARCH),i386)
490XPM = xpm/x86
491endif
492ifeq ($(ARCH),i486)
493XPM = xpm/x86
494endif
495ifeq ($(ARCH),i586)
496XPM = xpm/x86
497endif
498ifeq ($(ARCH),i686)
499XPM = xpm/x86
500endif
501ifeq ($(ARCH),x86-64)
502XPM = xpm/x64
503endif
504endif
505ifdef XPM
Bram Moolenaardcc1ce22014-10-15 12:07:11 +0200506ifneq ($(XPM),no)
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000507# Only allow XPM for a GUI build.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000508DEFINES += -DFEAT_XPM_W32
Bram Moolenaar666578b2014-11-05 13:43:21 +0100509INCLUDES += -I$(XPM)/include -I$(XPM)/../include
Bram Moolenaar071d4272004-06-13 20:20:40 +0000510EXTRA_OBJS += $(OUTDIR)/xpm_w32.o
511EXTRA_LIBS += -L$(XPM)/lib -lXpm
512endif
Bram Moolenaar666578b2014-11-05 13:43:21 +0100513endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000514
515##############################
Bram Moolenaar071d4272004-06-13 20:20:40 +0000516EXE = gvim$(DEBUG_SUFFIX).exe
517OUTDIR = gobj$(DEBUG_SUFFIX)
518DEFINES += -DFEAT_GUI_W32 -DFEAT_CLIPBOARD
Bram Moolenaar408fb622005-03-07 23:03:19 +0000519EXTRA_OBJS += $(OUTDIR)/gui.o $(OUTDIR)/gui_w32.o $(OUTDIR)/gui_beval.o $(OUTDIR)/os_w32exe.o
Bram Moolenaar45360022005-07-21 21:08:21 +0000520EXTRA_LIBS += -mwindows -lcomctl32 -lversion
Bram Moolenaar071d4272004-06-13 20:20:40 +0000521else
522EXE = vim$(DEBUG_SUFFIX).exe
523OUTDIR = obj$(DEBUG_SUFFIX)
524LIBS += -luser32 -lgdi32 -lcomdlg32
525endif
526
527##############################
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000528ifeq (yes, $(OLE))
529DEFINES += -DFEAT_OLE
530EXTRA_OBJS += $(OUTDIR)/if_ole.o
Bram Moolenaar5004e882013-02-16 18:16:15 +0100531EXTRA_LIBS += -loleaut32
Bram Moolenaarb5a7a8b2014-08-06 14:52:30 +0200532USE_STDCPLUS = yes
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000533endif
534
535##############################
Bram Moolenaar071d4272004-06-13 20:20:40 +0000536ifneq (sh.exe, $(SHELL))
537DEL = rm
Bram Moolenaar32e4e1f2005-01-16 21:57:33 +0000538MKDIR = mkdir -p
Bram Moolenaar071d4272004-06-13 20:20:40 +0000539DIRSLASH = /
540else
541DEL = del
Bram Moolenaar32e4e1f2005-01-16 21:57:33 +0000542MKDIR = mkdir
Bram Moolenaar071d4272004-06-13 20:20:40 +0000543DIRSLASH = \\
544endif
545
Bram Moolenaarb5a7a8b2014-08-06 14:52:30 +0200546##############################
547ifeq (yes, $(USE_STDCPLUS))
548ifeq (yes, $(STATIC_STDCPLUS))
549EXTRA_LIBS += -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
550else
551EXTRA_LIBS += -lstdc++
552endif
553endif
554
Bram Moolenaar071d4272004-06-13 20:20:40 +0000555#>>>>> end of choices
556###########################################################################
557
558INCL = vim.h globals.h option.h keymap.h macros.h ascii.h term.h os_win32.h \
559 structs.h version.h
560
561CFLAGS = $(OPTFLAG) $(DEFINES) $(INCLUDES)
562
563RCFLAGS = -O coff $(DEFINES)
564
565OBJ = \
Bram Moolenaaredac1852010-05-18 20:34:20 +0200566 $(OUTDIR)/blowfish.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000567 $(OUTDIR)/buffer.o \
568 $(OUTDIR)/charset.o \
Bram Moolenaar07cf3822014-08-10 16:31:50 +0200569 $(OUTDIR)/crypt.o \
570 $(OUTDIR)/crypt_zip.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000571 $(OUTDIR)/diff.o \
572 $(OUTDIR)/digraph.o \
573 $(OUTDIR)/edit.o \
574 $(OUTDIR)/eval.o \
575 $(OUTDIR)/ex_cmds.o \
576 $(OUTDIR)/ex_cmds2.o \
577 $(OUTDIR)/ex_docmd.o \
578 $(OUTDIR)/ex_eval.o \
579 $(OUTDIR)/ex_getln.o \
580 $(OUTDIR)/fileio.o \
581 $(OUTDIR)/fold.o \
582 $(OUTDIR)/getchar.o \
Bram Moolenaar58d98232005-07-23 22:25:46 +0000583 $(OUTDIR)/hardcopy.o \
Bram Moolenaar76b92b22006-03-24 22:46:53 +0000584 $(OUTDIR)/hashtab.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000585 $(OUTDIR)/main.o \
586 $(OUTDIR)/mark.o \
587 $(OUTDIR)/memfile.o \
588 $(OUTDIR)/memline.o \
589 $(OUTDIR)/menu.o \
590 $(OUTDIR)/message.o \
591 $(OUTDIR)/misc1.o \
592 $(OUTDIR)/misc2.o \
593 $(OUTDIR)/move.o \
594 $(OUTDIR)/mbyte.o \
595 $(OUTDIR)/normal.o \
596 $(OUTDIR)/ops.o \
597 $(OUTDIR)/option.o \
598 $(OUTDIR)/os_win32.o \
599 $(OUTDIR)/os_mswin.o \
Bram Moolenaar693e40c2013-02-26 14:56:42 +0100600 $(OUTDIR)/winclip.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000601 $(OUTDIR)/pathdef.o \
Bram Moolenaar76b92b22006-03-24 22:46:53 +0000602 $(OUTDIR)/popupmnu.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000603 $(OUTDIR)/quickfix.o \
604 $(OUTDIR)/regexp.o \
605 $(OUTDIR)/screen.o \
606 $(OUTDIR)/search.o \
Bram Moolenaaredac1852010-05-18 20:34:20 +0200607 $(OUTDIR)/sha256.o \
Bram Moolenaarfc735152005-03-22 22:54:12 +0000608 $(OUTDIR)/spell.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000609 $(OUTDIR)/syntax.o \
610 $(OUTDIR)/tag.o \
611 $(OUTDIR)/term.o \
612 $(OUTDIR)/ui.o \
613 $(OUTDIR)/undo.o \
614 $(OUTDIR)/version.o \
615 $(OUTDIR)/vimrc.o \
616 $(OUTDIR)/window.o \
617 $(EXTRA_OBJS)
618
619all: $(EXE) xxd/xxd.exe vimrun.exe install.exe uninstal.exe GvimExt/gvimext.dll
620
621# According to the Cygwin doc 1.2 FAQ, kernel32 should not be specified for
622# linking unless calling ld directly.
623# See /usr/doc/cygwin-doc-1.2/html/faq_toc.html#TOC93 for more information.
624$(EXE): $(OUTDIR) $(OBJ)
625 $(CC) $(CFLAGS) -o $(EXE) $(OBJ) $(LIBS) -luuid -lole32 $(EXTRA_LIBS)
626
627xxd/xxd.exe: xxd/xxd.c
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100628 $(MAKE) -C xxd -f Make_cyg.mak CC=$(CC) USEDLL=$(USEDLL)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000629
630GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h
Bram Moolenaar2369e352011-09-30 16:56:02 +0200631 $(MAKE) -C GvimExt -f Make_cyg.mak CROSS_COMPILE=$(CROSS_COMPILE)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000632
633vimrun.exe: vimrun.c
634 $(CC) $(CFLAGS) -o vimrun.exe vimrun.c $(LIBS)
635
636install.exe: dosinst.c
637 $(CC) $(CFLAGS) -o install.exe dosinst.c $(LIBS) -luuid -lole32
638
639uninstal.exe: uninstal.c
640 $(CC) $(CFLAGS) -o uninstal.exe uninstal.c $(LIBS)
641
642$(OUTDIR):
Bram Moolenaar32e4e1f2005-01-16 21:57:33 +0000643 $(MKDIR) $(OUTDIR)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000644
645tags:
646 command /c ctags *.c $(INCL)
647
648clean:
649 -$(DEL) $(OUTDIR)$(DIRSLASH)*.o
650 -rmdir $(OUTDIR)
Bram Moolenaarcf3630f2005-01-08 16:04:29 +0000651 -$(DEL) $(EXE) vimrun.exe install.exe uninstal.exe
Bram Moolenaar071d4272004-06-13 20:20:40 +0000652ifdef PERL
653 -$(DEL) if_perl.c
654endif
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000655ifdef MZSCHEME
656 -$(DEL) mzscheme_base.c
657endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000658 -$(DEL) pathdef.c
659 $(MAKE) -C xxd -f Make_cyg.mak clean
Bram Moolenaar2369e352011-09-30 16:56:02 +0200660 $(MAKE) -C GvimExt -f Make_cyg.mak clean
Bram Moolenaar071d4272004-06-13 20:20:40 +0000661
Bram Moolenaarcf3630f2005-01-08 16:04:29 +0000662distclean: clean
663 -$(DEL) obj$(DIRSLASH)*.o
664 -rmdir obj
665 -$(DEL) gobj$(DIRSLASH)*.o
666 -rmdir gobj
667 -$(DEL) objd$(DIRSLASH)*.o
668 -rmdir objd
669 -$(DEL) gobjd$(DIRSLASH)*.o
670 -rmdir gobjd
671 -$(DEL) *.exe
672
Bram Moolenaar071d4272004-06-13 20:20:40 +0000673###########################################################################
674
675$(OUTDIR)/%.o : %.c $(INCL)
676 $(CC) -c $(CFLAGS) $< -o $@
677
678$(OUTDIR)/ex_docmd.o: ex_docmd.c $(INCL) ex_cmds.h
679 $(CC) -c $(CFLAGS) ex_docmd.c -o $(OUTDIR)/ex_docmd.o
680
681$(OUTDIR)/ex_eval.o: ex_eval.c $(INCL) ex_cmds.h
682 $(CC) -c $(CFLAGS) ex_eval.c -o $(OUTDIR)/ex_eval.o
683
Bram Moolenaar4da70db2013-01-23 13:55:20 +0100684$(OUTDIR)/gui_w32.o: gui_w32.c gui_w48.c $(INCL)
685 $(CC) -c $(CFLAGS) gui_w32.c -o $(OUTDIR)/gui_w32.o
686
Bram Moolenaarb5a7a8b2014-08-06 14:52:30 +0200687$(OUTDIR)/gui_dwrite.o: gui_dwrite.cpp $(INCL) gui_dwrite.h
688 $(CC) -c $(CFLAGS) gui_dwrite.cpp -o $(OUTDIR)/gui_dwrite.o
689
Bram Moolenaar071d4272004-06-13 20:20:40 +0000690$(OUTDIR)/if_cscope.o: if_cscope.c $(INCL) if_cscope.h
691 $(CC) -c $(CFLAGS) if_cscope.c -o $(OUTDIR)/if_cscope.o
692
693$(OUTDIR)/if_ole.o: if_ole.cpp $(INCL)
Bram Moolenaar61bfb9f2007-09-30 20:28:48 +0000694 $(CC) -c $(CFLAGS) if_ole.cpp -o $(OUTDIR)/if_ole.o
Bram Moolenaar071d4272004-06-13 20:20:40 +0000695
Bram Moolenaardd9a4a42013-06-03 20:12:51 +0200696$(OUTDIR)/if_python.o : if_python.c if_py_both.h $(INCL)
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200697 $(CC) -c $(CFLAGS) -I$(PYTHON)/include $< -o $@
698
Bram Moolenaardd9a4a42013-06-03 20:12:51 +0200699$(OUTDIR)/if_python3.o : if_python3.c if_py_both.h $(INCL)
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200700 $(CC) -c $(CFLAGS) -I$(PYTHON3)/include $< -o $@
701
Bram Moolenaar071d4272004-06-13 20:20:40 +0000702if_perl.c: if_perl.xs typemap
Bram Moolenaarcf3630f2005-01-08 16:04:29 +0000703 $(PERL)/bin/perl `cygpath -d $(PERL)/lib/ExtUtils/xsubpp` \
704 -prototypes -typemap \
705 `cygpath -d $(PERL)/lib/ExtUtils/typemap` if_perl.xs > $@
Bram Moolenaar071d4272004-06-13 20:20:40 +0000706
707$(OUTDIR)/if_perl.o: if_perl.c $(INCL)
708ifeq (yes, $(USEDLL))
709 $(CC) -c $(CFLAGS) -I/usr/include/mingw -D__MINGW32__ if_perl.c -o $(OUTDIR)/if_perl.o
710endif
711
712$(OUTDIR)/if_ruby.o: if_ruby.c $(INCL)
713ifeq (16, $(RUBY_VER))
714 $(CC) -c $(CFLAGS) -U_WIN32 if_ruby.c -o $(OUTDIR)/if_ruby.o
715endif
716
717$(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_DEP)
718 $(CC) -c $(CFLAGS) netbeans.c -o $(OUTDIR)/netbeans.o
719
Bram Moolenaarfbc0d2e2013-05-19 19:40:29 +0200720$(OUTDIR)/regexp.o: regexp.c regexp_nfa.c $(INCL)
721 $(CC) -c $(CFLAGS) regexp.c -o $(OUTDIR)/regexp.o
722
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000723$(OUTDIR)/if_mzsch.o: if_mzsch.c $(INCL) if_mzsch.h $(MZ_EXTRA_DEP)
724 $(CC) -c $(CFLAGS) if_mzsch.c -o $(OUTDIR)/if_mzsch.o
725
Bram Moolenaar071d4272004-06-13 20:20:40 +0000726$(OUTDIR)/vimrc.o: vim.rc version.h gui_w32_rc.h
727 $(RC) $(RCFLAGS) vim.rc -o $(OUTDIR)/vimrc.o
728
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000729mzscheme_base.c:
730 $(MZSCHEME)/mzc --c-mods mzscheme_base.c ++lib scheme/base
731
Bram Moolenaar071d4272004-06-13 20:20:40 +0000732pathdef.c: $(INCL)
733ifneq (sh.exe, $(SHELL))
734 @echo creating pathdef.c
735 @echo '/* pathdef.c */' > pathdef.c
736 @echo '#include "vim.h"' >> pathdef.c
737 @echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' >> pathdef.c
738 @echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' >> pathdef.c
739 @echo 'char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)";' >> pathdef.c
740 @echo 'char_u *all_lflags = (char_u *)"$(CC) -s -o $(EXE) $(LIBS) -luuid -lole32 $(EXTRA_LIBS)";' >> pathdef.c
741 @echo 'char_u *compiled_user = (char_u *)"$(USERNAME)";' >> pathdef.c
742 @echo 'char_u *compiled_sys = (char_u *)"$(USERDOMAIN)";' >> pathdef.c
743else
744 @echo creating pathdef.c
745 @echo /* pathdef.c */ > pathdef.c
746 @echo #include "vim.h" >> pathdef.c
747 @echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)"; >> pathdef.c
748 @echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)"; >> pathdef.c
749 @echo char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)"; >> pathdef.c
750 @echo char_u *all_lflags = (char_u *)"$(CC) -s -o $(EXE) $(LIBS) -luuid -lole32 $(EXTRA_LIBS)"; >> pathdef.c
751 @echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> pathdef.c
752 @echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> pathdef.c
753endif
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200754