blob: 7ba2f9dbf63ee9bd157e3151e44f3b9ec0e04d74 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001#
2# Makefile for VIM on Win32, using Cygnus gcc
Bram Moolenaar95b557b2012-07-06 13:40:50 +02003# Last updated by Dan Sharp. Last Change: 2012 Jun 30
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++
51# package is required to complie 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 Moolenaar1cd871b2004-12-19 22:46:22 +0000121INCLUDES = -march=$(ARCH) -Iproto
Bram Moolenaar071d4272004-06-13 20:20:40 +0000122
123#>>>>> name of the compiler and linker, name of lib directory
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100124ifeq (yes, $(USEDLL))
125# CROSS_COMPILE is used for the gvimext DLL.
126CROSS_COMPILE = i686-pc-mingw32-
Bram Moolenaar071d4272004-06-13 20:20:40 +0000127CC = gcc
128RC = windres
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100129else
130# i686-pc-mingw32-gcc, i686-w64-mingw32-gcc or gcc-3 can be used.
131CROSS_COMPILE = i686-pc-mingw32-
132CC = $(CROSS_COMPILE)gcc
133RC = $(CROSS_COMPILE)windres
134endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000135
136##############################
137# DYNAMIC_PERL=yes and no both work
138##############################
139ifdef PERL
140DEFINES += -DFEAT_PERL
141INCLUDES += -I$(PERL)/lib/CORE
142EXTRA_OBJS += $(OUTDIR)/if_perl.o
143
144ifndef DYNAMIC_PERL
145DYNAMIC_PERL = yes
146endif
147
148ifndef PERL_VER
149PERL_VER = 56
150endif
151
152ifeq (yes, $(DYNAMIC_PERL))
153DEFINES += -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl$(PERL_VER).dll\"
154else
155EXTRA_LIBS += $(PERL)/lib/CORE/perl$(PERL_VER).lib
156endif
157endif
158
159##############################
160# DYNAMIC_PYTHON=yes works.
161# DYNAMIC_PYTHON=no does not (unresolved externals on link).
162##############################
163ifdef PYTHON
164DEFINES += -DFEAT_PYTHON
Bram Moolenaar071d4272004-06-13 20:20:40 +0000165EXTRA_OBJS += $(OUTDIR)/if_python.o
166
167ifndef DYNAMIC_PYTHON
168DYNAMIC_PYTHON = yes
169endif
170
171ifndef PYTHON_VER
172PYTHON_VER = 22
173endif
174
175ifeq (yes, $(DYNAMIC_PYTHON))
176DEFINES += -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python$(PYTHON_VER).dll\"
177else
178EXTRA_LIBS += $(PYTHON)/libs/python$(PYTHON_VER).lib
179endif
180endif
181
182##############################
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200183# DYNAMIC_PYTHON3=yes works.
184# DYNAMIC_PYTHON3=no does not (unresolved externals on link).
185##############################
186ifdef PYTHON3
187DEFINES += -DFEAT_PYTHON3
188EXTRA_OBJS += $(OUTDIR)/if_python3.o
189
190ifndef DYNAMIC_PYTHON3
191DYNAMIC_PYTHON3 = yes
192endif
193
194ifndef PYTHON3_VER
195PYTHON3_VER = 31
196endif
197
198ifeq (yes, $(DYNAMIC_PYTHON3))
199DEFINES += -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"python$(PYTHON3_VER).dll\"
200else
201EXTRA_LIBS += $(PYTHON3)/libs/python$(PYTHON3_VER).lib
202endif
203endif
204
205##############################
Bram Moolenaar071d4272004-06-13 20:20:40 +0000206# DYNAMIC_RUBY=yes works.
207# DYNAMIC_RUBY=no does not (process exits).
208##############################
209ifdef RUBY
210
Bram Moolenaar071d4272004-06-13 20:20:40 +0000211ifndef DYNAMIC_RUBY
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100212DYNAMIC_RUBY=yes
213endif
214# Set default value
215ifndef RUBY_VER
216RUBY_VER = 16
217endif
218ifndef RUBY_VER_LONG
219RUBY_VER_LONG = 1.6
220endif
221ifndef RUBY_API_VER
222RUBY_API_VER = $(subst .,,$(RUBY_VER_LONG))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000223endif
224
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100225ifndef RUBY_PLATFORM
Bram Moolenaar071d4272004-06-13 20:20:40 +0000226ifeq ($(RUBY_VER), 16)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000227RUBY_PLATFORM = i586-mswin32
Bram Moolenaar071d4272004-06-13 20:20:40 +0000228else
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100229ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/i386-mingw32),)
230RUBY_PLATFORM = i386-mingw32
231else
Bram Moolenaar071d4272004-06-13 20:20:40 +0000232RUBY_PLATFORM = i386-mswin32
233endif
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100234endif
235endif
236
Bram Moolenaar071d4272004-06-13 20:20:40 +0000237ifndef RUBY_INSTALL_NAME
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100238ifeq ($(RUBY_VER), 16)
239RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_API_VER)
240else
241RUBY_INSTALL_NAME = msvcrt-ruby$(RUBY_API_VER)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000242endif
243endif
244
Bram Moolenaardd53a412012-11-28 16:18:29 +0100245ifeq (19, $(word 1,$(sort 19 $(RUBY_VER))))
246RUBY_19_OR_LATER = 1
247endif
248
Bram Moolenaar071d4272004-06-13 20:20:40 +0000249DEFINES += -DFEAT_RUBY
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100250ifneq ($(findstring w64-mingw32,$(CC)),)
251# A workaround for mingw-w64
252DEFINES += -DHAVE_STRUCT_TIMESPEC -DHAVE_STRUCT_TIMEZONE
253endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000254INCLUDES += -I$(RUBY)/lib/ruby/$(RUBY_VER_LONG)/$(RUBY_PLATFORM)
Bram Moolenaardd53a412012-11-28 16:18:29 +0100255ifdef RUBY_19_OR_LATER
256INCLUDES += -I$(RUBY)/include/ruby-$(RUBY_VER_LONG) -I$(RUBY)/include/ruby-$(RUBY_VER_LONG)/$(RUBY_PLATFORM)
257endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000258EXTRA_OBJS += $(OUTDIR)/if_ruby.o
259
260ifeq (yes, $(DYNAMIC_RUBY))
261DEFINES += -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\"
262DEFINES += -DDYNAMIC_RUBY_VER=$(RUBY_VER)
263else
264EXTRA_LIBS += $(RUBY)/lib/$(RUBY_INSTALL_NAME).lib
265endif
266endif
267
268##############################
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000269# DYNAMIC_MZSCHEME=yes works
270# DYNAMIC_MZSCHEME=no works too
271##############################
272ifdef MZSCHEME
273DEFINES += -DFEAT_MZSCHEME
274INCLUDES += -I$(MZSCHEME)/include
275EXTRA_OBJS += $(OUTDIR)/if_mzsch.o
276
277ifndef DYNAMIC_MZSCHEME
278DYNAMIC_MZSCHEME = yes
279endif
280
281ifndef MZSCHEME_VER
282MZSCHEME_VER = 209_000
283endif
284
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000285ifndef MZSCHEME_PRECISE_GC
286MZSCHEME_PRECISE_GC=no
287endif
288
289# for version 4.x we need to generate byte-code for Scheme base
290ifndef MZSCHEME_GENERATE_BASE
291MZSCHEME_GENERATE_BASE=no
292endif
293
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100294ifndef MZSCHEME_USE_RACKET
295MZSCHEME_MAIN_LIB=mzsch
296else
297MZSCHEME_MAIN_LIB=racket
298endif
299
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000300ifeq (yes, $(DYNAMIC_MZSCHEME))
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100301DEFINES += -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 +0000302else
303ifndef MZSCHEME_DLLS
304MZSCHEME_DLLS = $(MZSCHEME)
305endif
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000306ifeq (yes,$(MZSCHEME_PRECISE_GC))
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100307MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER)
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000308else
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100309MZSCHEME_LIB = -l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000310endif
311EXTRA_LIBS += -L$(MZSCHEME_DLLS) -L$(MZSCHEME_DLLS)/lib $(MZSCHEME_LIB)
312endif
313ifeq (yes,$(MZSCHEME_GENERATE_BASE))
314DEFINES += -DINCLUDE_MZSCHEME_BASE
315MZ_EXTRA_DEP += mzscheme_base.c
316endif
317ifeq (yes,$(MZSCHEME_PRECISE_GC))
318DEFINES += -DMZ_PRECISE_GC
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000319endif
320endif
321
322##############################
Bram Moolenaar071d4272004-06-13 20:20:40 +0000323# DYNAMIC_TCL=yes and no both work.
324##############################
325ifdef TCL
326DEFINES += -DFEAT_TCL
327INCLUDES += -I$(TCL)/include
328EXTRA_OBJS += $(OUTDIR)/if_tcl.o
329
330ifndef DYNAMIC_TCL
331DYNAMIC_TCL = yes
332endif
333
334ifndef TCL_VER
335TCL_VER = 83
336endif
337
338ifeq (yes, $(DYNAMIC_TCL))
339DEFINES += -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl$(TCL_VER).dll\"
340EXTRA_LIBS += $(TCL)/lib/tclstub$(TCL_VER).lib
341else
342EXTRA_LIBS += $(TCL)/lib/tcl$(TCL_VER).lib
343endif
344endif
345
346##############################
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200347# DYNAMIC_LUA=yes works.
348# DYNAMIC_LUA=no does not (unresolved externals on link).
349##############################
350ifdef LUA
351DEFINES += -DFEAT_LUA
352INCLUDES += -I$(LUA)/include
353EXTRA_OBJS += $(OUTDIR)/if_lua.o
354
355ifndef DYNAMIC_LUA
356DYNAMIC_LUA = yes
357endif
358
359ifndef LUA_VER
360LUA_VER = 51
361endif
362
363ifeq (yes, $(DYNAMIC_LUA))
364DEFINES += -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua$(LUA_VER).dll\"
365else
366EXTRA_LIBS += $(LUA)/lib/lua$(LUA_VER).lib
367endif
368endif
369
370##############################
Bram Moolenaar071d4272004-06-13 20:20:40 +0000371ifeq (yes, $(GETTEXT))
372DEFINES += -DDYNAMIC_GETTEXT
373endif
374
375##############################
376ifeq (yes, $(ICONV))
377DEFINES += -DDYNAMIC_ICONV
378endif
379
380##############################
381ifeq (yes, $(MBYTE))
382DEFINES += -DFEAT_MBYTE
383endif
384
385##############################
386ifeq (yes, $(IME))
387DEFINES += -DFEAT_MBYTE_IME
388
389ifndef DYNAMIC_IME
390DYNAMIC_IME = yes
391endif
392
393ifeq (yes, $(DYNAMIC_IME))
394DEFINES += -DDYNAMIC_IME
395else
396EXTRA_LIBS += -limm32
397endif
398endif
399
400##############################
401ifeq (yes, $(DEBUG))
402DEFINES += -DDEBUG
403INCLUDES += -g -fstack-check
404DEBUG_SUFFIX = d
405else
406
407ifeq ($(OPTIMIZE), SIZE)
408OPTFLAG = -Os
409else
410ifeq ($(OPTIMIZE), MAXSPEED)
Bram Moolenaar1cd871b2004-12-19 22:46:22 +0000411OPTFLAG = -O3 -fomit-frame-pointer -freg-struct-return
Bram Moolenaar071d4272004-06-13 20:20:40 +0000412else
413OPTFLAG = -O2
414endif
415endif
416
417# A bug in the GCC <= 3.2 optimizer can cause a crash. The
418# following option removes the problem optimization.
419OPTFLAG += -fno-strength-reduce
420
421INCLUDES += -s
422
423endif
424
425##############################
426# USEDLL=yes will build a Cygwin32 executable that relies on cygwin1.dll.
427# USEDLL=no will build a Mingw32 executable with no extra dll dependencies.
428##############################
429ifeq (yes, $(USEDLL))
430DEFINES += -D_MAX_PATH=256 -D__CYGWIN__
431else
432INCLUDES += -mno-cygwin
433endif
434
435##############################
436ifeq (yes, $(POSTSCRIPT))
437DEFINES += -DMSWINPS
438endif
439
440##############################
441ifeq (yes, $(CSCOPE))
442DEFINES += -DFEAT_CSCOPE
443EXTRA_OBJS += $(OUTDIR)/if_cscope.o
444endif
445
446##############################
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000447ifeq ($(GUI),yes)
448
449##############################
Bram Moolenaar071d4272004-06-13 20:20:40 +0000450ifeq (yes, $(NETBEANS))
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000451# Only allow NETBEANS for a GUI build.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000452DEFINES += -DFEAT_NETBEANS_INTG
Bram Moolenaar408fb622005-03-07 23:03:19 +0000453EXTRA_OBJS += $(OUTDIR)/netbeans.o
Bram Moolenaar071d4272004-06-13 20:20:40 +0000454EXTRA_LIBS += -lwsock32
455
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000456ifeq (yes, $(NBDEBUG))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000457DEFINES += -DNBDEBUG
458NBDEBUG_DEP = nbdebug.h nbdebug.c
459endif
460
461endif
462
463##############################
464ifdef XPM
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000465# Only allow XPM for a GUI build.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000466DEFINES += -DFEAT_XPM_W32
467INCLUDES += -I$(XPM)/include
468EXTRA_OBJS += $(OUTDIR)/xpm_w32.o
469EXTRA_LIBS += -L$(XPM)/lib -lXpm
470endif
471
472##############################
Bram Moolenaar071d4272004-06-13 20:20:40 +0000473EXE = gvim$(DEBUG_SUFFIX).exe
474OUTDIR = gobj$(DEBUG_SUFFIX)
475DEFINES += -DFEAT_GUI_W32 -DFEAT_CLIPBOARD
Bram Moolenaar408fb622005-03-07 23:03:19 +0000476EXTRA_OBJS += $(OUTDIR)/gui.o $(OUTDIR)/gui_w32.o $(OUTDIR)/gui_beval.o $(OUTDIR)/os_w32exe.o
Bram Moolenaar45360022005-07-21 21:08:21 +0000477EXTRA_LIBS += -mwindows -lcomctl32 -lversion
Bram Moolenaar071d4272004-06-13 20:20:40 +0000478else
479EXE = vim$(DEBUG_SUFFIX).exe
480OUTDIR = obj$(DEBUG_SUFFIX)
481LIBS += -luser32 -lgdi32 -lcomdlg32
482endif
483
484##############################
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000485ifeq (yes, $(OLE))
486DEFINES += -DFEAT_OLE
487EXTRA_OBJS += $(OUTDIR)/if_ole.o
Bram Moolenaar5004e882013-02-16 18:16:15 +0100488EXTRA_LIBS += -loleaut32
489ifeq (yes, $(STATIC_STDCPLUS))
490EXTRA_LIBS += -Wl,-Bstatic -lstdc++ -lsupc++ -Wl,-Bdynamic
491else
492EXTRA_LIBS += -lstdc++
493endif
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000494endif
495
496##############################
Bram Moolenaar071d4272004-06-13 20:20:40 +0000497ifneq (sh.exe, $(SHELL))
498DEL = rm
Bram Moolenaar32e4e1f2005-01-16 21:57:33 +0000499MKDIR = mkdir -p
Bram Moolenaar071d4272004-06-13 20:20:40 +0000500DIRSLASH = /
501else
502DEL = del
Bram Moolenaar32e4e1f2005-01-16 21:57:33 +0000503MKDIR = mkdir
Bram Moolenaar071d4272004-06-13 20:20:40 +0000504DIRSLASH = \\
505endif
506
507#>>>>> end of choices
508###########################################################################
509
510INCL = vim.h globals.h option.h keymap.h macros.h ascii.h term.h os_win32.h \
511 structs.h version.h
512
513CFLAGS = $(OPTFLAG) $(DEFINES) $(INCLUDES)
514
515RCFLAGS = -O coff $(DEFINES)
516
517OBJ = \
Bram Moolenaaredac1852010-05-18 20:34:20 +0200518 $(OUTDIR)/blowfish.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000519 $(OUTDIR)/buffer.o \
520 $(OUTDIR)/charset.o \
521 $(OUTDIR)/diff.o \
522 $(OUTDIR)/digraph.o \
523 $(OUTDIR)/edit.o \
524 $(OUTDIR)/eval.o \
525 $(OUTDIR)/ex_cmds.o \
526 $(OUTDIR)/ex_cmds2.o \
527 $(OUTDIR)/ex_docmd.o \
528 $(OUTDIR)/ex_eval.o \
529 $(OUTDIR)/ex_getln.o \
530 $(OUTDIR)/fileio.o \
531 $(OUTDIR)/fold.o \
532 $(OUTDIR)/getchar.o \
Bram Moolenaar58d98232005-07-23 22:25:46 +0000533 $(OUTDIR)/hardcopy.o \
Bram Moolenaar76b92b22006-03-24 22:46:53 +0000534 $(OUTDIR)/hashtab.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000535 $(OUTDIR)/main.o \
536 $(OUTDIR)/mark.o \
537 $(OUTDIR)/memfile.o \
538 $(OUTDIR)/memline.o \
539 $(OUTDIR)/menu.o \
540 $(OUTDIR)/message.o \
541 $(OUTDIR)/misc1.o \
542 $(OUTDIR)/misc2.o \
543 $(OUTDIR)/move.o \
544 $(OUTDIR)/mbyte.o \
545 $(OUTDIR)/normal.o \
546 $(OUTDIR)/ops.o \
547 $(OUTDIR)/option.o \
548 $(OUTDIR)/os_win32.o \
549 $(OUTDIR)/os_mswin.o \
550 $(OUTDIR)/pathdef.o \
Bram Moolenaar76b92b22006-03-24 22:46:53 +0000551 $(OUTDIR)/popupmnu.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000552 $(OUTDIR)/quickfix.o \
553 $(OUTDIR)/regexp.o \
554 $(OUTDIR)/screen.o \
555 $(OUTDIR)/search.o \
Bram Moolenaaredac1852010-05-18 20:34:20 +0200556 $(OUTDIR)/sha256.o \
Bram Moolenaarfc735152005-03-22 22:54:12 +0000557 $(OUTDIR)/spell.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000558 $(OUTDIR)/syntax.o \
559 $(OUTDIR)/tag.o \
560 $(OUTDIR)/term.o \
561 $(OUTDIR)/ui.o \
562 $(OUTDIR)/undo.o \
563 $(OUTDIR)/version.o \
564 $(OUTDIR)/vimrc.o \
565 $(OUTDIR)/window.o \
566 $(EXTRA_OBJS)
567
568all: $(EXE) xxd/xxd.exe vimrun.exe install.exe uninstal.exe GvimExt/gvimext.dll
569
570# According to the Cygwin doc 1.2 FAQ, kernel32 should not be specified for
571# linking unless calling ld directly.
572# See /usr/doc/cygwin-doc-1.2/html/faq_toc.html#TOC93 for more information.
573$(EXE): $(OUTDIR) $(OBJ)
574 $(CC) $(CFLAGS) -o $(EXE) $(OBJ) $(LIBS) -luuid -lole32 $(EXTRA_LIBS)
575
576xxd/xxd.exe: xxd/xxd.c
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100577 $(MAKE) -C xxd -f Make_cyg.mak CC=$(CC) USEDLL=$(USEDLL)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000578
579GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h
Bram Moolenaar2369e352011-09-30 16:56:02 +0200580 $(MAKE) -C GvimExt -f Make_cyg.mak CROSS_COMPILE=$(CROSS_COMPILE)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000581
582vimrun.exe: vimrun.c
583 $(CC) $(CFLAGS) -o vimrun.exe vimrun.c $(LIBS)
584
585install.exe: dosinst.c
586 $(CC) $(CFLAGS) -o install.exe dosinst.c $(LIBS) -luuid -lole32
587
588uninstal.exe: uninstal.c
589 $(CC) $(CFLAGS) -o uninstal.exe uninstal.c $(LIBS)
590
591$(OUTDIR):
Bram Moolenaar32e4e1f2005-01-16 21:57:33 +0000592 $(MKDIR) $(OUTDIR)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000593
594tags:
595 command /c ctags *.c $(INCL)
596
597clean:
598 -$(DEL) $(OUTDIR)$(DIRSLASH)*.o
599 -rmdir $(OUTDIR)
Bram Moolenaarcf3630f2005-01-08 16:04:29 +0000600 -$(DEL) $(EXE) vimrun.exe install.exe uninstal.exe
Bram Moolenaar071d4272004-06-13 20:20:40 +0000601ifdef PERL
602 -$(DEL) if_perl.c
603endif
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000604ifdef MZSCHEME
605 -$(DEL) mzscheme_base.c
606endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000607 -$(DEL) pathdef.c
608 $(MAKE) -C xxd -f Make_cyg.mak clean
Bram Moolenaar2369e352011-09-30 16:56:02 +0200609 $(MAKE) -C GvimExt -f Make_cyg.mak clean
Bram Moolenaar071d4272004-06-13 20:20:40 +0000610
Bram Moolenaarcf3630f2005-01-08 16:04:29 +0000611distclean: clean
612 -$(DEL) obj$(DIRSLASH)*.o
613 -rmdir obj
614 -$(DEL) gobj$(DIRSLASH)*.o
615 -rmdir gobj
616 -$(DEL) objd$(DIRSLASH)*.o
617 -rmdir objd
618 -$(DEL) gobjd$(DIRSLASH)*.o
619 -rmdir gobjd
620 -$(DEL) *.exe
621
Bram Moolenaar071d4272004-06-13 20:20:40 +0000622###########################################################################
623
624$(OUTDIR)/%.o : %.c $(INCL)
625 $(CC) -c $(CFLAGS) $< -o $@
626
627$(OUTDIR)/ex_docmd.o: ex_docmd.c $(INCL) ex_cmds.h
628 $(CC) -c $(CFLAGS) ex_docmd.c -o $(OUTDIR)/ex_docmd.o
629
630$(OUTDIR)/ex_eval.o: ex_eval.c $(INCL) ex_cmds.h
631 $(CC) -c $(CFLAGS) ex_eval.c -o $(OUTDIR)/ex_eval.o
632
Bram Moolenaar4da70db2013-01-23 13:55:20 +0100633$(OUTDIR)/gui_w32.o: gui_w32.c gui_w48.c $(INCL)
634 $(CC) -c $(CFLAGS) gui_w32.c -o $(OUTDIR)/gui_w32.o
635
Bram Moolenaar071d4272004-06-13 20:20:40 +0000636$(OUTDIR)/if_cscope.o: if_cscope.c $(INCL) if_cscope.h
637 $(CC) -c $(CFLAGS) if_cscope.c -o $(OUTDIR)/if_cscope.o
638
639$(OUTDIR)/if_ole.o: if_ole.cpp $(INCL)
Bram Moolenaar61bfb9f2007-09-30 20:28:48 +0000640 $(CC) -c $(CFLAGS) if_ole.cpp -o $(OUTDIR)/if_ole.o
Bram Moolenaar071d4272004-06-13 20:20:40 +0000641
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200642$(OUTDIR)/if_python.o : if_python.c $(INCL)
643 $(CC) -c $(CFLAGS) -I$(PYTHON)/include $< -o $@
644
645$(OUTDIR)/if_python3.o : if_python3.c $(INCL)
646 $(CC) -c $(CFLAGS) -I$(PYTHON3)/include $< -o $@
647
Bram Moolenaar071d4272004-06-13 20:20:40 +0000648if_perl.c: if_perl.xs typemap
Bram Moolenaarcf3630f2005-01-08 16:04:29 +0000649 $(PERL)/bin/perl `cygpath -d $(PERL)/lib/ExtUtils/xsubpp` \
650 -prototypes -typemap \
651 `cygpath -d $(PERL)/lib/ExtUtils/typemap` if_perl.xs > $@
Bram Moolenaar071d4272004-06-13 20:20:40 +0000652
653$(OUTDIR)/if_perl.o: if_perl.c $(INCL)
654ifeq (yes, $(USEDLL))
655 $(CC) -c $(CFLAGS) -I/usr/include/mingw -D__MINGW32__ if_perl.c -o $(OUTDIR)/if_perl.o
656endif
657
658$(OUTDIR)/if_ruby.o: if_ruby.c $(INCL)
659ifeq (16, $(RUBY_VER))
660 $(CC) -c $(CFLAGS) -U_WIN32 if_ruby.c -o $(OUTDIR)/if_ruby.o
661endif
662
663$(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_DEP)
664 $(CC) -c $(CFLAGS) netbeans.c -o $(OUTDIR)/netbeans.o
665
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000666$(OUTDIR)/if_mzsch.o: if_mzsch.c $(INCL) if_mzsch.h $(MZ_EXTRA_DEP)
667 $(CC) -c $(CFLAGS) if_mzsch.c -o $(OUTDIR)/if_mzsch.o
668
Bram Moolenaar071d4272004-06-13 20:20:40 +0000669$(OUTDIR)/vimrc.o: vim.rc version.h gui_w32_rc.h
670 $(RC) $(RCFLAGS) vim.rc -o $(OUTDIR)/vimrc.o
671
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000672mzscheme_base.c:
673 $(MZSCHEME)/mzc --c-mods mzscheme_base.c ++lib scheme/base
674
Bram Moolenaar071d4272004-06-13 20:20:40 +0000675pathdef.c: $(INCL)
676ifneq (sh.exe, $(SHELL))
677 @echo creating pathdef.c
678 @echo '/* pathdef.c */' > pathdef.c
679 @echo '#include "vim.h"' >> pathdef.c
680 @echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' >> pathdef.c
681 @echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' >> pathdef.c
682 @echo 'char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)";' >> pathdef.c
683 @echo 'char_u *all_lflags = (char_u *)"$(CC) -s -o $(EXE) $(LIBS) -luuid -lole32 $(EXTRA_LIBS)";' >> pathdef.c
684 @echo 'char_u *compiled_user = (char_u *)"$(USERNAME)";' >> pathdef.c
685 @echo 'char_u *compiled_sys = (char_u *)"$(USERDOMAIN)";' >> pathdef.c
686else
687 @echo creating pathdef.c
688 @echo /* pathdef.c */ > pathdef.c
689 @echo #include "vim.h" >> pathdef.c
690 @echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)"; >> pathdef.c
691 @echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)"; >> pathdef.c
692 @echo char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)"; >> pathdef.c
693 @echo char_u *all_lflags = (char_u *)"$(CC) -s -o $(EXE) $(LIBS) -luuid -lole32 $(EXTRA_LIBS)"; >> pathdef.c
694 @echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> pathdef.c
695 @echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> pathdef.c
696endif
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200697